diff mbox series

[4.19,156/191] powerpc: Warn about use of smt_snooze_delay

Message ID 20201103203247.174991659@linuxfoundation.org
State Superseded
Headers show
Series None | expand

Commit Message

Greg Kroah-Hartman Nov. 3, 2020, 8:37 p.m. UTC
From: Joel Stanley <joel@jms.id.au>


commit a02f6d42357acf6e5de6ffc728e6e77faf3ad217 upstream.

It's not done anything for a long time. Save the percpu variable, and
emit a warning to remind users to not expect it to do anything.

This uses pr_warn_once instead of pr_warn_ratelimit as testing
'ppc64_cpu --smt=off' on a 24 core / 4 SMT system showed the warning
to be noisy, as the online/offline loop is slow.

Fixes: 3fa8cad82b94 ("powerpc/pseries/cpuidle: smt-snooze-delay cleanup.")
Cc: stable@vger.kernel.org # v3.14
Signed-off-by: Joel Stanley <joel@jms.id.au>

Acked-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Link: https://lore.kernel.org/r/20200902000012.3440389-1-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


---
 arch/powerpc/kernel/sysfs.c |   42 +++++++++++++++++-------------------------
 1 file changed, 17 insertions(+), 25 deletions(-)

Comments

Pavel Machek Nov. 5, 2020, 7:23 p.m. UTC | #1
Hi!

> From: Joel Stanley <joel@jms.id.au>

> 

> commit a02f6d42357acf6e5de6ffc728e6e77faf3ad217 upstream.

> 

> It's not done anything for a long time. Save the percpu variable, and

> emit a warning to remind users to not expect it to do anything.

> 

> This uses pr_warn_once instead of pr_warn_ratelimit as testing

> 'ppc64_cpu --smt=off' on a 24 core / 4 SMT system showed the warning

> to be noisy, as the online/offline loop is slow.


I don't believe this is good idea for stable. It is in 5.9-rc2, and
likely mainline users will get userspace fixed, but that warning is
less useful for -stable users.

(And besides, it does not fix any serious bug).

Best regards,
								Pavel

-- 
http://www.livejournal.com/~pavelmachek
Joel Stanley Nov. 5, 2020, 11:44 p.m. UTC | #2
On Thu, 5 Nov 2020 at 19:24, Pavel Machek <pavel@ucw.cz> wrote:
>

> Hi!

>

> > From: Joel Stanley <joel@jms.id.au>

> >

> > commit a02f6d42357acf6e5de6ffc728e6e77faf3ad217 upstream.

> >

> > It's not done anything for a long time. Save the percpu variable, and

> > emit a warning to remind users to not expect it to do anything.

> >

> > This uses pr_warn_once instead of pr_warn_ratelimit as testing

> > 'ppc64_cpu --smt=off' on a 24 core / 4 SMT system showed the warning

> > to be noisy, as the online/offline loop is slow.

>

> I don't believe this is good idea for stable. It is in 5.9-rc2, and

> likely mainline users will get userspace fixed, but that warning is

> less useful for -stable users.


The warning is about the existing behaviour of the kernel. It does let
the user know that they won't see any difference in behaviour when
tweaking the smt_snooze_delay variable, which was a real issue that
Anton hit.

I agree that the future commit that removes smt_snooze_delay from the
kernel should not be backported.

Cheers,

Joel

>

> (And besides, it does not fix any serious bug).

>

> Best regards,

>                                                                 Pavel

>

> --

> http://www.livejournal.com/~pavelmachek
diff mbox series

Patch

--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -29,29 +29,27 @@ 
 
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
-/*
- * SMT snooze delay stuff, 64-bit only for now
- */
-
 #ifdef CONFIG_PPC64
 
-/* Time in microseconds we delay before sleeping in the idle loop */
-static DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
+/*
+ * Snooze delay has not been hooked up since 3fa8cad82b94 ("powerpc/pseries/cpuidle:
+ * smt-snooze-delay cleanup.") and has been broken even longer. As was foretold in
+ * 2014:
+ *
+ *  "ppc64_util currently utilises it. Once we fix ppc64_util, propose to clean
+ *  up the kernel code."
+ *
+ * powerpc-utils stopped using it as of 1.3.8. At some point in the future this
+ * code should be removed.
+ */
 
 static ssize_t store_smt_snooze_delay(struct device *dev,
 				      struct device_attribute *attr,
 				      const char *buf,
 				      size_t count)
 {
-	struct cpu *cpu = container_of(dev, struct cpu, dev);
-	ssize_t ret;
-	long snooze;
-
-	ret = sscanf(buf, "%ld", &snooze);
-	if (ret != 1)
-		return -EINVAL;
-
-	per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
+	pr_warn_once("%s (%d) stored to unsupported smt_snooze_delay, which has no effect.\n",
+		     current->comm, current->pid);
 	return count;
 }
 
@@ -59,9 +57,9 @@  static ssize_t show_smt_snooze_delay(str
 				     struct device_attribute *attr,
 				     char *buf)
 {
-	struct cpu *cpu = container_of(dev, struct cpu, dev);
-
-	return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
+	pr_warn_once("%s (%d) read from unsupported smt_snooze_delay\n",
+		     current->comm, current->pid);
+	return sprintf(buf, "100\n");
 }
 
 static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
@@ -69,16 +67,10 @@  static DEVICE_ATTR(smt_snooze_delay, 064
 
 static int __init setup_smt_snooze_delay(char *str)
 {
-	unsigned int cpu;
-	long snooze;
-
 	if (!cpu_has_feature(CPU_FTR_SMT))
 		return 1;
 
-	snooze = simple_strtol(str, NULL, 10);
-	for_each_possible_cpu(cpu)
-		per_cpu(smt_snooze_delay, cpu) = snooze;
-
+	pr_warn("smt-snooze-delay command line option has no effect\n");
 	return 1;
 }
 __setup("smt-snooze-delay=", setup_smt_snooze_delay);