)]}'
{
  "commit": "b9f8fcd55bbdb037e5332dbdb7b494f0b70861ac",
  "tree": "71b2f8a175269e03e39a5976dc9d24f82b52ec91",
  "parents": [
    "1a551ae715825bb2a2107a2dd68de024a1fa4e32"
  ],
  "author": {
    "name": "David Miller",
    "email": "davem@davemloft.net",
    "time": "Sun Dec 13 18:25:02 2009 -0800"
  },
  "committer": {
    "name": "Ingo Molnar",
    "email": "mingo@elte.hu",
    "time": "Tue Dec 15 09:04:36 2009 +0100"
  },
  "message": "sched: Fix cpu_clock() in NMIs, on !CONFIG_HAVE_UNSTABLE_SCHED_CLOCK\n\nRelax stable-sched-clock architectures to not save/disable/restore\nhardirqs in cpu_clock().\n\nThe background is that I was trying to resolve a sparc64 perf\nissue when I discovered this problem.\n\nOn sparc64 I implement pseudo NMIs by simply running the kernel\nat IRQ level 14 when local_irq_disable() is called, this allows\nperformance counter events to still come in at IRQ level 15.\n\nThis doesn\u0027t work if any code in an NMI handler does\nlocal_irq_save() or local_irq_disable() since the \"disable\" will\nkick us back to cpu IRQ level 14 thus letting NMIs back in and\nwe recurse.\n\nThe only path which that does that in the perf event IRQ\nhandling path is the code supporting frequency based events.  It\nuses cpu_clock().\n\ncpu_clock() simply invokes sched_clock() with IRQs disabled.\n\nAnd that\u0027s a fundamental bug all on it\u0027s own, particularly for\nthe HAVE_UNSTABLE_SCHED_CLOCK case.  NMIs can thus get into the\nsched_clock() code interrupting the local IRQ disable code\nsections of it.\n\nFurthermore, for the not-HAVE_UNSTABLE_SCHED_CLOCK case, the IRQ\ndisabling done by cpu_clock() is just pure overhead and\ncompletely unnecessary.\n\nSo the core problem is that sched_clock() is not NMI safe, but\nwe are invoking it from NMI contexts in the perf events code\n(via cpu_clock()).\n\nA less important issue is the overhead of IRQ disabling when it\nisn\u0027t necessary in cpu_clock().\n\nCONFIG_HAVE_UNSTABLE_SCHED_CLOCK architectures are not\naffected by this patch.\n\nSigned-off-by: David S. Miller \u003cdavem@davemloft.net\u003e\nAcked-by: Peter Zijlstra \u003ca.p.zijlstra@chello.nl\u003e\nCc: Mike Galbraith \u003cefault@gmx.de\u003e\nLKML-Reference: \u003c20091213.182502.215092085.davem@davemloft.net\u003e\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "479ce5682d7c41c858557086de9113b0d71fa00c",
      "old_mode": 33188,
      "old_path": "kernel/sched_clock.c",
      "new_id": "5b496132c28a1baca2a6353c6a6b0216a0f02508",
      "new_mode": 33188,
      "new_path": "kernel/sched_clock.c"
    }
  ]
}
