Commit:     f334b60b43a0927f4ab1187cbdb4582f5227c3b1
Parent:     f238085415c56618e042252894f2fcc971add645
Author:     Venkatesh Pallipadi <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 19 13:01:29 2006 -0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Dec 20 10:56:43 2006 -0800

    kref refcnt and false positives
    With WARN_ON addition to kobject_init()
    I started seeing following WARNING on CPU offline followed by online on my
    x86_64 system.
    WARNING at lib/kobject.c:172 kobject_init()
    Call Trace:
     [<ffffffff8020ab45>] dump_trace+0xaa/0x3ef
     [<ffffffff8020aec4>] show_trace+0x3a/0x50
     [<ffffffff8020b0f6>] dump_stack+0x15/0x17
     [<ffffffff80350abc>] kobject_init+0x3f/0x8a
     [<ffffffff80350be1>] kobject_register+0x1a/0x3e
     [<ffffffff803bbd89>] sysdev_register+0x5b/0xf9
     [<ffffffff80211d0b>] mce_create_device+0x77/0xf4
     [<ffffffff80211dc2>] mce_cpu_callback+0x3a/0xe5
     [<ffffffff805632fd>] notifier_call_chain+0x26/0x3b
     [<ffffffff8023f6f3>] raw_notifier_call_chain+0x9/0xb
     [<ffffffff802519bf>] _cpu_up+0xb4/0xdc
     [<ffffffff80251a12>] cpu_up+0x2b/0x42
     [<ffffffff803bef00>] store_online+0x4a/0x72
     [<ffffffff803bb6ce>] sysdev_store+0x24/0x26
     [<ffffffff802baaa2>] sysfs_write_file+0xcf/0xfc
     [<ffffffff8027fc6f>] vfs_write+0xae/0x154
     [<ffffffff80280418>] sys_write+0x47/0x6f
     [<ffffffff8020963e>] system_call+0x7e/0x83
    DWARF2 unwinder stuck at system_call+0x7e/0x83
    Leftover inexact backtrace:
    This is a false positive as mce.c is unregistering/registering sysfs
    interfaces cleanly on hotplug.
    kref_put() and conditional decrement of refcnt seems to be the root cause
    for this and the patch below resolves the issue for me.
    Signed-off-by: Venkatesh Pallipadi <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
 lib/kref.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/lib/kref.c b/lib/kref.c
index 4a467fa..0d07cc3 100644
--- a/lib/kref.c
+++ b/lib/kref.c
@@ -52,12 +52,7 @@ int kref_put(struct kref *kref, void (*release)(struct kref 
        WARN_ON(release == NULL);
        WARN_ON(release == (void (*)(struct kref *))kfree);
-       /*
-        * if current count is one, we are the last user and can release object
-        * right now, avoiding an atomic operation on 'refcount'
-        */
-       if ((atomic_read(&kref->refcount) == 1) ||
-           (atomic_dec_and_test(&kref->refcount))) {
+       if (atomic_dec_and_test(&kref->refcount)) {
                return 1;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to