Skip to contentSkip to conversation

2.6.25-rc1-sha1: WARNING: at lib/kref.c:43 kref_get+0x20/0x30()

DISCUSSION Alexey Dobriyan 3 participants 6 messages Feb 15, 2008 – Feb 19, 2008

lore
Share & tools
lore
#0 lore raw

Booting without SYSFS fills dmesg like this

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x20/0x30()
Modules linked in: loop(+)

Pid: 994, comm: modprobe Tainted: G M 2.6.25-rc1 #6

Call Trace:
 [<ffffffff802317f4>] warn_on_slowpath+0x64/0x90
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff8028f55e>] __slab_alloc+0xbe/0x550
 [<ffffffff8031aa28>] kvasprintf+0x58/0x90
 [<ffffffff8031874c>] vsnprintf+0x33c/0x6e0
 [<ffffffff8031aa41>] kvasprintf+0x71/0x90
 [<ffffffff8022c597>] hrtick_set+0x77/0x140
 [<ffffffff80314860>] kref_get+0x20/0x30
 [<ffffffff80313932>] kobject_get+0x12/0x20
 [<ffffffff803139f9>] kobject_add_internal+0x49/0xf0
 [<ffffffff80313bb3>] kobject_add_varg+0x73/0x80
 [<ffffffff80313fa4>] kobject_add+0x54/0x80
 [<ffffffff8028ec53>] check_object+0x103/0x230
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff80313744>] kobject_create+0x14/0x40
 [<ffffffff8028fbd3>] kmem_cache_alloc+0xd3/0xe0
 [<ffffffff803136b4>] kobject_init+0x34/0xb0
 [<ffffffff8031375b>] kobject_create+0x2b/0x40
 [<ffffffff8031400c>] kobject_create_and_add+0x3c/0x80
 [<ffffffff8025e137>] load_module+0x1847/0x1970
 [<ffffffff80288800>] alloc_pages_current+0x0/0x90
 [<ffffffff8025e2c2>] sys_init_module+0x62/0x1a0
#1 lore raw
Quoted 1 line · On Fri, 15 Feb 2008 14:08:53 +0300 Alexey Dobriyan <[email protected]> wrote:

Booting without SYSFS fills dmesg like this

Does the system normally boot without sysfs? Surprised.

Quoted 20 lines
------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x20/0x30()
Modules linked in: loop(+)

Pid: 994, comm: modprobe Tainted: G M 2.6.25-rc1 #6

Call Trace:
 [<ffffffff802317f4>] warn_on_slowpath+0x64/0x90
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff8028f55e>] __slab_alloc+0xbe/0x550
 [<ffffffff8031aa28>] kvasprintf+0x58/0x90
 [<ffffffff8031874c>] vsnprintf+0x33c/0x6e0
 [<ffffffff8031aa41>] kvasprintf+0x71/0x90
 [<ffffffff8022c597>] hrtick_set+0x77/0x140
 [<ffffffff80314860>] kref_get+0x20/0x30
 [<ffffffff80313932>] kobject_get+0x12/0x20
 [<ffffffff803139f9>] kobject_add_internal+0x49/0xf0
 [<ffffffff80313bb3>] kobject_add_varg+0x73/0x80
 [<ffffffff80313fa4>] kobject_add+0x54/0x80
 [<ffffffff8028ec53>] check_object+0x103/0x230
 [<ffffffff8028db08>] init_object+0x88/0xa0
Quoted 9 lines
 [<ffffffff80313744>] kobject_create+0x14/0x40
 [<ffffffff8028fbd3>] kmem_cache_alloc+0xd3/0xe0
 [<ffffffff803136b4>] kobject_init+0x34/0xb0
 [<ffffffff8031375b>] kobject_create+0x2b/0x40
 [<ffffffff8031400c>] kobject_create_and_add+0x3c/0x80
 [<ffffffff8025e137>] load_module+0x1847/0x1970
 [<ffffffff80288800>] alloc_pages_current+0x0/0x90
 [<ffffffff8025e2c2>] sys_init_module+0x62/0x1a0

Is this a regression?

#2 lore raw
Quoted 37 lines · Andrew Morton
Quoted 1 line · On Fri, 15 Feb 2008 14:08:53 +0300 Alexey Dobriyan <[email protected]> wrote:

Booting without SYSFS fills dmesg like this

Does the system normally boot without sysfs? Surprised.

Quoted 20 lines
------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x20/0x30()
Modules linked in: loop(+)

Pid: 994, comm: modprobe Tainted: G M 2.6.25-rc1 #6

Call Trace:
 [<ffffffff802317f4>] warn_on_slowpath+0x64/0x90
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff8028f55e>] __slab_alloc+0xbe/0x550
 [<ffffffff8031aa28>] kvasprintf+0x58/0x90
 [<ffffffff8031874c>] vsnprintf+0x33c/0x6e0
 [<ffffffff8031aa41>] kvasprintf+0x71/0x90
 [<ffffffff8022c597>] hrtick_set+0x77/0x140
 [<ffffffff80314860>] kref_get+0x20/0x30
 [<ffffffff80313932>] kobject_get+0x12/0x20
 [<ffffffff803139f9>] kobject_add_internal+0x49/0xf0
 [<ffffffff80313bb3>] kobject_add_varg+0x73/0x80
 [<ffffffff80313fa4>] kobject_add+0x54/0x80
 [<ffffffff8028ec53>] check_object+0x103/0x230
 [<ffffffff8028db08>] init_object+0x88/0xa0
Quoted 9 lines
 [<ffffffff80313744>] kobject_create+0x14/0x40
 [<ffffffff8028fbd3>] kmem_cache_alloc+0xd3/0xe0
 [<ffffffff803136b4>] kobject_init+0x34/0xb0
 [<ffffffff8031375b>] kobject_create+0x2b/0x40
 [<ffffffff8031400c>] kobject_create_and_add+0x3c/0x80
 [<ffffffff8025e137>] load_module+0x1847/0x1970
 [<ffffffff80288800>] alloc_pages_current+0x0/0x90
 [<ffffffff8025e2c2>] sys_init_module+0x62/0x1a0
Quoted 1 line

Is this a regression?

Alexey,
do you always see these messages with every modprobe of a module?

Can you enable CONFIG_DEBUG_KOBJECT=y? It might give a hint where we miss to initialization of a kobject when sysfs is not compiled in.

Thanks,
Kay

#3 lore raw
Quoted 38 lines · Kay Sievers
Quoted 37 lines · Andrew Morton
Quoted 1 line · On Fri, 15 Feb 2008 14:08:53 +0300 Alexey Dobriyan <[email protected]> wrote:

Booting without SYSFS fills dmesg like this

Does the system normally boot without sysfs? Surprised.

Quoted 29 lines
------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x20/0x30()
Modules linked in: loop(+)

Pid: 994, comm: modprobe Tainted: G M 2.6.25-rc1 #6

Call Trace:
 [<ffffffff802317f4>] warn_on_slowpath+0x64/0x90
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff8028f55e>] __slab_alloc+0xbe/0x550
 [<ffffffff8031aa28>] kvasprintf+0x58/0x90
 [<ffffffff8031874c>] vsnprintf+0x33c/0x6e0
 [<ffffffff8031aa41>] kvasprintf+0x71/0x90
 [<ffffffff8022c597>] hrtick_set+0x77/0x140
 [<ffffffff80314860>] kref_get+0x20/0x30
 [<ffffffff80313932>] kobject_get+0x12/0x20
 [<ffffffff803139f9>] kobject_add_internal+0x49/0xf0
 [<ffffffff80313bb3>] kobject_add_varg+0x73/0x80
 [<ffffffff80313fa4>] kobject_add+0x54/0x80
 [<ffffffff8028ec53>] check_object+0x103/0x230
 [<ffffffff8028db08>] init_object+0x88/0xa0
 [<ffffffff80313744>] kobject_create+0x14/0x40
 [<ffffffff8028fbd3>] kmem_cache_alloc+0xd3/0xe0
 [<ffffffff803136b4>] kobject_init+0x34/0xb0
 [<ffffffff8031375b>] kobject_create+0x2b/0x40
 [<ffffffff8031400c>] kobject_create_and_add+0x3c/0x80
 [<ffffffff8025e137>] load_module+0x1847/0x1970
 [<ffffffff80288800>] alloc_pages_current+0x0/0x90
 [<ffffffff8025e2c2>] sys_init_module+0x62/0x1a0
Quoted 4 lines
Quoted 1 line

Is this a regression?

Alexey,
do you always see these messages with every modprobe of a module?

Yep.

Quoted 2 lines

Can you enable CONFIG_DEBUG_KOBJECT=y? It might give a hint where we miss to initialization of a kobject when sysfs is not compiled in.

It looks like this:

kobject: 'button' (ffff81017f307248): kobject_uevent_env
kobject: 'button' (ffff81017f307248): fill_kobj_path: path = '/bus/acpi/drivers/button'

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: battery(+) button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1642, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff803249a0>] ? acpi_bus_register_driver+0x0/0x40
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80

---[ end trace 033c2b23880cf02a ]---

kobject: 'notes' (ffff81017ec370a8): kobject_add_internal: parent: '<NULL>', set: '<NULL>'
kobject: 'battery' (ffff81017f382db0): kobject_add_internal: parent: 'drivers', set: 'drivers'
kobject: 'battery' (ffff81017f382db0): kobject_uevent_env
kobject: 'battery' (ffff81017f382db0): fill_kobj_path: path = '/bus/acpi/drivers/battery'

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: bay(+) battery button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1650, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff80353510>] ? device_remove_file+0x0/0x10
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80

---[ end trace 033c2b23880cf02a ]---
kobject: 'notes' (ffff81017ec371f8): kobject_add_internal: parent: '<NULL>', set: '<NULL>'
kobject: '<NULL>' (ffffffff88031350): kobject_cleanup
------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: fan(+) battery button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1659, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff803249a0>] ? acpi_bus_register_driver+0x0/0x40
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80

---[ end trace 033c2b23880cf02a ]---

kobject: 'notes' (ffff81017ec372a0): kobject_add_internal: parent: '<NULL>', set: '<NULL>'
kobject: 'fan' (ffff81017f307db0): kobject_add_internal: parent: 'drivers', set: 'drivers'
kobject: 'fan' (ffff81017f307db0): kobject_uevent_env
kobject: 'fan' (ffff81017f307db0): fill_kobj_path: path = '/bus/acpi/drivers/fan'

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: container(+) fan battery button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1667, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff803249a0>] ? acpi_bus_register_driver+0x0/0x40
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80

---[ end trace 033c2b23880cf02a ]---

kobject: 'notes' (ffff81017ec37498): kobject_add_internal: parent: '<NULL>', set: '<NULL>'
kobject: 'container' (ffff81017f307000): kobject_add_internal: parent: 'drivers', set: 'drivers'
kobject: 'container' (ffff81017f307000): kobject_uevent_env
kobject: 'container' (ffff81017f307000): fill_kobj_path: path = '/bus/acpi/drivers/container'

#4 lore raw
Quoted 42 lines · Alexey Dobriyan
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Andrew Morton
Quoted 1 line · On Fri, 15 Feb 2008 14:08:53 +0300 Alexey Dobriyan <[email protected]> wrote:

Booting without SYSFS fills dmesg like this

Can you enable CONFIG_DEBUG_KOBJECT=y? It might give a hint where we miss to initialization of a kobject when sysfs is not compiled in.

It looks like this:

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: battery(+) button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1642, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff803249a0>] ? acpi_bus_register_driver+0x0/0x40
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80

---[ end trace 033c2b23880cf02a ]---
Quoted 1 line

kobject: 'notes' (ffff81017ec370a8): kobject_add_internal: parent: '<NULL>', set: '<NULL>'

Ok, seems the "notes" directory should not be created if SYSFS is not configured. The "notes" kobject tries to reference the module kobject as a parent, which isn't initialized in that case.

Does that fix it?

Thanks,
Kay

From: Kay Sievers <[email protected]>
Subject: modules: do not try to add sysfs attributes if !CONFIG_SYSFS

---
 module.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/module.c +3 -5
index 92595ba..2dd60c8 100644
@@ -987,6 +987,7 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
 	return ret;
 }
 
+#ifdef CONFIG_SYSFS
 
 /*
  * /sys/module/foo/sections stuff
@@ -1169,7 +1170,7 @@ static void remove_notes_attrs(struct module *mod)
 		free_notes_attrs(mod->notes_attrs, mod->notes_attrs->notes);
 }
 
-#else
+#else /* CONFIG_KALLSYMS */
 
 static inline void add_sect_attrs(struct module *mod, unsigned int nsect,
 		char *sectstrings, Elf_Shdr *sechdrs)
@@ -1190,7 +1191,6 @@ static inline void remove_notes_attrs(struct module *mod)
 }
 #endif /* CONFIG_KALLSYMS */
 
-#ifdef CONFIG_SYSFS
 int module_add_modinfo_attrs(struct module *mod)
 {
 	struct module_attribute *attr;
@@ -1231,9 +1231,7 @@ void module_remove_modinfo_attrs(struct module *mod)
 	}
 	kfree(mod->modinfo_attrs);
 }
-#endif
 
-#ifdef CONFIG_SYSFS
 int mod_sysfs_init(struct module *mod)
 {
 	int err;
@@ -1299,7 +1297,7 @@ out_unreg:
 	kobject_put(&mod->mkobj.kobj);
 	return err;
 }
-#endif
+#endif /* CONFIG_SYSFS */
 
 static void mod_kobject_remove(struct module *mod)
 {
#5 lore raw
Quoted 42 lines · Kay Sievers
Quoted 41 lines · Alexey Dobriyan
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Andrew Morton
Quoted 1 line · On Fri, 15 Feb 2008 14:08:53 +0300 Alexey Dobriyan <[email protected]> wrote:

Booting without SYSFS fills dmesg like this

Can you enable CONFIG_DEBUG_KOBJECT=y? It might give a hint where we miss to initialization of a kobject when sysfs is not compiled in.

It looks like this:

------------[ cut here ]------------
WARNING: at lib/kref.c:43 kref_get+0x2d/0x30()
Modules linked in: battery(+) button dock thermal processor sbs ac sbshc af_packet loop

Pid: 1642, comm: modprobe Not tainted 2.6.25-rc2 #2

Call Trace:
 [<ffffffff8022a8cf>] warn_on_slowpath+0x5f/0x80
 [<ffffffff8024cb06>] ? mark_held_locks+0x56/0xa0
 [<ffffffff80282c00>] ? __slab_alloc+0xc0/0x4b0
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f7f87>] ? kvasprintf+0x57/0x90
 [<ffffffff802f5c18>] ? vsnprintf+0x328/0x6e0
 [<ffffffff802f7fa0>] ? kvasprintf+0x70/0x90
 [<ffffffff802f1ced>] kref_get+0x2d/0x30
 [<ffffffff802f0c4a>] kobject_get+0x1a/0x30
 [<ffffffff802f0d39>] kobject_add_internal+0x59/0x160
 [<ffffffff802f0f6e>] kobject_add_varg+0x6e/0x80
 [<ffffffff802f1399>] kobject_add+0x69/0x90
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff802f1c4e>] ? kref_init+0xe/0x10
 [<ffffffff802f0927>] ? kobject_init+0x37/0xa0
 [<ffffffff802f09c3>] ? kobject_create+0x33/0x40
 [<ffffffff802f13fe>] kobject_create_and_add+0x3e/0x80
 [<ffffffff80255adf>] sys_init_module+0x19df/0x1b30
 [<ffffffff8024d928>] ? __lock_acquire+0x748/0x10b0
 [<ffffffff803249a0>] ? acpi_bus_register_driver+0x0/0x40
 [<ffffffff8024cc9f>] ? trace_hardirqs_on+0xbf/0x150
 [<ffffffff80406122>] ? trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b57b>] system_call_after_swapgs+0x7b/0x80
Quoted 8 lines
Quoted 2 lines
---[ end trace 033c2b23880cf02a ]---

kobject: 'notes' (ffff81017ec370a8): kobject_add_internal: parent: '<NULL>', set: '<NULL>'

Ok, seems the "notes" directory should not be created if SYSFS is not configured. The "notes" kobject tries to reference the module kobject as a parent, which isn't initialized in that case.

Does that fix it?

Idea was good and below is patch which compiles and works. BTW, all noises about improper ifdefs or more core than necessary should be ignored for now -- sysfs stuff really wants to be separated into module-sysfs.c

kernel/module.c +1 -1
@@ -992,7 +992,7 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
  * /sys/module/foo/sections stuff
  * J. Corbet <[email protected]>
  */
-#ifdef CONFIG_KALLSYMS
+#if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS)
 static ssize_t module_sect_show(struct module_attribute *mattr,
 				struct module *mod, char *buf)
 {