)]}'
{
  "commit": "220b140b52ab6cc133f674a7ffec8fa792054f25",
  "tree": "df8d370f604f84145b1ba5d056d4622b6c85b488",
  "parents": [
    "97d5a22005f38057b4bc0d95f81cd26510268794"
  ],
  "author": {
    "name": "Paul Mackerras",
    "email": "paulus@samba.org",
    "time": "Wed Mar 10 20:45:52 2010 +1100"
  },
  "committer": {
    "name": "Ingo Molnar",
    "email": "mingo@elte.hu",
    "time": "Thu Mar 11 12:43:51 2010 +0100"
  },
  "message": "perf_event: Fix oops triggered by cpu offline/online\n\nAnton Blanchard found that he could reliably make the kernel hit a\nBUG_ON in the slab allocator by taking a cpu offline and then online\nwhile a system-wide perf record session was running.\n\nThe reason is that when the cpu comes up, we completely reinitialize\nthe ctx field of the struct perf_cpu_context for the cpu.  If there is\na system-wide perf record session running, then there will be a struct\nperf_event that has a reference to the context, so its refcount will\nbe 2.  (The perf_event has been removed from the context\u0027s group_entry\nand event_entry lists by perf_event_exit_cpu(), but that doesn\u0027t\nremove the perf_event\u0027s reference to the context and doesn\u0027t decrement\nthe context\u0027s refcount.)\n\nWhen the cpu comes up, perf_event_init_cpu() gets called, and it calls\n__perf_event_init_context() on the cpu\u0027s context.  That resets the\nrefcount to 1.  Then when the perf record session finishes and the\nperf_event is closed, the refcount gets decremented to 0 and the\ncontext gets kfreed after an RCU grace period.  Since the context\nwasn\u0027t kmalloced -- it\u0027s part of a per-cpu variable -- bad things\nhappen.\n\nIn fact we don\u0027t need to completely reinitialize the context when the\ncpu comes up.  It\u0027s sufficient to initialize the context once at boot,\nbut we need to do it for all possible cpus.\n\nThis moves the context initialization to happen at boot time.  With\nthis, we don\u0027t trash the refcount and the context never gets kfreed,\nand we don\u0027t hit the BUG_ON.\n\nReported-by: Anton Blanchard \u003canton@samba.org\u003e\nSigned-off-by: Paul Mackerras \u003cpaulus@samba.org\u003e\nTested-by: Anton Blanchard \u003canton@samba.org\u003e\nAcked-by: Peter Zijlstra \u003ca.p.zijlstra@chello.nl\u003e\nCc: \u003cstable@kernel.org\u003e\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c502b18594cc5084e494fbfc8b20d85c14bd59a3",
      "old_mode": 33188,
      "old_path": "kernel/perf_event.c",
      "new_id": "fb3031cf9f173f18e081277453ee05f87ad70fc5",
      "new_mode": 33188,
      "new_path": "kernel/perf_event.c"
    }
  ]
}
