2.6.27-rc5 xen balloon driver warnings
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>] 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
SCSI subsystem initialized
Quoted 4 lines · Rambaldi
Hi,
when running the 2.6.27-rc5 kernel as 64 bits dumU I get the following warnings:
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
--- drivers/xen/balloon.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
===================================================================
drivers/xen/balloon.c +12 -15
@@ -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 sysdev_attribute *attr, +char *buf) {return sprintf (buf,"%lu\n" ,PAGES2KB (balloon_stats.target_pages)); }
@@ -614,19 +615,14 @@const char *buf, size_t count) { - char memstring[64], *endchar; + char *endchar;unsigned long long target_bytes;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (count <=1 ) -return -EBADMSG ;/* runt */ -if (count >sizeof (memstring)) -return -EFBIG ;/* too long */ -strcpy (memstring, buf); + target_bytes =memparse (buf, &endchar); - target_bytes =memparse (memstring, &endchar);balloon_set_new_target (target_bytes >>PAGE_SHIFT );return count;
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 4 lines · Rambaldi
Hi,
when running the 2.6.27-rc5 kernel as 64 bits dumU I get the following warnings:
Quoted 10 lines
This patch, change
167e6cf62979df03513898966f9227847d192327in 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
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.
Quoted 1 line · Rambaldi
I used the complete patch, I had some compile warnings.
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.
===================================================================
drivers/xen/balloon.c +1 -1
@@ -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'. */
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 4 lines · Rambaldi
Hi,
when running the 2.6.27-rc5 kernel as 64 bits dumU I get the following warnings:
Quoted 6 lines
This patch, change
167e6cf62979df03513898966f9227847d192327in 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.
We could certainly propagate it to x86/urgent, if it fixes a real issue. It cherry-picks just fine.
Ingo
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 1 line · Rambaldi
I used the complete patch, I had some compile warnings.
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.
i cherry-picked the whole thing as that's the tested commit. Is that fine too?
Ingo
Quoted 14 lines · Ingo Molnar
Quoted 11 lines · Jeremy Fitzhardinge
Quoted 5 lines · Rambaldi
Hi,
when running the 2.6.27-rc5 kernel as 64 bits dumU I get the following warnings:
This patch, change
167e6cf62979df03513898966f9227847d192327in tip.git, should fix this. I'm not sure if the other sysfs changes apply to mainline git or not.
Quoted 7 lines
Quoted 3 lines
Could you try this and see how it goes? The first chunk should be sufficient to fix your problem.
We could certainly propagate it to x86/urgent, if it fixes a real issue. It cherry-picks just fine.
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
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Jeremy Fitzhardinge
Quoted 2 lines · Rambaldi
I used the complete patch, I had some compile warnings.
Quoted 8 lines
Quoted 5 lines
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.
i cherry-picked the whole thing as that's the tested commit. Is that fine too?
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
Quoted 14 lines · Jeremy Fitzhardinge
Quoted 13 lines · Ingo Molnar
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 2 lines · Rambaldi
I used the complete patch, I had some compile warnings.
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.
Quoted 6 lines
Quoted 2 lines
i cherry-picked the whole thing as that's the tested commit. Is that fine too?
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.
ok - i've picked up your narrowed patch into tip/x86/urgent.
Ingo