public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
To: Greg KH <gregkh@suse.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
	Andrew Morton <akpm@osdl.org>, Arjan <arjan@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: kref refcnt and false positives
Date: Wed, 13 Dec 2006 16:08:12 -0800	[thread overview]
Message-ID: <20061213160812.A13177@unix-os.sc.intel.com> (raw)
In-Reply-To: <20061214001246.GA10056@suse.de>; from gregkh@suse.de on Wed, Dec 13, 2006 at 04:12:46PM -0800

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

  reply	other threads:[~2006-12-14  0:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13 23:34 kref refcnt and false positives Venkatesh Pallipadi
2006-12-14  0:12 ` Greg KH
2006-12-14  0:08   ` Venkatesh Pallipadi [this message]
2006-12-14  0:41   ` Andrew Morton
2006-12-14  7:56     ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2006-12-14 23:51 Pallipadi, Venkatesh
2006-12-15  0:19 ` Eric W. Biederman
2006-12-15  0:35   ` Andrew Morton
2006-12-15  0:53     ` Eric W. Biederman
     [not found] <200612210901.kBL91MwR027509@hera.kernel.org>
2006-12-31 15:16 ` David Woodhouse
2007-01-01 20:13   ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061213160812.A13177@unix-os.sc.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=akpm@osdl.org \
    --cc=arjan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox