)]}'
{
  "commit": "e81ce1f7ecdaed2844c75313b09af791d44e6373",
  "tree": "49e70223f9ca808c6c7fed5cf7ce00125ccca84a",
  "parents": [
    "6bb74df481223731af6c7e0ff3adb31f6442cfcd"
  ],
  "author": {
    "name": "Heiko Carstens",
    "email": "heiko.carstens@de.ibm.com",
    "time": "Mon Mar 05 00:30:51 2007 -0800"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@woody.linux-foundation.org",
    "time": "Mon Mar 05 07:57:53 2007 -0800"
  },
  "message": "[PATCH] timer/hrtimer: take per cpu locks in sane order\n\nDoing something like this on a two cpu system\n\n  # echo 0 \u003e /sys/devices/system/cpu/cpu0/online\n  # echo 1 \u003e /sys/devices/system/cpu/cpu0/online\n  # echo 0 \u003e /sys/devices/system/cpu/cpu1/online\n\nwill give me this:\n\n  \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n  [ INFO: possible circular locking dependency detected ]\n  2.6.21-rc2-g562aa1d4-dirty #7\n  -------------------------------------------------------\n  bash/1282 is trying to acquire lock:\n   (\u0026cpu_base-\u003elock_key){.+..}, at: [\u003c000000000005f17e\u003e] hrtimer_cpu_notify+0xc6/0x240\n\n  but task is already holding lock:\n   (\u0026cpu_base-\u003elock_key#2){.+..}, at: [\u003c000000000005f174\u003e] hrtimer_cpu_notify+0xbc/0x240\n\n  which lock already depends on the new lock.\n\nThis happens because we have the following code in kernel/hrtimer.c:\n\n  migrate_hrtimers(int cpu)\n  [...]\n  old_base \u003d \u0026per_cpu(hrtimer_bases, cpu);\n  new_base \u003d \u0026get_cpu_var(hrtimer_bases);\n  [...]\n  spin_lock(\u0026new_base-\u003elock);\n  spin_lock(\u0026old_base-\u003elock);\n\nWhich means the spinlocks are taken in an order which depends on which cpu\ngets shut down from which other cpu. Therefore lockdep complains that there\nmight be an ABBA deadlock. Since migrate_hrtimers() gets only called on\ncpu hotplug it\u0027s safe to assume that it isn\u0027t executed concurrently on a\n\nThe same problem exists in kernel/timer.c: migrate_timers().\n\nAs pointed out by Christian Borntraeger one possible solution to avoid\nthe locking order complaints would be to make sure that the locks are\nalways taken in the same order. E.g. by taking the lock of the cpu with\nthe lower number first.\n\nTo achieve this we introduce two new spinlock functions double_spin_lock\nand double_spin_unlock which lock or unlock two locks in a given order.\n\nCc: Ingo Molnar \u003cmingo@elte.hu\u003e\nCc: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nCc: Roman Zippel \u003czippel@linux-m68k.org\u003e\nCc: John Stultz \u003cjohnstul@us.ibm.com\u003e\nCc: Christian Borntraeger \u003ccborntra@de.ibm.com\u003e\nCc: Martin Schwidefsky \u003cschwidefsky@de.ibm.com\u003e\nSigned-off-by: Heiko Carstens \u003cheiko.carstens@de.ibm.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "61fef376ed2e6161299719f8b3a7cfaf4f246b33",
      "old_mode": 33188,
      "old_path": "include/linux/spinlock.h",
      "new_id": "a946176db638c7198705a20a7d2fd715279dfc2d",
      "new_mode": 33188,
      "new_path": "include/linux/spinlock.h"
    },
    {
      "type": "modify",
      "old_id": "476cb0c0b4a432bce65c1f113011aa60cd3060b0",
      "old_mode": 33188,
      "old_path": "kernel/hrtimer.c",
      "new_id": "de93a8176ca61209c342ff68eb14174230f74e0b",
      "new_mode": 33188,
      "new_path": "kernel/hrtimer.c"
    },
    {
      "type": "modify",
      "old_id": "6663a87f7304742b7f8cef44a39f2ea0873c511b",
      "old_mode": 33188,
      "old_path": "kernel/timer.c",
      "new_id": "8ad384253ef2692e58060c7087ed58cf4161ce93",
      "new_mode": 33188,
      "new_path": "kernel/timer.c"
    }
  ]
}
