Skip to contentSkip to conversation

kobject handling in cpufreq

REGRESSION Balaji Rao 2 participants 2 messages Feb 8, 2008 CPU frequency scaling framework

lore
Share & tools
lore

Balaji Rao

author
#0 lore raw

Hi greg,

I encountered a regression in linux-2.6.git which prevented the system from shutting down. I found that it was 'waiting_for_completion' on kobj_unregister.The same thing happened when I tried to take CPUs offline.

git-bisect pointed me to this commit :

commit c10997f6575f476ff38442fa18fd4a0d80345f9d

Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Dec 20 08:13:05 2007 -0800

Kobject: convert drivers/* from kobject_unregister() to kobject_put()

In the file drivers/cpufreq/cpufreq.c, you have not replaced one occurrence of kobject_unregister with kobject_put. Apparently its because of the kobject_put in the subsequent line.

@@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)

        unlock_policy_rwsem_write(cpu);

- kobject_unregister(&data->kobj);
-

        kobject_put(&data->kobj);
 
        /* we need to make sure that the underlying kobj is actually

Now, this can be fixed by adding another kobject_put. But having two kobject_puts in consequent lines tells us that there should be two references to the kobject at that point. So, I believe that it is safe to remove the kobject_get corresponding to the existing kobject_put to fix this.

drivers/cpufreq/cpufreq.c +0 -11
index 64926aa..2158786 100644
@@ -1004,17 +1004,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
 		unlock_policy_rwsem_write(cpu);
 		return 0;
 	}
-#endif
-
-
-	if (!kobject_get(&data->kobj)) {
-		spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
-		cpufreq_debug_enable_ratelimit();
-		unlock_policy_rwsem_write(cpu);
-		return -EFAULT;
-	}
-
-#ifdef CONFIG_SMP
 
 #ifdef CONFIG_HOTPLUG_CPU
 	cpufreq_cpu_governor[cpu] = data->governor;
Signature · 2 lines
regards,
balaji rao
Acked-by
#1 lore raw
Quoted 26 lines · Balaji Rao

Hi greg,

I encountered a regression in linux-2.6.git which prevented the system from shutting down. I found that it was 'waiting_for_completion' on kobj_unregister.The same thing happened when I tried to take CPUs offline.

git-bisect pointed me to this commit :

commit c10997f6575f476ff38442fa18fd4a0d80345f9d

Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Dec 20 08:13:05 2007 -0800

Kobject: convert drivers/* from kobject_unregister() to kobject_put()

In the file drivers/cpufreq/cpufreq.c, you have not replaced one occurrence of kobject_unregister with kobject_put. Apparently its because of the kobject_put in the subsequent line.

(quoted diff) +0 -2
@@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
 
        unlock_policy_rwsem_write(cpu);
 
-       kobject_unregister(&data->kobj);
-
        kobject_put(&data->kobj);
 
        /* we need to make sure that the underlying kobj is actually
Quoted 5 lines

Now, this can be fixed by adding another kobject_put. But having two kobject_puts in consequent lines tells us that there should be two references to the kobject at that point. So, I believe that it is safe to remove the kobject_get corresponding to the existing kobject_put to fix this.

This looks correct to me, nice catch.

thanks,

greg k-h