Subject: Re: linux-next: Tree for July 18: warning at kernel/lockdep.c:2068 trace_hardirqs_on_caller

From: Pekka Enberg <penberg-bbCR+/[email-masked]>
Date: Sat, 19 Jul 2008 15:56:29 +0300

On Sat, 2008-07-19 at 11:55 +0200, Vegard Nossum wrote:
> On Sat, Jul 19, 2008 at 9:28 AM, Mariusz Kozlowski
> <[email-masked]> wrote:
> > Hello,
> >
> >        I get this on my x86_32 laptop.
> >
> > ------------[ cut here ]------------
> > WARNING: at /home/mako/linux/lkt/sources/linux-next/kernel/lockdep.c:2068 trace_hardirqs_on_caller+0xdc/0x128()
> > Modules linked in:
> > Pid: 0, comm: swapper Not tainted 2.6.26-next-20080718 #1
> >  [<c011d5ca>] warn_on_slowpath+0x4e/0x68
> >  [<c0132600>] ? init_srcu_struct+0x17/0x3b
> >  [<c011de86>] ? release_console_sem+0x1c2/0x1e8
> >  [<c0139818>] ? trace_hardirqs_off+0xb/0xd
> >  [<c02b95cb>] ? _spin_unlock_irqrestore+0x39/0x60
> >  [<c011de9a>] ? release_console_sem+0x1d6/0x1e8
> >  [<c01326be>] ? up+0x23/0x30
> >  [<c011de86>] ? release_console_sem+0x1c2/0x1e8
> >  [<c01326be>] ? up+0x23/0x30
> >  [<c011de86>] ? release_console_sem+0x1c2/0x1e8
> >  [<c013b83b>] ? __lock_acquire+0x365/0x1151
> >  [<c013b048>] trace_hardirqs_on_caller+0xdc/0x128
> >  [<c013b09f>] trace_hardirqs_on+0xb/0xd
> >  [<c016a40b>] __slab_alloc+0x329/0x61e
> >  [<c011665f>] ? kmemcheck_memset+0x24/0xe5
> >  [<c016a7a0>] kmem_cache_alloc+0xa0/0xb6
> >  [<c01dedb4>] ? kobject_init+0x3b/0xdd
> >  [<c01dedb4>] ? kobject_init+0x3b/0xdd
> >  [<c01dedb4>] kobject_init+0x3b/0xdd
> >  [<c025997f>] firmware_map_add_entry+0x2a/0x4b
> >  [<c03b8e0c>] firmware_map_add_early+0x32/0x56
> >  [<c03a3faf>] e820_reserve_resources+0x10a/0x14e
> >  [<c03a1965>] setup_arch+0x375/0x540
> >  [<c0136e81>] ? clockevents_register_notifier+0x28/0x2d
> >  [<c011e477>] ? printk+0x1b/0x1d
> >  [<c03a09df>] start_kernel+0x67/0x278
> >  [<c03a0304>] i386_start_kernel+0x64/0x70
> >  =======================
> > ---[ end trace 4eaa2a86a8e2da22 ]---
> >
> 
> What I don't get here is how SLUB can be used this early in the boot
> process. Notice that this is still miles away from the
> 
>     SLUB: Genslabs=12, HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> 
> line, which comes much later. And that kobject_init() _is_ calling
> kzalloc() via verify_dynamic_kobject_allocation(). Isn't this an
> error?
> 
> (Unfortunately, my "git log" doesn't turn up any recent changes for
> any of the affected code paths here.)

Indeed, looks like a bug in kobject_init(). You need to wait for
kmem_cache_init() to be run before using kzalloc().

		Pekka