From patchwork Tue Nov 3 20:36:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 320460 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp4906644ilc; Tue, 3 Nov 2020 13:00:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPc0ZWAAAGSyh4nEJ3dwlu6RwMP3gmIFJnlrHTFbhMdwEVv7Z4Hny72xqTgwz1diWc1+ne X-Received: by 2002:a17:906:af47:: with SMTP id ly7mr23180389ejb.532.1604437222164; Tue, 03 Nov 2020 13:00:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437222; cv=none; d=google.com; s=arc-20160816; b=CGs/0XUJ3fTHF7s9InYhGe8G5qkcQ5r7g3ugLhh525pGGx8AQ/QPGK0cKHwy80DmLU cFHsIoMPmRSbpPckt5KFJI9jFhINmMtDjXzmMH9LqV8VS+e3JZE3Hhcggc3lqSLF4dQk k/Vc/4y6cAbAOcfRmmornFnpSvNM8ODajU/sfXlBe+Nxe6xI07tkDHwdOBZrtosLDB3g mVZjFUbJkgrliSjGP7Pm/Um+qxCqaU6/YgIt8Ts7e4gsDfH3vQdkeNdOSH5yuFzUziGI iPdW8mY2GHuUcYUnieM5ILCCvwR9n/xViTZNyawAUZqK/VOfZy7H3T+8HHfZRH+lh80+ CqIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=utOah7VuURUFnVAqkf34qFpz//QhP/oiaO1esxXVAQo=; b=PT0VcvXD8v4dEf5nLucvkD5yAVD7r/WLoKHr3At9tB/EsRdQ6U5Yk0PBEI29H6ryJo 4apMD5XfzQStdFjO8ojjOam8z9p8mtb+W8xH9uK+GRWkhHv1pGyb+JOEIYgVbovkZFSV RPUNGzRAI5Pf0zuxC1UH1cKpD/EFeZgO4wh770RXpOgCHT4Y6enQnm/M1Q1d9mXNN20c RfcUKY9msaAZH/G7fyIuSX5dPR1plBFE33xpgSIp5FCSiBiDNByLESfvlrfd1QJctEDu iMw3rKugF0T5afwRVL/sOdIYqaKZBOZEu7WuDJiEDlOJUDfRFxQXwlbMnb0Ml8UjrIdQ YDnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zfsYjFWy; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x27si33231ejf.95.2020.11.03.13.00.21; Tue, 03 Nov 2020 13:00:22 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zfsYjFWy; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733204AbgKCVAT (ORCPT + 15 others); Tue, 3 Nov 2020 16:00:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:35970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733199AbgKCVAT (ORCPT ); Tue, 3 Nov 2020 16:00:19 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EFDA722226; Tue, 3 Nov 2020 21:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437218; bh=UZwC1BRGNu+cfL6LMrplE7QsUP/WDAzBR/EDPltJrmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zfsYjFWyt162tA6mEJkOgz2kvgXgX0bHFbGaHIZ5ISBADAihJnl77sR8GuVk9i/j+ ugscZhGEQTuMDhMZJo4My44PVtAOG0At8zX5zuiblI6auZSExdPZGHnjP19o95Klug e5R9o/ltJDyHYNQcrWISUVfQgPRCAWjK1DnEt+c0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , "Gautham R. Shenoy" , Michael Ellerman Subject: [PATCH 5.4 159/214] powerpc: Warn about use of smt_snooze_delay Date: Tue, 3 Nov 2020 21:36:47 +0100 Message-Id: <20201103203305.693586293@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Joel Stanley 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 Acked-by: Gautham R. Shenoy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20200902000012.3440389-1-joel@jms.id.au Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/sysfs.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -31,29 +31,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; } @@ -61,9 +59,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, @@ -71,16 +69,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);