[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061213160812.A13177@unix-os.sc.intel.com>
Date: Wed, 13 Dec 2006 16:08:12 -0800
From: Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>
To: Greg KH <gregkh@...e.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>,
Andrew Morton <akpm@...l.org>, Arjan <arjan@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: kref refcnt and false positives
On Wed, Dec 13, 2006 at 04:12:46PM -0800, Greg KH wrote:
> On Wed, Dec 13, 2006 at 03:34:08PM -0800, Venkatesh Pallipadi wrote:
> >
> > With WARN_ON addition to kobject_init()
> > [ http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.19/2.6.19-mm1/dont-use/broken-out/gregkh-driver-kobject-warn.patch ]
> >
> > I started seeing following WARNING on CPU offline followed by online on my
> > x86_64 system.
> >
> > WARNING at lib/kobject.c:172 kobject_init()
> >
> > This is a false positive as mce.c is unregistering/registering sysfs
> > interfaces cleanly on hotplug.
>
> The warning above tends to look like this is not true.
>
> > kref_put() and conditional decrement of refcnt seems to be the root cause
> > for this and the patch below resolves the issue for me.
>
> Why?
>
> Are you properly initializing your kref to null before you register it
> with the driver core? Or is it a static object?
>
Yes. arch/x86_64/kernel/mce.c is calling sysdev_register and sysdev_unregister
for cpu hot_add and hot_remove respectively.
The problem is that due to the perf optimization, refcnt remains at 1
even after unregister (as it never gets decremented to 0 in kref_put()).
So, when we try to register next time for same sysdev (The object is percpu,
so previously set refcnt will remain 1), init sees that refcnt is already 1
and print out the WARNing.
> > Original comment seemed to indicate that this conditional thing was
> > performance related. Is it really? If not, we should consider the below patch.
>
> Yes, it's a performance gain and I don't see how this patch would change
> the above warning.
>
In that case, I think we should change the WARN_ON in question to check for > 1.
Thanks,
Venki
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists