2008-02-18 20:52:42

by Guennadi Liakhovetski

[permalink] [raw]
Subject: [PCI] duplicate sysfs symbols getting registered in current git

Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
getting the following warnings (with a bit of context):

* Found PM-Timer Bug on the chipset. Due to workarounds for a bug,
* this clock source is slow. Consider trying other clock sources
pci 0000:00:14.3: quirk: region f800-f83f claimed by PIIX4 ACPI
pci 0000:00:14.3: quirk: region fc00-fc0f claimed by PIIX4 SMB
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI init
ACPI: bus type pnp registered
pnp: IRQ 5 override to level, low
PCI: setting IRQ 5 as level-triggered
pnp: IRQ 4 override to level, low
PCI: setting IRQ 4 as level-triggered
pnp: PnP ACPI: found 14 devices
ACPI: ACPI bus type pnp unregistered
PnPBIOS: Disabled by ACPI PNP
SCSI subsystem initialized
PCI: Probing PCI hardware
kobject (c7c35b00): tried to init an initialized object, something is seriously wrong.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2 #6
[<c01edef9>] kobject_init+0x89/0x90
[<c025115e>] device_initialize+0x1e/0x90
[<c0251a0b>] device_register+0xb/0x20
[<c01f7c18>] pci_bus_add_devices+0x98/0x140
[<c030c377>] ? pcibios_scan_root+0x27/0xa0
[<c03f6b40>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c01041aa>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0104eaf>] kernel_thread_helper+0x7/0x18
=======================
sysfs: duplicate filename '0000:01' can not be created
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one+0x80/0xa0()
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.25-rc2 #6
[<c0123584>] warn_on_slowpath+0x54/0x70
[<c0123c4c>] ? __call_console_drivers+0x5c/0x70
[<c0314cf1>] ? _spin_unlock_irqrestore+0x11/0x30
[<c0123f09>] ? release_console_sem+0x1d9/0x1f0
[<c012438d>] ? vprintk+0x2ad/0x3b0
[<c01ed5b9>] ? ida_get_new_above+0x89/0x180
[<c01ae230>] ? sysfs_ilookup_test+0x0/0x20
[<c0314c4f>] ? _spin_unlock+0xf/0x30
[<c01845ca>] ? ifind+0x8a/0x90
[<c01244ab>] ? printk+0x1b/0x20
[<c01ae5c0>] sysfs_add_one+0x80/0xa0
[<c01aeaf9>] create_dir+0x49/0x90
[<c01aeb6b>] sysfs_create_dir+0x2b/0x50
[<c01ee1ee>] kobject_add_internal+0xae/0x190
[<c01ee34d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ee34d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ee3af>] kobject_add_varg+0x4f/0x60
[<c01ee69f>] kobject_add+0x2f/0x60
[<c01ee0b2>] ? kobject_get+0x12/0x20
[<c0251587>] device_add+0xd7/0x550
[<c01eeded>] ? kref_init+0xd/0x10
[<c01ede9b>] ? kobject_init+0x2b/0x90
[<c0251a12>] device_register+0x12/0x20
[<c01f7c18>] pci_bus_add_devices+0x98/0x140
[<c030c377>] ? pcibios_scan_root+0x27/0xa0
[<c03f6b40>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c01041aa>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0104eaf>] kernel_thread_helper+0x7/0x18
=======================
---[ end trace ca143223eefdc828 ]---
kobject_add_internal failed for 0000:01 with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2 #6
[<c01ee279>] kobject_add_internal+0x139/0x190
[<c01ee34d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ee3af>] kobject_add_varg+0x4f/0x60
[<c01ee69f>] kobject_add+0x2f/0x60
[<c01ee0b2>] ? kobject_get+0x12/0x20
[<c0251587>] device_add+0xd7/0x550
[<c01eeded>] ? kref_init+0xd/0x10
[<c01ede9b>] ? kobject_init+0x2b/0x90
[<c0251a12>] device_register+0x12/0x20
[<c01f7c18>] pci_bus_add_devices+0x98/0x140
[<c030c377>] ? pcibios_scan_root+0x27/0xa0
[<c03f6b40>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c01041aa>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0104eaf>] kernel_thread_helper+0x7/0x18
=======================
pci 0000:00:01.0: Error registering pci_bus device bridge symlink, continuing...
PCI: Using IRQ router PIIX/ICH [8086/7110] at 0000:00:14.0
PCI->APIC IRQ transform: 0000:00:0b.0[A] -> IRQ 21
PCI->APIC IRQ transform: 0000:00:0c.0[A] -> IRQ 20
PCI->APIC IRQ transform: 0000:00:0d.0[B] -> IRQ 18
PCI->APIC IRQ transform: 0000:00:0d.1[C] -> IRQ 19
PCI->APIC IRQ transform: 0000:00:0d.2[D] -> IRQ 16
PCI->APIC IRQ transform: 0000:00:0d.3[A] -> IRQ 17
PCI->APIC IRQ transform: 0000:00:0e.0[A] -> IRQ 19
PCI->APIC IRQ transform: 0000:00:0f.0[A] -> IRQ 18
PCI->APIC IRQ transform: 0000:00:0f.1[A] -> IRQ 18
PCI->APIC IRQ transform: 0000:00:10.0[A] -> IRQ 16
PCI: using PPB 0000:00:01.0[A] to get irq 22
PCI->APIC IRQ transform: 0000:01:00.0[A] -> IRQ 22
ACPI: RTC can wake from S4
Time: tsc clocksource has been installed.
system 00:0b: iomem range 0x0-0x9ffff could not be reserved
system 00:0b: iomem range 0xe0000-0xfffff could not be reserved
system 00:0b: iomem range 0x100000-0xffffff could not be reserved
system 00:0b: iomem range 0xfffc0000-0xffffffff could not be reserved
system 00:0c: ioport range 0x15c-0x15d has been reserved
system 00:0c: ioport range 0x4d0-0x4d1 has been reserved
system 00:0c: ioport range 0x77e-0x77f has been reserved
system 00:0c: ioport range 0xc06-0xc07 has been reserved
system 00:0c: ioport range 0xc50-0xc51 has been reserved
system 00:0c: ioport range 0xc70-0xc77 has been reserved
system 00:0c: ioport range 0xc82-0xc82 has been reserved
system 00:0d: ioport range 0xf800-0xf81f has been reserved
system 00:0d: ioport range 0xf820-0xf83f has been reserved
system 00:0d: ioport range 0xfc00-0xfc0f has been reserved
PCI: Bridge: 0000:00:01.0
IO window: disabled.
MEM window: 0x50000000-0x510fffff
PREFETCH window: disabled.
NET: Registered protocol family 2

lspci:

00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 02)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 02)
00:0b.0 SCSI storage controller: LSI Logic / Symbios Logic 53c875 (rev 04)
00:0c.0 Ethernet controller: Intel Corporation 82557/8/9 [Ethernet Pro 100] (rev 05)
00:0d.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
00:0d.1 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
00:0d.2 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
00:0d.3 USB Controller: ALi Corporation USB 2.0 Controller (rev 01)
00:0e.0 SCSI storage controller: Tekram Technology Co.,Ltd. TRM-S1040 (rev 01)
00:0f.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
00:0f.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
00:10.0 SCSI storage controller: Advanced Micro Devices [AMD] 53c974 [PCscsi] (rev 10)
00:14.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 02)
00:14.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:14.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01)
00:14.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)
01:00.0 VGA compatible controller: Texas Instruments TVP4020 [Permedia 2] (rev 11)

Please say if .config is needed, although, theres nothing extraordinary
there wrt PCI / ACPI. Booting with "acpi=noirq".

Thanks
Guennadi
---
Guennadi Liakhovetski


2008-02-20 06:33:54

by Greg KH

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> getting the following warnings (with a bit of context):

Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
time from this?

thanks,

greg k-h

2008-02-25 12:43:27

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Tue, 19 Feb 2008, Greg KH wrote:

> On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > getting the following warnings (with a bit of context):
>
> Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> time from this?

dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
unpacked, as it would have to be sent to the list, is 408K big. Will see
what Greg says.

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-25 18:15:51

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:

> On Tue, 19 Feb 2008, Greg KH wrote:
>
> > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > getting the following warnings (with a bit of context):
> >
> > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > time from this?
>
> dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> unpacked, as it would have to be sent to the list, is 408K big. Will see
> what Greg says.

Actually, the most annoying problem with post 2.6.24 kernels on this
machine is, that the system doesn't power off or reboot any more. And
seeing other reports, where the reason for not powering down was unfreed
kobjects, maybe this is the problem here too?

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-25 20:25:58

by Greg KH

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, Feb 25, 2008 at 07:15:57PM +0100, Guennadi Liakhovetski wrote:
> On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:
>
> > On Tue, 19 Feb 2008, Greg KH wrote:
> >
> > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > getting the following warnings (with a bit of context):
> > >
> > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > time from this?
> >
> > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > what Greg says.
>
> Actually, the most annoying problem with post 2.6.24 kernels on this
> machine is, that the system doesn't power off or reboot any more. And
> seeing other reports, where the reason for not powering down was unfreed
> kobjects, maybe this is the problem here too?

If you have cpufreq enabled, that should solve this problem after the
2.6.24-rc3 kernel release. Have you tried that version?

thanks,

greg k-h

2008-02-25 20:31:33

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, 25 Feb 2008, Greg KH wrote:

> On Mon, Feb 25, 2008 at 07:15:57PM +0100, Guennadi Liakhovetski wrote:
> > On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:
> >
> > > On Tue, 19 Feb 2008, Greg KH wrote:
> > >
> > > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > > getting the following warnings (with a bit of context):
> > > >
> > > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > > time from this?
> > >
> > > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > > what Greg says.
> >
> > Actually, the most annoying problem with post 2.6.24 kernels on this
> > machine is, that the system doesn't power off or reboot any more. And
> > seeing other reports, where the reason for not powering down was unfreed
> > kobjects, maybe this is the problem here too?
>
> If you have cpufreq enabled, that should solve this problem after the
> 2.6.24-rc3 kernel release. Have you tried that version?

Did you mean 25-rc3? But no, I do not have cpufreq enabled.

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-25 21:14:25

by Greg KH

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, Feb 25, 2008 at 09:31:22PM +0100, Guennadi Liakhovetski wrote:
> On Mon, 25 Feb 2008, Greg KH wrote:
>
> > On Mon, Feb 25, 2008 at 07:15:57PM +0100, Guennadi Liakhovetski wrote:
> > > On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:
> > >
> > > > On Tue, 19 Feb 2008, Greg KH wrote:
> > > >
> > > > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > > > getting the following warnings (with a bit of context):
> > > > >
> > > > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > > > time from this?
> > > >
> > > > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > > > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > > > what Greg says.
> > >
> > > Actually, the most annoying problem with post 2.6.24 kernels on this
> > > machine is, that the system doesn't power off or reboot any more. And
> > > seeing other reports, where the reason for not powering down was unfreed
> > > kobjects, maybe this is the problem here too?
> >
> > If you have cpufreq enabled, that should solve this problem after the
> > 2.6.24-rc3 kernel release. Have you tried that version?
>
> Did you mean 25-rc3?

Sorry, yes :)

> But no, I do not have cpufreq enabled.

Then I suggest filing a new bug report so it doesn't get lost.

thanks,

greg k-h

2008-02-25 22:03:50

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, 25 Feb 2008, Greg KH wrote:

> On Mon, Feb 25, 2008 at 09:31:22PM +0100, Guennadi Liakhovetski wrote:
> > On Mon, 25 Feb 2008, Greg KH wrote:
> >
> > > On Mon, Feb 25, 2008 at 07:15:57PM +0100, Guennadi Liakhovetski wrote:
> > > > On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:
> > > >
> > > > > On Tue, 19 Feb 2008, Greg KH wrote:
> > > > >
> > > > > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > > > > getting the following warnings (with a bit of context):
> > > > > >
> > > > > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > > > > time from this?
> > > > >
> > > > > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > > > > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > > > > what Greg says.
> > > >
> > > > Actually, the most annoying problem with post 2.6.24 kernels on this
> > > > machine is, that the system doesn't power off or reboot any more. And
> > > > seeing other reports, where the reason for not powering down was unfreed
> > > > kobjects, maybe this is the problem here too?

[snip]

> Then I suggest filing a new bug report so it doesn't get lost.

Have you found anything interesting in the kobj debugging output? Do you
think these are two related problems (kobj and failing power-off) or
separate? So should I file two bug-reports or just one? You mean on
bugzilla?

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-25 22:22:19

by Greg KH

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, Feb 25, 2008 at 11:03:38PM +0100, Guennadi Liakhovetski wrote:
> On Mon, 25 Feb 2008, Greg KH wrote:
>
> > On Mon, Feb 25, 2008 at 09:31:22PM +0100, Guennadi Liakhovetski wrote:
> > > On Mon, 25 Feb 2008, Greg KH wrote:
> > >
> > > > On Mon, Feb 25, 2008 at 07:15:57PM +0100, Guennadi Liakhovetski wrote:
> > > > > On Mon, 25 Feb 2008, Guennadi Liakhovetski wrote:
> > > > >
> > > > > > On Tue, 19 Feb 2008, Greg KH wrote:
> > > > > >
> > > > > > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > > > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > > > > > getting the following warnings (with a bit of context):
> > > > > > >
> > > > > > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > > > > > time from this?
> > > > > >
> > > > > > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > > > > > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > > > > > what Greg says.
> > > > >
> > > > > Actually, the most annoying problem with post 2.6.24 kernels on this
> > > > > machine is, that the system doesn't power off or reboot any more. And
> > > > > seeing other reports, where the reason for not powering down was unfreed
> > > > > kobjects, maybe this is the problem here too?
>
> [snip]
>
> > Then I suggest filing a new bug report so it doesn't get lost.
>
> Have you found anything interesting in the kobj debugging output? Do you
> think these are two related problems (kobj and failing power-off) or
> separate?

I have been busy with other things today, sorry haven't gotten the
chance, it's in my queue.

> So should I file two bug-reports or just one? You mean on bugzilla?

Well, the kobject mess is one issue, and the shutdown issue is another
one. bugzilla would be nice.

thanks,

greg k-h

2008-02-26 20:12:45

by Greg KH

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Mon, Feb 25, 2008 at 01:43:29PM +0100, Guennadi Liakhovetski wrote:
> On Tue, 19 Feb 2008, Greg KH wrote:
>
> > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > getting the following warnings (with a bit of context):
> >
> > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > time from this?
>
> dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> unpacked, as it would have to be sent to the list, is 408K big. Will see
> what Greg says.

Thanks for the log, it helped out a lot. I'm thinking that you have
CONFIG_SYSFS_DEPRECATED set to Y, right? If so, can you set it to N
(hopefully you have a new userspace to handle that)?

I think we're trying to add a file with the same name as the device
object for the pci bus, which is wierd, because the namespace issues
should keep this from happening.

That being said, this warning really scares me:

kobject (c7c35900): tried to init an initialized object, something is seriously wrong.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm #30
[<c01ea0e9>] kobject_init+0x89/0x90
[<c025094e>] device_initialize+0x1e/0x90
[<c025119b>] device_register+0xb/0x20
[<c01f3fd8>] pci_bus_add_devices+0x98/0x140
[<c030aff7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69d0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================

We did just find a problem in the kobject core that might be causing
this to happen, can you try the patch below to see if this causes it to
go away as well?

thanks,

greg k-h

------------------
From: Greg Kroah-Hartman <[email protected]>
Subject: kobject: properly initialize ksets

kset_initialize was calling kobject_init_internal() which didn't
initialize the kobject as well as kobject_init() was. So have
kobject_init() call kobject_init_internal() and move the logic to
initalize the kobject there.

Cc: Kay Sievers <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
lib/kobject.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -153,6 +153,10 @@ static void kobject_init_internal(struct
return;
kref_init(&kobj->kref);
INIT_LIST_HEAD(&kobj->entry);
+ kobj->state_in_sysfs = 0;
+ kobj->state_add_uevent_sent = 0;
+ kobj->state_remove_uevent_sent = 0;
+ kobj->state_initialized = 1;
}


@@ -289,13 +293,8 @@ void kobject_init(struct kobject *kobj,
dump_stack();
}

- kref_init(&kobj->kref);
- INIT_LIST_HEAD(&kobj->entry);
+ kobject_init_internal(kobj);
kobj->ktype = ktype;
- kobj->state_in_sysfs = 0;
- kobj->state_add_uevent_sent = 0;
- kobj->state_remove_uevent_sent = 0;
- kobj->state_initialized = 1;
return;

error:

2008-02-27 11:24:54

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Tue, 26 Feb 2008, Greg KH wrote:

> On Mon, Feb 25, 2008 at 01:43:29PM +0100, Guennadi Liakhovetski wrote:
> > On Tue, 19 Feb 2008, Greg KH wrote:
> >
> > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > getting the following warnings (with a bit of context):
> > >
> > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > time from this?
> >
> > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > what Greg says.
>
> Thanks for the log, it helped out a lot. I'm thinking that you have
> CONFIG_SYSFS_DEPRECATED set to Y, right? If so, can you set it to N
> (hopefully you have a new userspace to handle that)?

Ok, result #1: kernel panic
http://home.arcor.de/g.liakhovetski/ap400/imga0045.jpg. If necessary, can
try a serial console, but that would be more difficult.

Testing further.

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-27 11:27:20

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008, Guennadi Liakhovetski wrote:

> On Tue, 26 Feb 2008, Greg KH wrote:
>
> > On Mon, Feb 25, 2008 at 01:43:29PM +0100, Guennadi Liakhovetski wrote:
> > > On Tue, 19 Feb 2008, Greg KH wrote:
> > >
> > > > On Mon, Feb 18, 2008 at 09:52:25PM +0100, Guennadi Liakhovetski wrote:
> > > > > Booting an x86 SMP PC with todays git-snapshot or just with 2.6.25-rc2
> > > > > getting the following warnings (with a bit of context):
> > > >
> > > > Can you try enabling CONFIG_DEBUG_KOBJECT and sending the output at boot
> > > > time from this?
> > >
> > > dmesg output with CONFIG_LOG_BUF_SHIFT=19 sent privately to Greg as
> > > unpacked, as it would have to be sent to the list, is 408K big. Will see
> > > what Greg says.
> >
> > Thanks for the log, it helped out a lot. I'm thinking that you have
> > CONFIG_SYSFS_DEPRECATED set to Y, right? If so, can you set it to N
> > (hopefully you have a new userspace to handle that)?
>
> Ok, result #1: kernel panic
> http://home.arcor.de/g.liakhovetski/ap400/imga0045.jpg. If necessary, can
> try a serial console, but that would be more difficult.

I also put the config at
http://home.arcor.de/g.liakhovetski/ap400/config-2.6.25-gregkh-0, the
panic is produced by just disabling CONFIG_SYSFS_DEPRECATED.

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-27 11:39:26

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Tue, 26 Feb 2008, Greg KH wrote:

> We did just find a problem in the kobject core that might be causing
> this to happen, can you try the patch below to see if this causes it to
> go away as well?

No, didn't help, same 3 stack dumps, only offsets / addresses a bit
different (CONFIG_SYSFS_DEPRECATED enabled):

kobject (c7c35900): tried to init an initialized object, something is
seriously wrong.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #37
[<c01ea0c5>] kobject_init+0x75/0x80
[<c025072e>] device_initialize+0x1e/0x90
[<c0250f7b>] device_register+0xb/0x20
[<c01f3db8>] pci_bus_add_devices+0x98/0x140
[<c030add7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69d0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================
sysfs: duplicate filename '0000:01' can not be created
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one+0x80/0xa0()
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #37
[<c01209f4>] warn_on_slowpath+0x54/0x70
[<c01210bc>] ? __call_console_drivers+0x5c/0x70
[<c0313e81>] ? _spin_unlock_irqrestore+0x11/0x30
[<c0121379>] ? release_console_sem+0x1d9/0x1f0
[<c01217fd>] ? vprintk+0x2ad/0x3b0
[<c01e9749>] ? ida_get_new_above+0x89/0x180
[<c01aa410>] ? sysfs_ilookup_test+0x0/0x20
[<c0313ddf>] ? _spin_unlock+0xf/0x30
[<c01807aa>] ? ifind+0x8a/0x90
[<c012191b>] ? printk+0x1b/0x20
[<c01aa7a0>] sysfs_add_one+0x80/0xa0
[<c01aacd9>] create_dir+0x49/0x90
[<c01aad4b>] sysfs_create_dir+0x2b/0x50
[<c01ea38e>] kobject_add_internal+0xae/0x190
[<c01ea4ed>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea4ed>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea54f>] kobject_add_varg+0x4f/0x60
[<c01ea83f>] kobject_add+0x2f/0x60
[<c01ea252>] ? kobject_get+0x12/0x20
[<c0250b0c>] device_add+0x8c/0x4f0
[<c01ea07a>] ? kobject_init+0x2a/0x80
[<c0250f82>] device_register+0x12/0x20
[<c01f3db8>] pci_bus_add_devices+0x98/0x140
[<c030add7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69d0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================
---[ end trace ca143223eefdc828 ]---
kobject_add_internal failed for 0000:01 with -EEXIST, don't try to
register things with the same name in the same directory.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #37
[<c01ea419>] kobject_add_internal+0x139/0x190
[<c01ea4ed>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea54f>] kobject_add_varg+0x4f/0x60
[<c01ea83f>] kobject_add+0x2f/0x60
[<c01ea252>] ? kobject_get+0x12/0x20
[<c0250b0c>] device_add+0x8c/0x4f0
[<c01ea07a>] ? kobject_init+0x2a/0x80
[<c0250f82>] device_register+0x12/0x20
[<c01f3db8>] pci_bus_add_devices+0x98/0x140
[<c030add7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69d0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-27 11:48:00

by Cornelia Huck

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008 12:24:54 +0100 (CET),
Guennadi Liakhovetski <[email protected]> wrote:

> Ok, result #1: kernel panic
> http://home.arcor.de/g.liakhovetski/ap400/imga0045.jpg. If necessary, can
> try a serial console, but that would be more difficult.

Looking at device_add(): Does the following patch make the oops go away?

---
drivers/base/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.orig/drivers/base/core.c
+++ linux-2.6/drivers/base/core.c
@@ -780,7 +780,7 @@ int device_add(struct device *dev)
dev = get_device(dev);
if (!dev || !strlen(dev->bus_id)) {
error = -EINVAL;
- goto Error;
+ goto Done;
}

pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);

2008-02-27 12:33:32

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008, Cornelia Huck wrote:

> On Wed, 27 Feb 2008 12:24:54 +0100 (CET),
> Guennadi Liakhovetski <[email protected]> wrote:
>
> > Ok, result #1: kernel panic
> > http://home.arcor.de/g.liakhovetski/ap400/imga0045.jpg. If necessary, can
> > try a serial console, but that would be more difficult.
>
> Looking at device_add(): Does the following patch make the oops go away?

You mean the kernel panic without CONFIG_SYSFS_DEPRECATED? No,
unfortunately is doesn't.

Thanks
Guennadi

>
> ---
> drivers/base/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-2.6.orig/drivers/base/core.c
> +++ linux-2.6/drivers/base/core.c
> @@ -780,7 +780,7 @@ int device_add(struct device *dev)
> dev = get_device(dev);
> if (!dev || !strlen(dev->bus_id)) {
> error = -EINVAL;
> - goto Error;
> + goto Done;
> }
>
> pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
>

---
Guennadi Liakhovetski

2008-02-27 13:21:19

by Cornelia Huck

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008 13:33:13 +0100 (CET),
Guennadi Liakhovetski <[email protected]> wrote:

> You mean the kernel panic without CONFIG_SYSFS_DEPRECATED? No,
> unfortunately is doesn't.

Hm, dev->kobj.parent may be NULL in cleanup_device_parent(). Does this
one help?

---
drivers/base/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.orig/drivers/base/core.c
+++ linux-2.6/drivers/base/core.c
@@ -621,7 +621,8 @@ static struct kobject *get_device_parent
static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
{
/* see if we live in a "glue" directory */
- if (!dev->class || glue_dir->kset != &dev->class->class_dirs)
+ if (!glue_dir || !dev->class ||
+ glue_dir->kset != &dev->class->class_dirs)
return;

kobject_put(glue_dir);

2008-02-27 13:46:05

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008, Cornelia Huck wrote:

> On Wed, 27 Feb 2008 13:33:13 +0100 (CET),
> Guennadi Liakhovetski <[email protected]> wrote:
>
> > You mean the kernel panic without CONFIG_SYSFS_DEPRECATED? No,
> > unfortunately is doesn't.
>
> Hm, dev->kobj.parent may be NULL in cleanup_device_parent(). Does this
> one help?

Yes, this one does. But Greg's original idea, that disabling
CONFIG_SYSFS_DEPRECATED would eliminate one of the warnings doesn't hold,
all three of them are still there (after your patches):

kobject (c7c84700): tried to init an initialized object, something is seriously wrong.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #40
[<c01ea105>] kobject_init+0x75/0x80
[<c025093e>] device_initialize+0x1e/0x90
[<c02510bb>] device_register+0xb/0x20
[<c01f3df8>] pci_bus_add_devices+0x98/0x140
[<c030abc7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69e0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================
sysfs: duplicate filename '0000:01' can not be created
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one+0x80/0xa0()
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #40
[<c01209f4>] warn_on_slowpath+0x54/0x70
[<c01210bc>] ? __call_console_drivers+0x5c/0x70
[<c0313c71>] ? _spin_unlock_irqrestore+0x11/0x30
[<c0121379>] ? release_console_sem+0x1d9/0x1f0
[<c01217fd>] ? vprintk+0x2ad/0x3b0
[<c01e9789>] ? ida_get_new_above+0x89/0x180
[<c01aa450>] ? sysfs_ilookup_test+0x0/0x20
[<c0313bcf>] ? _spin_unlock+0xf/0x30
[<c01807aa>] ? ifind+0x8a/0x90
[<c012191b>] ? printk+0x1b/0x20
[<c01aa7e0>] sysfs_add_one+0x80/0xa0
[<c01aad19>] create_dir+0x49/0x90
[<c01aad8b>] sysfs_create_dir+0x2b/0x50
[<c01ea3ce>] kobject_add_internal+0xae/0x190
[<c01ea52d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea52d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea58f>] kobject_add_varg+0x4f/0x60
[<c01ea87f>] kobject_add+0x2f/0x60
[<c0250d1c>] device_add+0x8c/0x420
[<c02510c2>] device_register+0x12/0x20
[<c01f3df8>] pci_bus_add_devices+0x98/0x140
[<c030abc7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69e0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================
---[ end trace ca143223eefdc828 ]---
kobject_add_internal failed for 0000:01 with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 1, comm: swapper Not tainted 2.6.25-rc2-testpm-dirty #40
[<c01ea459>] kobject_add_internal+0x139/0x190
[<c01ea52d>] ? kobject_set_name_vargs+0x2d/0x40
[<c01ea58f>] kobject_add_varg+0x4f/0x60
[<c01ea87f>] kobject_add+0x2f/0x60
[<c0250d1c>] device_add+0x8c/0x420
[<c02510c2>] device_register+0x12/0x20
[<c01f3df8>] pci_bus_add_devices+0x98/0x140
[<c030abc7>] ? pcibios_scan_root+0x27/0xa0
[<c03f69e0>] pci_legacy_init+0x50/0xf0
[<c03db5c2>] kernel_init+0x132/0x310
[<c010303a>] ? ret_from_fork+0x6/0x1c
[<c03db490>] ? kernel_init+0x0/0x310
[<c03db490>] ? kernel_init+0x0/0x310
[<c0103d3f>] kernel_thread_helper+0x7/0x18
=======================
pci 0000:00:01.0: Error registering pci_bus device bridge symlink,
continuing...PCI: Using IRQ router PIIX/ICH [8086/7110] at 0000:00:14.0

BTW, it might help to know, that under 2.6.24(.2) I'm getting only the
third one:

PCI: Probing PCI hardware
sysfs: duplicate filename 'bridge' can not be created
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Pid: 1, comm: swapper Not tainted 2.6.24-noapm #4
[<c0103fca>] show_trace_log_lvl+0x1a/0x30
[<c0104a82>] show_trace+0x12/0x20
[<c010530e>] dump_stack+0x6e/0x80
[<c01ac2dd>] sysfs_add_one+0x9d/0xe0
[<c01ad0fb>] sysfs_create_link+0x8b/0x130
[<c01f3cf4>] pci_bus_add_devices+0x94/0x120
[<c03e8dd0>] pci_legacy_init+0x50/0xf0
[<c03cf5f2>] kernel_init+0x142/0x320
[<c0103b93>] kernel_thread_helper+0x7/0x14
=======================
pci 0000:00:01.0: Error creating sysfs bridge symlink, continuing...
PCI: Using IRQ router PIIX/ICH [8086/7110] at 0000:00:14.0

Thanks
Guennadi
---
Guennadi Liakhovetski

2008-02-27 14:38:36

by Cornelia Huck

[permalink] [raw]
Subject: Re: [PCI] duplicate sysfs symbols getting registered in current git

On Wed, 27 Feb 2008 14:46:05 +0100 (CET),
Guennadi Liakhovetski <[email protected]> wrote:

> On Wed, 27 Feb 2008, Cornelia Huck wrote:
>
> > On Wed, 27 Feb 2008 13:33:13 +0100 (CET),
> > Guennadi Liakhovetski <[email protected]> wrote:
> >
> > > You mean the kernel panic without CONFIG_SYSFS_DEPRECATED? No,
> > > unfortunately is doesn't.
> >
> > Hm, dev->kobj.parent may be NULL in cleanup_device_parent(). Does this
> > one help?
>
> Yes, this one does.

Great, thanks for testing!

> But Greg's original idea, that disabling
> CONFIG_SYSFS_DEPRECATED would eliminate one of the warnings doesn't hold,
> all three of them are still there (after your patches):

I'm afraid I can't help there, as this looks PCI-related...

Greg: Attached are the fixes against your tree with proper description
and s-o-b.


Driver core: Fix cleanup when failing device_add().

-Don't call cleanup_device_parent() if we didn't call setup_parent().
-dev->kobj.parent may be NULL when cleanup_device_parent() is called,
so we need to handle glue_dir == NULL in cleanup_glue_dir().

Signed-off-by: Cornelia Huck <[email protected]>

---
drivers/base/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

--- linux-2.6.orig/drivers/base/core.c
+++ linux-2.6/drivers/base/core.c
@@ -622,7 +622,8 @@ static struct kobject *get_device_parent
static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
{
/* see if we live in a "glue" directory */
- if (!dev->class || glue_dir->kset != &dev->class->class_dirs)
+ if (!glue_dir || !dev->class ||
+ glue_dir->kset != &dev->class->class_dirs)
return;

kobject_put(glue_dir);
@@ -781,7 +782,7 @@ int device_add(struct device *dev)
dev = get_device(dev);
if (!dev || !strlen(dev->bus_id)) {
error = -EINVAL;
- goto Error;
+ goto Done;
}

pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);