Re: 2.6.27-rc5 xen balloon driver warnings

Previous thread: [PATCH] x86: move nonx_setup etc from common.c to init_64.c by Yinghai Lu on Friday, September 5, 2008 - 12:58 am. (2 messages)

Next thread: none
From: Rambaldi
Date: Friday, September 5, 2008 - 1:41 am

Hi,

when running the 2.6.27-rc5 kernel as 64 bits dumU I get the following warnings:


xen_balloon: Initialising balloon driver.
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:463 sysfs_add_one+0x33/0x39()
sysfs: duplicate filename 'memory' can not be created
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.27-rc5 #2

Call Trace:
  [<ffffffff80231c9c>] warn_slowpath+0xb4/0xdd
  [<ffffffff803311f8>] write_console+0xda/0x119
  [<ffffffff8020baf6>] xen_mc_flush+0x11c/0x15b
  [<ffffffff8032c0d8>] notify_update+0x2b/0x30
  [<ffffffff80330579>] vt_console_print+0x27b/0x288
  [<ffffffff802f0b6e>] idr_get_empty_slot+0x164/0x243
  [<ffffffff80274ad0>] __kmalloc+0x99/0xc6
  [<ffffffff8027456b>] kmem_cache_alloc+0x65/0x92
  [<ffffffff802b7a30>] sysfs_ilookup_test+0x0/0xf
  [<ffffffff802b7c2c>] sysfs_find_dirent+0x1b/0x2f
  [<ffffffff802b7ce2>] sysfs_add_one+0x33/0x39
  [<ffffffff802b8219>] create_dir+0x4f/0x87
  [<ffffffff802b8286>] sysfs_create_dir+0x35/0x4c
  [<ffffffff802f1959>] kobject_add_internal+0xd3/0x18e
  [<ffffffff8055dbb9>] balloon_init+0x0/0x1bd
  [<ffffffff802f1a38>] kset_register+0x24/0x3a
  [<ffffffff8055dc69>] balloon_init+0xb0/0x1bd
  [<ffffffff8020a042>] do_one_initcall+0x42/0x141
  [<ffffffff802b1b04>] create_proc_entry+0x73/0x8a
  [<ffffffff80254260>] register_irq_proc+0xa7/0xbf
  [<ffffffff805488d0>] kernel_init+0x116/0x16b
  [<ffffffff8020fd3b>] int_ret_from_sys_call+0x13/0x33
  [<ffffffff80210ef9>] child_rip+0xa/0x11
  [<ffffffff80210208>] retint_restore_args+0x5/0x20
  [<ffffffff8030caa0>] dummycon_dummy+0x0/0x3
  [<ffffffff8030caa0>] dummycon_dummy+0x0/0x3
  [<ffffffff80210eef>] child_rip+0x0/0x11

---[ end trace 4eaa2a86a8e2da22 ]---
kobject_add_internal failed for memory with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 1, comm: swapper Tainted: G        W 2.6.27-rc5 #2

Call Trace:
  [<ffffffff802f19d5>] kobject_add_internal+0x14f/0x18e
  [<ffffffff8055dbb9>] ...
From: Jeremy Fitzhardinge
Date: Sunday, September 7, 2008 - 3:38 pm

This patch, change 167e6cf62979df03513898966f9227847d192327 in tip.git,
should fix this.  I'm not sure if the other sysfs changes apply to
mainline git or not.

Could you try this and see how it goes?  The first chunk should be
sufficient to fix your problem.

     J

Subject: xen-balloon: fix up sysfs issues

1. Set the class so it doesn't clash with the normal memory class
2. Fix up the sysfs show functions to match the new prototype
3. Clean up use of memparse

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: viets@work.de
Cc: Andi Kleen <andi@firstfloor.org>
---
 drivers/xen/balloon.c |   27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

===================================================================
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -60,7 +60,7 @@
 
 #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
 
-#define BALLOON_CLASS_NAME "memory"
+#define BALLOON_CLASS_NAME "xen_memory"
 
 struct balloon_stats {
 	/* We aim for 'current allocation' == 'target allocation'. */
@@ -588,12 +587,13 @@
 }
 
 
-#define BALLOON_SHOW(name, format, args...)			\
-	static ssize_t show_##name(struct sys_device *dev,	\
-				   char *buf)			\
-	{							\
-		return sprintf(buf, format, ##args);		\
-	}							\
+#define BALLOON_SHOW(name, format, args...)				\
+	static ssize_t show_##name(struct sys_device *dev,		\
+				   struct sysdev_attribute *attr,	\
+				   char *buf)				\
+	{								\
+		return sprintf(buf, format, ##args);			\
+	}								\
 	static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL)
 
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
@@ -604,7 +604,8 @@
 	     (balloon_stats.hard_limit!=~0UL) ? PAGES2KB(balloon_stats.hard_limit) : 0);
 BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages));
 
-static ssize_t show_target_kb(struct sys_device *dev, char *buf)
+static ssize_t show_target_kb(struct sys_device *dev, struct ...
From: Rambaldi
Date: Monday, September 8, 2008 - 8:37 am

Hi Jeremy,

I used the complete patch, I had some compile warnings.
The oops is gone and I was able to access the
	/sys/devices/system/xen_memory/xen_memory0/info/current_kb
entry.

thanks,

R.

--

From: Jeremy Fitzhardinge
Date: Monday, September 8, 2008 - 9:54 am

Well, the compile warning are bad news.  Just use the first hunk.

Ingo, could you send this up to Linus?  It's a subset of a patch you've
already got in your tree.

Thanks,
    J

Subject: xen-balloon: fix balloon sysfs name

Set the class so it doesn't clash with the normal memory class.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
===================================================================
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -60,7 +60,7 @@
 
 #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
 
-#define BALLOON_CLASS_NAME "memory"
+#define BALLOON_CLASS_NAME "xen_memory"
 
 struct balloon_stats {
 	/* We aim for 'current allocation' == 'target allocation'. */

--

From: Ingo Molnar
Date: Monday, September 8, 2008 - 11:01 am

i cherry-picked the whole thing as that's the tested commit. Is that 
fine too?

	Ingo
--

From: Jeremy Fitzhardinge
Date: Monday, September 8, 2008 - 11:14 am

No, because it caused compile-time warnings.  The signatures on sysfs
access functions changed, so that patch will break unless the rest of
the sysfs changes went in.

    J
--

From: Ingo Molnar
Date: Monday, September 8, 2008 - 11:21 am

ok - i've picked up your narrowed patch into tip/x86/urgent.

	Ingo
--

From: Ingo Molnar
Date: Monday, September 8, 2008 - 10:59 am

We could certainly propagate it to x86/urgent, if it fixes a real issue. 
It cherry-picks just fine.

	Ingo
--

From: Jeremy Fitzhardinge
Date: Monday, September 8, 2008 - 11:13 am

The rest of that patch updates the sysfs entries in line with Andi's
changes, but I don't think they're in mainline yet.

The sysfs namespace clash means that Xen balloon and hotplug memory try
to register the same name, which is bad because one of them is going to
lose.

    J
--

Previous thread: [PATCH] x86: move nonx_setup etc from common.c to init_64.c by Yinghai Lu on Friday, September 5, 2008 - 12:58 am. (2 messages)

Next thread: none