Skip to contentSkip to conversation

powerpc: warn users of smt-snooze-delay that the API isn't there anymore

PATCH In review Cody P Schafer 5 participants 6 messages Feb 22, 2014 – Feb 26, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: warn users of smt-snooze-delay that the API isn't there anymore

/sys/devices/system/cpu/cpu*/smt-snooze-delay was converted into a NOP in commit 3fa8cad82b94d0bed002571bd246f2299ffc876b, and now does nothing. Add a pr_warn() to convince any users that they should stop using it.

The commit message from the removing commit notes that this functionality should move into the cpuidle driver, essentially by adjusting target_residency to the specified value. At the moment, target_residency is not exposed by cpuidle's sysfs, so there isn't a drop in replacement for this.

---
 arch/powerpc/kernel/sysfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/kernel/sysfs.c +6 -0
index 97e1dc9..84097b4 100644
@@ -50,6 +50,9 @@ static ssize_t store_smt_snooze_delay(struct device *dev,
 	if (ret != 1)
 		return -EINVAL;
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
 	return count;
 }
@@ -60,6 +63,9 @@ static ssize_t show_smt_snooze_delay(struct device *dev,
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
 }
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 7 lines · Cody P Schafer

/sys/devices/system/cpu/cpu*/smt-snooze-delay was converted into a NOP in commit 3fa8cad82b94d0bed002571bd246f2299ffc876b, and now does nothing. Add a pr_warn() to convince any users that they should stop using it.

The commit message from the removing commit notes that this functionality should move into the cpuidle driver, essentially by

Would prefer to cleanup the code since the functionality is moved, instead of adding to it.

Quoted 34 lines

adjusting target_residency to the specified value. At the moment, target_residency is not exposed by cpuidle's sysfs, so there isn't a drop in replacement for this.

---
 arch/powerpc/kernel/sysfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/kernel/sysfs.c +6 -0
index 97e1dc9..84097b4 100644
@@ -50,6 +50,9 @@ static ssize_t store_smt_snooze_delay(struct device *dev,
 	if (ret != 1)
 		return -EINVAL;
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
 	return count;
 }
@@ -60,6 +63,9 @@ static ssize_t show_smt_snooze_delay(struct device *dev,
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
 }
 
#2 lore raw
Quoted 11 lines · Madhavan Srinivasan
Quoted 7 lines · Cody P Schafer

/sys/devices/system/cpu/cpu*/smt-snooze-delay was converted into a NOP in commit 3fa8cad82b94d0bed002571bd246f2299ffc876b, and now does nothing. Add a pr_warn() to convince any users that they should stop using it.

The commit message from the removing commit notes that this functionality should move into the cpuidle driver, essentially by

Would prefer to cleanup the code since the functionality is moved, instead of adding to it.

We'd still want users of the interface to use an attribute wired up under the cpuidle/ dir, so a warning (to update their software) is still needed. As deepthi has noted, cpuidle right now doesn't support changing this on a per-cpu basis, so a "cleanup" isn't a simple matter.

#3 lore raw
In reply to Cody P Schafer
Quoted 5 lines · Cody P Schafer

/sys/devices/system/cpu/cpu*/smt-snooze-delay was converted into a NOP in commit 3fa8cad82b94d0bed002571bd246f2299ffc876b, and now does nothing. Add a pr_warn() to convince any users that they should stop using it.

Quoted 7 lines

The commit message from the removing commit notes that this functionality should move into the cpuidle driver, essentially by adjusting target_residency to the specified value. At the moment, target_residency is not exposed by cpuidle's sysfs, so there isn't a drop in replacement for this.

smt-snooze-delay was used to delay an entry into NAP state or disable NAP state completely. This was before we adopted cpuidle framework for idle state management on powerpc. This is per-cpu based tunable, where we could have cores with different target residencies and idle states.

Now that we have moved towards cpuidle framework, which provides a better way of idle state management and this framework expects a single target residency for all the cpus. We can no longer honour smt-snooze-delay functionality of providing per-cpu target residency. This was badly broken in the kernel before the patch to clean it up. By removing this we would honour cpuidle framework through which we carry out idle state management.

And generic cpuidle framework does not provide the flexibility to change target residency on the go as there are multiple idle states supported and trying to change target residency of one state (incorrectly) may result in undefined behavior.

Also, the second functionality to disable/enable states can be done using the cpuidle sysfs files. So this is functionality is preserved.

We currently do not use smt-snooze-delay in the kernel.
The sysfs entries needs to be retained until we do a clean up ppc64_cpu util that uses these entries to determine SMT,
clean up patch for this has already been posted out by Prerna. Once, we have the ppc64_cpu changes in, we can look to clean up these parts from the kernel.

Regards,
Deepthi

Quoted 29 lines
---
 arch/powerpc/kernel/sysfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/kernel/sysfs.c +6 -0
index 97e1dc9..84097b4 100644
@@ -50,6 +50,9 @@ static ssize_t store_smt_snooze_delay(struct device *dev,
 	if (ret != 1)
 		return -EINVAL;
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
 	return count;
 }
@@ -60,6 +63,9 @@ static ssize_t show_smt_snooze_delay(struct device *dev,
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
 
+	pr_warn_ratelimited("%s (%d): /sys/devices/system/cpu/cpu%d/smt-snooze-delay is deprecated and is a NOP\n",
+		  current->comm, task_pid_nr(current), cpu->dev.id);
+
 	return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
 }
 
#4 lore raw
Quoted 7 lines · Deepthi Dharwar

We currently do not use smt-snooze-delay in the kernel. The sysfs entries needs to be retained until we do a clean up ppc64_cpu
util that uses these entries to determine SMT,
clean up patch for this has already been posted out by Prerna. Once, we have the ppc64_cpu changes in, we can look to clean up these parts from the kernel.

We generally shouldn't change user visible interfaces.

People still have old versions of ppc64_cpu, we must not break them

Cheers,
Ben.

#5 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Deepthi Dharwar

We currently do not use smt-snooze-delay in the kernel. The sysfs entries needs to be retained until we do a clean up ppc64_cpu
util that uses these entries to determine SMT,
clean up patch for this has already been posted out by Prerna. Once, we have the ppc64_cpu changes in, we can look to clean up these parts from the kernel.

Quoted 3 lines

We generally shouldn't change user visible interfaces.

People still have old versions of ppc64_cpu, we must not break them

Yeah we can't remove the file entirely, at least for a few more years.

ppc64_cpu should never have used that file to determine if a cpu existed, but it did, so we're stuck with it.

What we can do is remove the unused percpu, and just leave the file in sysfs, and have it print a warning when anyone touches it.

cheers