)]}'
{
  "commit": "e06ba702d5a36f547ce5479b7e5ec29b236dc381",
  "tree": "cb8985d08831525a23c5281a53a34280ec2f55ae",
  "parents": [
    "60247ca149f8092523f9503001f0ee02a67f3335"
  ],
  "author": {
    "name": "Andy Ross",
    "email": "andrew.j.ross@intel.com",
    "time": "Tue Jan 14 06:26:10 2020 -0800"
  },
  "committer": {
    "name": "Andrew Boie",
    "email": "andrewboie@gmail.com",
    "time": "Tue Jan 21 14:47:52 2020 -0800"
  },
  "message": "kernel/sched: Address thread abort termination delay issue on SMP\n\nIt\u0027s possible for a thread to abort itself simultaneously with an\nexternal abort from another thread.  In fact in our test suite this is\na common thing, as ztest will abort its own spawend threads at the end\nof a test, as they tend to be exiting on their own.\n\nWhen that happens, the thread marks itself DEAD and does all its\nscheduler bookeeping, but it is STILL RUNNING on its own stack until\nit makes its way to its final swap.  The external context would see\nthat \"dead\" metadata and return from k_thread_abort(), allowing the\nnext test to reuse and spawn the same thread struct while the old\ncontext was still running.  Obviously that\u0027s bad.\n\nUnfortunately, this is impossible to address completely without\nmodifying every SMP architecture to add a API-visible hook to every\nswap that signals completion.  In practice the best we can do is add a\ndelay.  But note the optimization: almost always, the scheduler IPI\ncatches the running thread and kills it from interrupt context\n(i.e. on a different stack).  When that happens, we know that the\ninterrupted thread will never be resumed (because it\u0027s dead) and can\nelide the delay.  We only pay the cost when we actually detect a race.\n\nSigned-off-by: Andy Ross \u003candrew.j.ross@intel.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d02f8620bb3a5427e6b72e6a81adc893bb29061e",
      "old_mode": 33188,
      "old_path": "include/kernel_structs.h",
      "new_id": "6a4cf8a1d7fd4b402840941ae6b3440a9cb93db1",
      "new_mode": 33188,
      "new_path": "include/kernel_structs.h"
    },
    {
      "type": "modify",
      "old_id": "053683b76f57b8be0c92b52a1d73f65201f44955",
      "old_mode": 33188,
      "old_path": "kernel/sched.c",
      "new_id": "d1b923b7848147e07535bd4b95d81923ea05420a",
      "new_mode": 33188,
      "new_path": "kernel/sched.c"
    }
  ]
}
