Stephen Boyd fcc16882ac lib: atomic64: Initialize locks statically to fix early users
The atomic64 library uses a handful of static spin locks to implement
atomic 64-bit operations on architectures without support for atomic
64-bit instructions.

Unfortunately, the spinlocks are initialized in a pure initcall and that
is too late for the vfs namespace code which wants to use atomic64
operations before the initcall is run.

This became a problem as of commit 8823c079ba71: "vfs: Add setns support
for the mount namespace".

This leads to BUG messages such as:

  BUG: spinlock bad magic on CPU#0, swapper/0/0
   lock: atomic64_lock+0x240/0x400, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
    do_raw_spin_lock+0x158/0x198
    _raw_spin_lock_irqsave+0x4c/0x58
    atomic64_add_return+0x30/0x5c
    alloc_mnt_ns.clone.14+0x44/0xac
    create_mnt_ns+0xc/0x54
    mnt_init+0x120/0x1d4
    vfs_caches_init+0xe0/0x10c
    start_kernel+0x29c/0x300

coming out early on during boot when spinlock debugging is enabled.

Fix this by initializing the spinlocks statically at compile time.

Reported-and-tested-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-20 13:50:16 -08:00
..
2011-09-21 13:39:59 -07:00
2011-03-11 14:25:50 +00:00
2008-06-06 11:29:10 -07:00
2011-10-29 21:20:22 +02:00
2007-07-17 10:23:04 -07:00
2007-05-10 18:24:13 +02:00
2011-03-31 11:26:23 -03:00
2012-09-30 18:02:20 -07:00
2012-10-06 03:04:57 +09:00
2012-10-06 03:04:56 +09:00
2012-10-09 16:22:40 +09:00
2012-05-07 16:51:19 -07:00
2012-12-17 17:15:22 -08:00
2012-03-28 15:58:21 -07:00
2012-07-30 17:25:16 -07:00
2012-01-31 23:19:47 +02:00
2011-12-08 19:52:43 -05:00