* [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
@ 2012-01-03 15:29 Neil Horman
2012-01-03 18:05 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Neil Horman @ 2012-01-03 15:29 UTC (permalink / raw)
To: linux-kernel
Cc: Neil Horman, Jesse Barnes, Bjorn Helgaas, Greg Kroah-Hartman,
linux-pci
This warning was recently reported to me:
------------[ cut here ]------------
WARNING: at lib/kobject.c:595 kobject_put+0x50/0x60()
Hardware name: VMware Virtual Platform
kobject: '(null)' (ffff880027b0df40): is not initialized, yet kobject_put() is
being called.
Modules linked in: vmxnet3(+) vmw_balloon i2c_piix4 i2c_core shpchp raid10
vmw_pvscsi
Pid: 630, comm: modprobe Tainted: G W 3.1.6-1.fc16.x86_64 #1
Call Trace:
[<ffffffff8106b73f>] warn_slowpath_common+0x7f/0xc0
[<ffffffff8106b836>] warn_slowpath_fmt+0x46/0x50
[<ffffffff810da293>] ? free_desc+0x63/0x70
[<ffffffff812a9aa0>] kobject_put+0x50/0x60
[<ffffffff812e4c25>] free_msi_irqs+0xd5/0x120
[<ffffffff812e524c>] pci_enable_msi_block+0x24c/0x2c0
[<ffffffffa017c273>] vmxnet3_alloc_intr_resources+0x173/0x240 [vmxnet3]
[<ffffffffa0182e94>] vmxnet3_probe_device+0x615/0x834 [vmxnet3]
[<ffffffff812d141c>] local_pci_probe+0x5c/0xd0
[<ffffffff812d2cb9>] pci_device_probe+0x109/0x130
[<ffffffff8138ba2c>] driver_probe_device+0x9c/0x2b0
[<ffffffff8138bceb>] __driver_attach+0xab/0xb0
[<ffffffff8138bc40>] ? driver_probe_device+0x2b0/0x2b0
[<ffffffff8138bc40>] ? driver_probe_device+0x2b0/0x2b0
[<ffffffff8138a8ac>] bus_for_each_dev+0x5c/0x90
[<ffffffff8138b63e>] driver_attach+0x1e/0x20
[<ffffffff8138b240>] bus_add_driver+0x1b0/0x2a0
[<ffffffffa0188000>] ? 0xffffffffa0187fff
[<ffffffff8138c246>] driver_register+0x76/0x140
[<ffffffff815ca414>] ? printk+0x51/0x53
[<ffffffffa0188000>] ? 0xffffffffa0187fff
[<ffffffff812d2996>] __pci_register_driver+0x56/0xd0
[<ffffffffa018803a>] vmxnet3_init_module+0x3a/0x3c [vmxnet3]
[<ffffffff81002042>] do_one_initcall+0x42/0x180
[<ffffffff810aad71>] sys_init_module+0x91/0x200
[<ffffffff815dccc2>] system_call_fastpath+0x16/0x1b
---[ end trace 44593438a59a9558 ]---
Using INTx interrupt, #Rx queues: 1.
It occurs when populate_msi_sysfs fails, which in turn causes free_msi_irqs to
be called. Because populate_msi_sysfs fails, we never registered any of the
msi irq sysfs objects, but free_msi_irqs still calls kobject_del and kobject_put
on each of them, which gets flagged in the above stack trace.
The fix is pretty straightforward. We can key of the parent pointer in the
kobject. It is only set if the kobject_init_and_add succededs in
populate_msi_sysfs. If anything fails there, each kobject has its parent reset
to NULL
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Greg Kroah-Hartman <gregkh@suse.de>
CC: linux-pci@vger.kernel.org
---
drivers/pci/msi.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 337e16a..82de95e 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -323,8 +323,18 @@ static void free_msi_irqs(struct pci_dev *dev)
if (list_is_last(&entry->list, &dev->msi_list))
iounmap(entry->mask_base);
}
- kobject_del(&entry->kobj);
- kobject_put(&entry->kobj);
+
+ /*
+ * Its possible that we get into this path
+ * When populate_msi_sysfs fails, which means the entries
+ * were not registered with sysfs. In that case don't
+ * unregister them.
+ */
+ if (entry->kobj.parent) {
+ kobject_del(&entry->kobj);
+ kobject_put(&entry->kobj);
+ }
+
list_del(&entry->list);
kfree(entry);
}
--
1.7.7.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-03 15:29 [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects Neil Horman
@ 2012-01-03 18:05 ` David Miller
2012-01-03 18:53 ` Neil Horman
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2012-01-03 18:05 UTC (permalink / raw)
To: nhorman; +Cc: linux-kernel, jbarnes, bhelgaas, gregkh, linux-pci
From: Neil Horman <nhorman@tuxdriver.com>
Date: Tue, 3 Jan 2012 10:29:54 -0500
> This warning was recently reported to me:
I've hit this too, see:
http://marc.info/?l=linux-kernel&m=132458146927890&w=2
and my analysis at:
http://marc.info/?l=linux-arch&m=132458391128660&w=2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-03 18:05 ` David Miller
@ 2012-01-03 18:53 ` Neil Horman
2012-01-04 17:19 ` Jesse Barnes
0 siblings, 1 reply; 9+ messages in thread
From: Neil Horman @ 2012-01-03 18:53 UTC (permalink / raw)
To: David Miller; +Cc: linux-kernel, jbarnes, bhelgaas, gregkh, linux-pci
On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
> From: Neil Horman <nhorman@tuxdriver.com>
> Date: Tue, 3 Jan 2012 10:29:54 -0500
>
> > This warning was recently reported to me:
>
> I've hit this too, see:
>
> http://marc.info/?l=linux-kernel&m=132458146927890&w=2
>
> and my analysis at:
>
> http://marc.info/?l=linux-arch&m=132458391128660&w=2
>
Yup, your analysis is correct. Regardless of the why behind msi enablement
failing, we need to gate the kobject_del/put in free_msi_irqs on successful
completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
using the parent pointer as a flag.
Thanks
Neil
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-03 18:53 ` Neil Horman
@ 2012-01-04 17:19 ` Jesse Barnes
2012-01-04 19:51 ` Neil Horman
0 siblings, 1 reply; 9+ messages in thread
From: Jesse Barnes @ 2012-01-04 17:19 UTC (permalink / raw)
To: Neil Horman; +Cc: David Miller, linux-kernel, bhelgaas, gregkh, linux-pci
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
On Tue, 3 Jan 2012 13:53:05 -0500
Neil Horman <nhorman@tuxdriver.com> wrote:
> On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
> > From: Neil Horman <nhorman@tuxdriver.com>
> > Date: Tue, 3 Jan 2012 10:29:54 -0500
> >
> > > This warning was recently reported to me:
> >
> > I've hit this too, see:
> >
> > http://marc.info/?l=linux-kernel&m=132458146927890&w=2
> >
> > and my analysis at:
> >
> > http://marc.info/?l=linux-arch&m=132458391128660&w=2
> >
> Yup, your analysis is correct. Regardless of the why behind msi enablement
> failing, we need to gate the kobject_del/put in free_msi_irqs on successful
> completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
> using the parent pointer as a flag.
I applied this to my -next branch; doesn't seem critical to land
immediately. If you disagree let me know and I'll pull it over to my
for-linus branch instead.
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-04 17:19 ` Jesse Barnes
@ 2012-01-04 19:51 ` Neil Horman
2012-01-04 19:56 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Neil Horman @ 2012-01-04 19:51 UTC (permalink / raw)
To: Jesse Barnes; +Cc: David Miller, linux-kernel, bhelgaas, gregkh, linux-pci
On Wed, Jan 04, 2012 at 09:19:52AM -0800, Jesse Barnes wrote:
> On Tue, 3 Jan 2012 13:53:05 -0500
> Neil Horman <nhorman@tuxdriver.com> wrote:
>
> > On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
> > > From: Neil Horman <nhorman@tuxdriver.com>
> > > Date: Tue, 3 Jan 2012 10:29:54 -0500
> > >
> > > > This warning was recently reported to me:
> > >
> > > I've hit this too, see:
> > >
> > > http://marc.info/?l=linux-kernel&m=132458146927890&w=2
> > >
> > > and my analysis at:
> > >
> > > http://marc.info/?l=linux-arch&m=132458391128660&w=2
> > >
> > Yup, your analysis is correct. Regardless of the why behind msi enablement
> > failing, we need to gate the kobject_del/put in free_msi_irqs on successful
> > completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
> > using the parent pointer as a flag.
>
> I applied this to my -next branch; doesn't seem critical to land
> immediately. If you disagree let me know and I'll pull it over to my
> for-linus branch instead.
>
> Thanks,
I'm ok with it waiting, but I'll defer to Dave and others who have seen it
occur. It sounds like its alot of log noise.
Neil
> --
> Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-04 19:51 ` Neil Horman
@ 2012-01-04 19:56 ` David Miller
2012-01-04 20:02 ` Jesse Barnes
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2012-01-04 19:56 UTC (permalink / raw)
To: nhorman; +Cc: jbarnes, linux-kernel, bhelgaas, gregkh, linux-pci
From: Neil Horman <nhorman@tuxdriver.com>
Date: Wed, 4 Jan 2012 14:51:34 -0500
> On Wed, Jan 04, 2012 at 09:19:52AM -0800, Jesse Barnes wrote:
>> On Tue, 3 Jan 2012 13:53:05 -0500
>> Neil Horman <nhorman@tuxdriver.com> wrote:
>>
>> > On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
>> > > From: Neil Horman <nhorman@tuxdriver.com>
>> > > Date: Tue, 3 Jan 2012 10:29:54 -0500
>> > >
>> > > > This warning was recently reported to me:
>> > >
>> > > I've hit this too, see:
>> > >
>> > > http://marc.info/?l=linux-kernel&m=132458146927890&w=2
>> > >
>> > > and my analysis at:
>> > >
>> > > http://marc.info/?l=linux-arch&m=132458391128660&w=2
>> > >
>> > Yup, your analysis is correct. Regardless of the why behind msi enablement
>> > failing, we need to gate the kobject_del/put in free_msi_irqs on successful
>> > completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
>> > using the parent pointer as a flag.
>>
>> I applied this to my -next branch; doesn't seem critical to land
>> immediately. If you disagree let me know and I'll pull it over to my
>> for-linus branch instead.
>>
>> Thanks,
> I'm ok with it waiting, but I'll defer to Dave and others who have seen it
> occur. It sounds like its alot of log noise.
The bug only exists in the PCI -next code I thought.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-04 19:56 ` David Miller
@ 2012-01-04 20:02 ` Jesse Barnes
2012-01-04 21:18 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: Jesse Barnes @ 2012-01-04 20:02 UTC (permalink / raw)
To: David Miller; +Cc: nhorman, linux-kernel, bhelgaas, gregkh, linux-pci
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
On Wed, 04 Jan 2012 14:56:19 -0500 (EST)
David Miller <davem@davemloft.net> wrote:
> From: Neil Horman <nhorman@tuxdriver.com>
> Date: Wed, 4 Jan 2012 14:51:34 -0500
>
> > On Wed, Jan 04, 2012 at 09:19:52AM -0800, Jesse Barnes wrote:
> >> On Tue, 3 Jan 2012 13:53:05 -0500
> >> Neil Horman <nhorman@tuxdriver.com> wrote:
> >>
> >> > On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
> >> > > From: Neil Horman <nhorman@tuxdriver.com>
> >> > > Date: Tue, 3 Jan 2012 10:29:54 -0500
> >> > >
> >> > > > This warning was recently reported to me:
> >> > >
> >> > > I've hit this too, see:
> >> > >
> >> > > http://marc.info/?l=linux-kernel&m=132458146927890&w=2
> >> > >
> >> > > and my analysis at:
> >> > >
> >> > > http://marc.info/?l=linux-arch&m=132458391128660&w=2
> >> > >
> >> > Yup, your analysis is correct. Regardless of the why behind msi enablement
> >> > failing, we need to gate the kobject_del/put in free_msi_irqs on successful
> >> > completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
> >> > using the parent pointer as a flag.
> >>
> >> I applied this to my -next branch; doesn't seem critical to land
> >> immediately. If you disagree let me know and I'll pull it over to my
> >> for-linus branch instead.
> >>
> >> Thanks,
> > I'm ok with it waiting, but I'll defer to Dave and others who have seen it
> > occur. It sounds like its alot of log noise.
>
> The bug only exists in the PCI -next code I thought.
Oh yeah, looks like it. Lost track of my -next vs master branches
there...
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-04 20:02 ` Jesse Barnes
@ 2012-01-04 21:18 ` Josh Boyer
2012-01-04 21:25 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2012-01-04 21:18 UTC (permalink / raw)
To: Jesse Barnes
Cc: David Miller, nhorman, linux-kernel, bhelgaas, gregkh, linux-pci
On Wed, Jan 4, 2012 at 3:02 PM, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> On Wed, 04 Jan 2012 14:56:19 -0500 (EST)
> David Miller <davem@davemloft.net> wrote:
>
>> From: Neil Horman <nhorman@tuxdriver.com>
>> Date: Wed, 4 Jan 2012 14:51:34 -0500
>>
>> > On Wed, Jan 04, 2012 at 09:19:52AM -0800, Jesse Barnes wrote:
>> >> On Tue, 3 Jan 2012 13:53:05 -0500
>> >> Neil Horman <nhorman@tuxdriver.com> wrote:
>> >>
>> >> > On Tue, Jan 03, 2012 at 01:05:26PM -0500, David Miller wrote:
>> >> > > From: Neil Horman <nhorman@tuxdriver.com>
>> >> > > Date: Tue, 3 Jan 2012 10:29:54 -0500
>> >> > >
>> >> > > > This warning was recently reported to me:
>> >> > >
>> >> > > I've hit this too, see:
>> >> > >
>> >> > > http://marc.info/?l=linux-kernel&m=132458146927890&w=2
>> >> > >
>> >> > > and my analysis at:
>> >> > >
>> >> > > http://marc.info/?l=linux-arch&m=132458391128660&w=2
>> >> > >
>> >> > Yup, your analysis is correct. Regardless of the why behind msi enablement
>> >> > failing, we need to gate the kobject_del/put in free_msi_irqs on successful
>> >> > completion of kobject_init_and_add in populate_msi_sysfs. This patch does that,
>> >> > using the parent pointer as a flag.
>> >>
>> >> I applied this to my -next branch; doesn't seem critical to land
>> >> immediately. If you disagree let me know and I'll pull it over to my
>> >> for-linus branch instead.
>> >>
>> >> Thanks,
>> > I'm ok with it waiting, but I'll defer to Dave and others who have seen it
>> > occur. It sounds like its alot of log noise.
>>
>> The bug only exists in the PCI -next code I thought.
>
> Oh yeah, looks like it. Lost track of my -next vs master branches
> there...
Er... Neil's commit log in the patch itself has an oops from 3.1.6 in
it. If the bug the patch fixes is only present in -next PCI code, how
did it get hit on that release?
Did we switch to talking about some other patch here and I'm just confused?
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects
2012-01-04 21:18 ` Josh Boyer
@ 2012-01-04 21:25 ` Josh Boyer
0 siblings, 0 replies; 9+ messages in thread
From: Josh Boyer @ 2012-01-04 21:25 UTC (permalink / raw)
To: Jesse Barnes
Cc: David Miller, nhorman, linux-kernel, bhelgaas, gregkh, linux-pci
On Wed, Jan 4, 2012 at 4:18 PM, Josh Boyer <jwboyer@gmail.com> wrote:
>>> The bug only exists in the PCI -next code I thought.
>>
>> Oh yeah, looks like it. Lost track of my -next vs master branches
>> there...
>
> Er... Neil's commit log in the patch itself has an oops from 3.1.6 in
> it. If the bug the patch fixes is only present in -next PCI code, how
> did it get hit on that release?
>
> Did we switch to talking about some other patch here and I'm just confused?
I'm just confused. I forgot Neil backported that upstream code to the
F16 3.1.6 kernel. Sorry for the noise.
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-01-04 21:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03 15:29 [PATCH] msi: fix imbalanced refcount of msi irq sysfs objects Neil Horman
2012-01-03 18:05 ` David Miller
2012-01-03 18:53 ` Neil Horman
2012-01-04 17:19 ` Jesse Barnes
2012-01-04 19:51 ` Neil Horman
2012-01-04 19:56 ` David Miller
2012-01-04 20:02 ` Jesse Barnes
2012-01-04 21:18 ` Josh Boyer
2012-01-04 21:25 ` Josh Boyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).