From patchwork Wed Dec 28 21:24:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 37273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2094319wrt; Wed, 28 Dec 2022 13:28:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtd0DyTz0w1atZlmdoO9h4pGi9/CHf0jN2YIRW7mS4l6YYFTUeLKUqBVdmcga6Ssid4SOng X-Received: by 2002:a17:906:2842:b0:7c0:cc69:571b with SMTP id s2-20020a170906284200b007c0cc69571bmr20070451ejc.8.1672262929025; Wed, 28 Dec 2022 13:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672262929; cv=none; d=google.com; s=arc-20160816; b=AJR2J6ddg9c3mxF7SePkXfx5ar6gyD/TUzhqZ8Hm1LXRkW7Oz2/tXyW0Wvj8is8zZD tJQ176o6Y6Mm5l3b9RhU3vkwjFjEkkomJ/Q1v2NYOvGu4uaMGO//H5kGosqHm/0EMhiN wrk2VGNCyDxE6v76M3jaF43NsOP7vRIGdQfulqdb8i+lZ6sFUTcjbS7CA96Zq/8MCck5 48iS86EGQXVXod3mlU/8aIE1NC8UFveG+RUdqM2HvTmloiBBHTyr0f97pYY4U1X7XG4x 7IWSSHBMzjFT/Cz14KERV1cYonkZWRNsvds+UkPSSxjg2A8I3JYmDi7n2KXwPgys9fFe kHUw== 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=+v3QWWRoK41v6bXiW3z+p1eWuW4GXFj3gtJ7eMa8p2w=; b=jreKm54xU6Uz3lFDjmC6WT8dFIX7KsoDpgEa0LhOuKeF5XN/K7iWr+vc+0nZHzoC9d 6OmegXxt2Yo2JHXhf4gLW8YKYLylvupoAD4HE0wzuo7xGYs5GDz8MXQefvIjTt8dS5V8 SvgkTUwylkCdD4etTYIZiLqtuY8VD9aM5/AFTqQNhHTU4tOms74/EGWD6J2CGGOoa6ar mYU/iZTwLOEH2CWTVJOTuyovOPScTT/0M6yPEM4OiyF78MdlpZRRjvGIk70Bggp/xKqw DC8Q+BjGqBSdsai5hjpU32D1EU9Von5bqD3RIdejm5kEi8vYp/wAhImVbtjSD3g6Kpcd nLzw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wg1-20020a17090705c100b0081da2722ed5si13880764ejb.448.2022.12.28.13.28.24; Wed, 28 Dec 2022 13:28:49 -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 S231955AbiL1V1a (ORCPT + 99 others); Wed, 28 Dec 2022 16:27:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbiL1V1V (ORCPT ); Wed, 28 Dec 2022 16:27:21 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C82140B7; Wed, 28 Dec 2022 13:27:19 -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 0f873d5bd6ca1cb6; Wed, 28 Dec 2022 22:27:18 +0100 Received: from kreacher.localnet (89-77-51-84.dynamic.chello.pl [89.77.51.84]) (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 7C12F780AF8; Wed, 28 Dec 2022 22:27:17 +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: Linux PM Cc: Pratyush Yadav , LKML , Linux ACPI , Srinivas Pandruvada Subject: [PATCH v2 2/3] ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily Date: Wed, 28 Dec 2022 22:24:10 +0100 Message-ID: <4798709.31r3eYUQgx@kreacher> In-Reply-To: <12138067.O9o76ZdvQC@kreacher> References: <12138067.O9o76ZdvQC@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 89.77.51.84 X-CLIENT-HOSTNAME: 89-77-51-84.dynamic.chello.pl X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedriedvgdduhedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeekledrjeejrdehuddrkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeelrdejjedrhedurdekgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehpthihrggurghvsegrmhgriihonhdruggvpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghs rdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753494773279560176?= X-GMAIL-MSGID: =?utf-8?q?1753494773279560176?= From: Rafael J. Wysocki Modify acpi_processor_get_platform_limit() to avoid updating its frequency QoS request when the _PPC return value has not changed by comparing that value to the previous _PPC return value stored in the performance_platform_limit field of the struct acpi_processor corresponding to the given CPU. While at it, do the _PPC return value check against the state count earlier to avoid setting performance_platform_limit to an invalid value. Signed-off-by: Rafael J. Wysocki --- v1 -> v2: * New patch. * Contains some changes from the previous [1/2] and a change to reset performance_platform_limit on QoS request creation. --- drivers/acpi/processor_perflib.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) Index: linux-pm/drivers/acpi/processor_perflib.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_perflib.c +++ linux-pm/drivers/acpi/processor_perflib.c @@ -76,13 +76,16 @@ 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, index, index ? "is" : "is not"); 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; /* @@ -178,6 +181,13 @@ void acpi_processor_ppc_init(struct cpuf if (!pr) continue; + /* + * Reset performance_platform_limit in case there is a stale + * value in it, so as to make it match the "no limit" QoS value + * below. + */ + pr->performance_platform_limit = 0; + ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req, FREQ_QOS_MAX, INT_MAX);