Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3480312rwl; Tue, 27 Dec 2022 09:43:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsurOrbv2BGM0WEi6McMc4KuqiIftKNdf4d6GfZ+gn7sWCSV30aOZIKVf+4eeGAAvboGfi6 X-Received: by 2002:a05:6a00:24cd:b0:581:4260:a650 with SMTP id d13-20020a056a0024cd00b005814260a650mr12717730pfv.33.1672163033083; Tue, 27 Dec 2022 09:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672163033; cv=none; d=google.com; s=arc-20160816; b=t3IjeFIwb6k5ne/TyehlZr60wcZPCc5f/zeKLmaSW4F2bLgNMMoPmWGP9e4ss+u0E+ yvpykR9lXK6SdT61ZD1tnPwS/nGni2eALBUQpca7ypzOP4DnF5DRXX/2ILJg+XA0V9Ts Be0H4TTGMIwtJ+4kW/Qph3o4ySZj8FcFAu4Z9W1hByI92I1l6MXLwS5YNt+LXAbAAD8X WS+Yy2oYDHIsgfVkjr9euezQhZuzkD3L3vr01Dx8p9k/HeKC2pLsAYVqbRF29MdIXdCM kHwzucwR6kiIQjN5ahoITLyFSizpX/76b6dxlURcseyovDmo/XXF7Ec+4bcem1Z66zDD W73g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=H/RwjYpgY9LMhkdAhp66BnBdhHcuCuELaNFppMThpbU=; b=uGyZVZBTugAinJKBZ21dLI6QbtNjYz96bxm3+MC9CEcSXtNYG14YHpZ3/y4aOPZIgH t5yh6QA2GlHR9L0nW5n0vyGzk1gakNKKGW+VfAxq4jXCwhylEfc9X8Y+NM//Jj24Fxyt Gi8e7PJRn4Zd2XCmtxJXS5Jy+ffOec4G7L8QMzax6BTrJr9AssXVtGSqhkmQgdhfD3Gz MpBfggZCbzdL3xep/us3C6dn1h1pd657JGEkbpcq4SH6FnE/pT/PqIF7VyonLQinUQRk SMc2EbWauqsiXL+RFFkIp+LECNoN4kM8QRyr6JVICe+WbIJOOYVzSAB54az7FBiFma11 T/uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056a00190400b0057fdee40d48si15108030pfi.173.2022.12.27.09.43.44; Tue, 27 Dec 2022 09:43:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbiL0ROM (ORCPT + 66 others); Tue, 27 Dec 2022 12:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbiL0ROG (ORCPT ); Tue, 27 Dec 2022 12:14:06 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81317BF7F; Tue, 27 Dec 2022 09:14:00 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id e63fe3dbb9936d4b; Tue, 27 Dec 2022 18:13:58 +0100 Received: from kreacher.localnet (unknown [213.134.183.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 92CD428A349B; Tue, 27 Dec 2022 18:13:57 +0100 (CET) Authentication-Results: v370.home.net.pl; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: v370.home.net.pl; spf=fail smtp.mailfrom=rjwysocki.net From: "Rafael J. Wysocki" To: srinivas pandruvada , "Rafael J. Wysocki" Cc: Pratyush Yadav , linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Viresh Kumar , Robert Moore , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org Subject: Re: [PATCH 0/2] intel_pstate: fix turbo not being used after a processor is rebooted Date: Tue, 27 Dec 2022 18:13:56 +0100 Message-ID: <12136852.O9o76ZdvQC@kreacher> In-Reply-To: References: <20221221155203.11347-1-ptyadav@amazon.de> <33dd969d9bdb1eb93f8f2a2167efeb535455cf74.camel@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.183.5 X-CLIENT-HOSTNAME: 213.134.183.5 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedriedtgdeljecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudekfedrheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeefrdehpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduuddprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehpthihrggurghvsegrmhgriihonhdruggvpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhgvnhgssehk vghrnhgvlhdrohhrghdprhgtphhtthhopehvihhrvghshhdrkhhumhgrrheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggvvhgvlhesrggtphhitggrrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=11 Fuz1=11 Fuz2=11 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, December 27, 2022 6:02:50 PM CET Rafael J. Wysocki wrote: > On Tue, Dec 27, 2022 at 5:40 PM srinivas pandruvada > wrote: > > > > On Tue, 2022-12-27 at 16:38 +0100, Pratyush Yadav wrote: > > > Hi Srinivas, > > > > > > On Sat, Dec 24 2022, srinivas pandruvada wrote: > > > > > > > On Fri, 2022-12-23 at 10:10 -0800, srinivas pandruvada wrote: > > > > > Hi Pratyush, > > > > > > > > > > On Thu, 2022-12-22 at 11:39 +0100, Pratyush Yadav wrote: > > > > > > > > > > > > Hi Srinivas, > > > > > > > > > > > > On Wed, Dec 21 2022, srinivas pandruvada wrote: > > > > > > > On Wed, 2022-12-21 at 16:52 +0100, Pratyush Yadav wrote: > > > > > > > > When a processor is brought offline and online again, it is > > > > > > > > unable to > > > > > > > > use Turbo mode because the _PSS table does not contain the > > > > > > > > whole > > > > > > > > turbo > > > > > > > > frequency range, but only +1 MHz above the max non-turbo > > > > > > > > frequency. > > > > > > > > This > > > > > > > > causes problems when ACPI processor driver tries to set > > > > > > > > frequency > > > > > > > > constraints. See patch 2 for more details. > > > > > > > > > > > > > I can reproduce on a Broadwell server platform. But not on a > > > > > client > > > > > system with acpi_ppc usage. > > > > > > > > > > Need to check what change broke this. > > > > > > > > When PPC limits enforcement changed to PM QOS, this broke. > > > > Previously > > > > acpi_processor_get_platform_limit() was not enforcing any limits. > > > > It > > > > was just setting variable. So any update done after > > > > acpi_register_performance_state() call to pr->performance- > > > > > states[ppc].core_frequency, was effective. > > > > > > > > We don't really need to call > > > > ret = freq_qos_update_request(&pr->perflib_req, > > > > pr->performance->states[ppc].core_frequency > > > > * > > > > 1000); > > > > > > > > if the PPC is not changed. When PPC is changed, this gets called > > > > again, > > > > so then we can call the above function to update cpufreq limit. > > > > > > > > The below change fixed for me. > > > > > > Right. > > I think, this is the only change you require to fix this. In addition > > set pr->performance_platform_limit = 0 in > > acpi_processor_unregister_performance(). > > Not really, because if the limit is set to a lower frequency and then > reset to _PSS[0], it needs to be set back to "no limit". > > I'll send a patch for that in a while. This has not been tested beyond compilation, so please be careful. --- drivers/acpi/processor_perflib.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) Index: linux-pm/drivers/acpi/processor_perflib.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_perflib.c +++ linux-pm/drivers/acpi/processor_perflib.c @@ -53,6 +53,8 @@ static int acpi_processor_get_platform_l { acpi_status status = 0; unsigned long long ppc = 0; + s32 qos_value; + int index; int ret; if (!pr) @@ -72,17 +74,30 @@ static int acpi_processor_get_platform_l } } + index = ppc; + + if (pr->performance_platform_limit == index || + ppc >= pr->performance->state_count) + return 0; + pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id, - (int)ppc, ppc ? "" : "not"); + index, index ? "is" : "is not"); - pr->performance_platform_limit = (int)ppc; + pr->performance_platform_limit = index; - if (ppc >= pr->performance->state_count || - unlikely(!freq_qos_request_active(&pr->perflib_req))) + if (unlikely(!freq_qos_request_active(&pr->perflib_req))) return 0; - ret = freq_qos_update_request(&pr->perflib_req, - pr->performance->states[ppc].core_frequency * 1000); + /* + * If _PPC returns 0, it means that all of the available states can be + * used ("no limit"). + */ + if (index == 0) + qos_value = FREQ_QOS_MAX_DEFAULT_VALUE; + else + qos_value = pr->performance->states[index].core_frequency * 1000; + + ret = freq_qos_update_request(&pr->perflib_req, qos_value); if (ret < 0) { pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n", pr->id, ret);