Skip to contentSkip to conversation

cpufreq and sysfs problem...

OOPS Andrew Morton 3 participants 3 messages Sep 24, 2003 – Oct 28, 2003 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

OK, thanks. I've copied the cpurfeq guys; hopefully they can fix this one up.

Begin forwarded message:

Date: Wed, 24 Sep 2003 23:33:18 +0100
From: Ashley Pittman <[email protected]>
To: Andrew Morton <[email protected]>
Subject: Re: [OOPS] [2.6.0-test5-bk8] cpufreq and sysfs problem...

Hi,

This problem is entirely reproducible for me, rather than describe it i'm sending you a script that provokes it. The chip is a via C3 so the longhaul module inserts properly and kinda works.

I suspect the problem is the 'cpufreq_userspace' module not increasing the ref count of the cpufreq directory but it's also possible the problem lies with the sysfs code itself, I can't see any notes about refcounting in the sysfs documentation so I'm not really sure where the answer lies.

In case your not familar with the cpufreq code the longhaul driver creates the sysfs directory, the cpufreq_longhaul module creates a file
in that directory. When the longhaul module is remove the directory
should also go but that leaves the file with nowhere to go.

The problem still persists with the latest 2.6.0-test5-bk11 patch.

Ashley,

#!/bin/sh
modprobe longhaul
modprobe cpufreq_userspace
cd /sys/devices/system/cpu/cpu0/cpufreq
echo userspace > scaling_governor
ls scaling_setspeed
# This doesnt fail but look at the $PWD...
rmmod longhaul
# Note the $PWD is empty...
cd
modprobe longhaul
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor # This next line segv's, oops the kernel and makes future 'lsmod' hang rmmod longhaul

#1 lore raw

Thanks for noticing this. Attached patch [for 2.6.0-test6-bk] should fix it.

Dominik

drivers/cpufreq/cpufreq.c +3 -3
diff -ruN linux-original/drivers/cpufreq/cpufreq.c linux/drivers/cpufreq/cpufreq.c
@@ -449,6 +449,9 @@
 	if (!kobject_get(&data->kobj))
 		return -EFAULT;
 
+	if (cpufreq_driver->target)
+		__cpufreq_governor(data, CPUFREQ_GOV_STOP);
+
 	kobject_unregister(&data->kobj);
 
 	kobject_put(&data->kobj);
@@ -459,9 +462,6 @@
 	 */
 	wait_for_completion(&data->kobj_unregister);
 
-	if (cpufreq_driver->target)
-		__cpufreq_governor(data, CPUFREQ_GOV_STOP);
-
 	if (cpufreq_driver->exit)
 		cpufreq_driver->exit(data);
#2 lore raw
Quoted 1 line · Dominik Brodowski

Thanks for noticing this. Attached patch [for 2.6.0-test6-bk] should fix it.

Apologies for the delay, this did fix it.

Ashley,

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

---
Ashley Pittman
[email protected]