Re: 2.6.22-rc4-mm2: GPF during suspend to RAM on HPC nx6325

From: Tejun Heo
Date: Mon Jun 11 2007 - 03:18:20 EST


Hello, Rafael.

Rafael J. Wysocki wrote:
> gregkh-driver-sysfs-use-singly-linked-list-for-sysfs_dirent-tree.patch breaks
> suspend to RAM on HPC nx6325 (x86_64).
>
> With this patch applied I get a general protection fault in mutex_lock+0x15
> (kernel/mutex.c:91), called by sysfs_hash_and_remove() (fs/sysfs/inode.c:298),
> called by threshold_cpu_callback(), called from _cpu_down().

I'm not sure whether this is bug in sysfs or in sysfs handling code in
mce_amd and I can't test mce_amd here. Can you please apply the
attached patch and post the resulting dmesg including oops?

Thanks.

--
tejun
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index 03356e6..96da4aa 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -434,6 +434,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
kobject_set_name(&b->kobj, "misc%i", block);
b->kobj.parent = &per_cpu(threshold_banks, cpu)[bank]->kobj;
b->kobj.ktype = &threshold_ktype;
+ printk("XXX%d registering %s (%p)\n", cpu, kobject_name(&b->kobj), &b->kobj);
err = kobject_register(&b->kobj);
if (err)
goto out_free;
@@ -454,6 +455,7 @@ recurse:

out_free:
if (b) {
+ printk("XXX%d unregistering %s (%p)\n", cpu, kobject_name(&b->kobj), &b->kobj);
kobject_unregister(&b->kobj);
kfree(b);
}
@@ -511,6 +513,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
#else
b->cpus = cpu_core_map[cpu];
#endif
+ printk("XXX%d registering %s (%p)\n", cpu, kobject_name(&b->kobj), &b->kobj);
err = kobject_register(&b->kobj);
if (err)
goto out_free;
@@ -580,6 +583,7 @@ static void deallocate_threshold_block(unsigned int cpu,
return;

list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) {
+ printk("XXX%d unregistering %s (%p)\n", cpu, kobject_name(&pos->kobj), &pos->kobj);
kobject_unregister(&pos->kobj);
list_del(&pos->miscj);
kfree(pos);
@@ -626,6 +630,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
deallocate_threshold_block(cpu, bank);

free_out:
+ printk("XXX%d unregistering %s (%p)\n", cpu, kobject_name(&b->kobj), &b->kobj);
kobject_unregister(&b->kobj);
kfree(b);
per_cpu(threshold_banks, cpu)[bank] = NULL;