public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] Driver core patches for 2.6.20-rc1
@ 2006-12-20 20:01 Greg KH
  2006-12-20 20:03 ` [PATCH 1/3] kref refcnt and false positives Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2006-12-20 20:01 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are some minor driver core patches for 2.6.20-rc1

The descriptions of them are below.

All of these patches have been in the -mm tree for a while.

Please pull from:
	git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
or if master.kernel.org hasn't synced up yet:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/

Patches will be sent as a follow-on to this message to lkml for people
to see.

thanks,

greg k-h

 drivers/acpi/ibm_acpi.c |    4 ++--
 include/linux/device.h  |    2 ++
 include/linux/kobject.h |   11 ++++++-----
 init/main.c             |    2 +-
 lib/kobject_uevent.c    |   44 ++++++++++++++++++++++++++++++--------------
 lib/kref.c              |    7 +------
 6 files changed, 42 insertions(+), 28 deletions(-)

---------------

Adrian Bunk (1):
      Driver core: proper prototype for drivers/base/init.c:driver_init()

Aneesh Kumar K.V (1):
      kobject: kobject_uevent() returns manageable value

Venkatesh Pallipadi (1):
      kref refcnt and false positives


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/3] kref refcnt and false positives
  2006-12-20 20:01 [GIT PATCH] Driver core patches for 2.6.20-rc1 Greg KH
@ 2006-12-20 20:03 ` Greg KH
       [not found]   ` <11666450412291-git-send-email-greg@kroah.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2006-12-20 20:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Venkatesh Pallipadi, Andrew Morton, Greg Kroah-Hartman

From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

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()

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 <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 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 *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)) {
 		release(kref);
 		return 1;
 	}
-- 
1.4.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] Driver core: proper prototype for drivers/base/init.c:driver_init()
       [not found]   ` <11666450412291-git-send-email-greg@kroah.com>
@ 2006-12-20 20:03     ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2006-12-20 20:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adrian Bunk, Andrew Morton, Greg Kroah-Hartman

From: Adrian Bunk <bunk@stusta.de>

Add a prototype for driver_init() in include/linux/device.h.

Also remove a static function of the same name in drivers/acpi/ibm_acpi.c to
ibm_acpi_driver_init() to fix the namespace collision.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/acpi/ibm_acpi.c |    4 ++--
 include/linux/device.h  |    2 ++
 init/main.c             |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 003a987..5a84459 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -352,7 +352,7 @@ static char *next_cmd(char **cmds)
 	return start;
 }
 
-static int driver_init(void)
+static int ibm_acpi_driver_init(void)
 {
 	printk(IBM_INFO "%s v%s\n", IBM_DESC, IBM_VERSION);
 	printk(IBM_INFO "%s\n", IBM_URL);
@@ -1605,7 +1605,7 @@ static int fan_write(char *buf)
 static struct ibm_struct ibms[] = {
 	{
 	 .name = "driver",
-	 .init = driver_init,
+	 .init = ibm_acpi_driver_init,
 	 .read = driver_read,
 	 },
 	{
diff --git a/include/linux/device.h b/include/linux/device.h
index 49ab53c..f44247f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -433,6 +433,8 @@ static inline int device_is_registered(struct device *dev)
 	return dev->is_registered;
 }
 
+void driver_init(void);
+
 /*
  * High level routines for use by the bus drivers
  */
diff --git a/init/main.c b/init/main.c
index e3f0bb2..2b1cdaa 100644
--- a/init/main.c
+++ b/init/main.c
@@ -53,6 +53,7 @@
 #include <linux/utsrelease.h>
 #include <linux/pid_namespace.h>
 #include <linux/compile.h>
+#include <linux/device.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -94,7 +95,6 @@ extern void pidmap_init(void);
 extern void prio_tree_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
-extern void driver_init(void);
 extern void prepare_namespace(void);
 #ifdef	CONFIG_ACPI
 extern void acpi_early_init(void);
-- 
1.4.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-20 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-20 20:01 [GIT PATCH] Driver core patches for 2.6.20-rc1 Greg KH
2006-12-20 20:03 ` [PATCH 1/3] kref refcnt and false positives Greg KH
     [not found]   ` <11666450412291-git-send-email-greg@kroah.com>
2006-12-20 20:03     ` [PATCH 3/3] Driver core: proper prototype for drivers/base/init.c:driver_init() Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox