From patchwork Fri Mar 17 16:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 71363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp455596wrt; Fri, 17 Mar 2023 10:07:24 -0700 (PDT) X-Google-Smtp-Source: AK7set8fxUlXcYKrzAi5PRklGbCjMgaZB4tiwdVvrX0dnGH0F5gHCBzKYHXSepZHPzrU4zLMUIHV X-Received: by 2002:a05:6a00:3186:b0:5a9:cebd:7b79 with SMTP id bj6-20020a056a00318600b005a9cebd7b79mr7390063pfb.0.1679072844140; Fri, 17 Mar 2023 10:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679072844; cv=none; d=google.com; s=arc-20160816; b=YWXQkywiG4L6AtBktr/JcL8iaX8zZqq16D/nt5VnplVQbC1Av0jn/SZBrlq7SxgClU 6ggsV/qSz1MrVHv5wP+hVSuczObC7G+HqM/+UpbJYJIQhmusTp+C0WCfftm/JqF9kB2D invBcEAM2MSlRmFZBwj5g+obkIA3rr8EJJDKFgWrtoX6tuJwDvU5er5eU8nHJWYajjta gyxoEjcQnUz9M4/BIo9jAriHvUj/UA/KR2aDmqfNkRBnmcghfbH7yVa5RbbJQMeiszv7 Of4ZAGI2Wne90uHYJtjuE5MzRGaPfN06jymYenxZLA2Lm5xaPyvpTdefqliGIoDfAtxd /tlQ== 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=a9mVetYV0f9QF0Nlgk1Nwc4XeT0xXTgsjUvv5mhWLms=; b=wshlxnh52pR7OL4GAwvNa07Z9HqHJJs6stelBcZUf1cVpckXdQYl63o1OLXFzBc3l0 0OLy+Y5jCm1+T13y340duK3oPSsxC6jU4e1ZbKaarkuf9sS0K+35RmYANDg8Um2v9rzW 4npDdNmc7OhUvE1Soy2xtLc8MQpGVNauhFvCYoWJ6/bNvRcIbMd9rP5Kiqnb4zfL098O MyzwSXSmRUokRfyDEJDvDhWwXPR0ooXxKiyVoG/m+6Xn50kiJPacNvq/yn7eMkVVR0lp 7PUPahDAsGRvyHNN8N02F4iGa95V3+7MJH+FP+YEdSXZdmsBYpBeZnT6zISAMmccvwbf qDEA== 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 g2-20020a056a000b8200b0058dc3db12fasi2975124pfj.351.2023.03.17.10.07.09; Fri, 17 Mar 2023 10:07:24 -0700 (PDT) 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 S230147AbjCQRE1 (ORCPT + 99 others); Fri, 17 Mar 2023 13:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbjCQRES (ORCPT ); Fri, 17 Mar 2023 13:04:18 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B54DEB45; Fri, 17 Mar 2023 10:04:16 -0700 (PDT) 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 57340b30ceae3cd7; Fri, 17 Mar 2023 18:04:15 +0100 Received: from kreacher.localnet (unknown [213.134.163.228]) (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 3B73A1C52C22; Fri, 17 Mar 2023 18:04:14 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Linux ACPI , LKML , Daniel Lezcano , Srinivas Pandruvada , Viresh Kumar , Quanxian Wang Subject: [PATCH v3 1/4] ACPI: processor: Reorder acpi_processor_driver_init() Date: Fri, 17 Mar 2023 17:52:33 +0100 Message-ID: <4819760.31r3eYUQgx@kreacher> In-Reply-To: <2678096.mvXUDI8C0e@kreacher> References: <2678096.mvXUDI8C0e@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.163.228 X-CLIENT-HOSTNAME: 213.134.163.228 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdefvddgleehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepfeduudeutdeugfelffduieegiedtueefledvjeegffdttefhhffhtefhleejgfetnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepvddufedrudefgedrudeifedrvddvkeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieefrddvvdekpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeekpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhg vghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 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?1760635486633714859?= X-GMAIL-MSGID: =?utf-8?q?1760635486633714859?= From: Rafael J. Wysocki The cpufreq policy notifier in the ACPI processor driver may as well be registered before the driver itself, which causes acpi_processor_cpufreq_init to be true (unless the notifier registration fails, which is unlikely at that point) when the ACPI CPU thermal cooling devices are registered, so the processor_get_max_state() result does not change while acpi_processor_driver_init() is running. Change the ordering in acpi_processor_driver_init() accordingly to prevent the max_state value from remaining 0 permanently for all ACPI CPU cooling devices due to setting acpi_processor_cpufreq_init too late. [Note that processor_get_max_state() may still return different values at different times after this change, depending on the cpufreq driver registration time, but that issue needs to be addressed separately.] Fixes: a365105c685c("thermal: sysfs: Reuse cdev->max_state") Reported-by: Wang, Quanxian Link: https://lore.kernel.org/linux-pm/53ec1f06f61c984100868926f282647e57ecfb2d.camel@intel.com/ Signed-off-by: Rafael J. Wysocki Tested-by: Zhang Rui Reviewed-by: Zhang Rui --- v2 -> v3: Add tags from Rui. v1 -> v2: Expand changelog to explain that this particular patch addresses part of the issue. --- drivers/acpi/processor_driver.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Index: linux-pm/drivers/acpi/processor_driver.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_driver.c +++ linux-pm/drivers/acpi/processor_driver.c @@ -263,6 +263,12 @@ static int __init acpi_processor_driver_ if (acpi_disabled) return 0; + if (!cpufreq_register_notifier(&acpi_processor_notifier_block, + CPUFREQ_POLICY_NOTIFIER)) { + acpi_processor_cpufreq_init = true; + acpi_processor_ignore_ppc_init(); + } + result = driver_register(&acpi_processor_driver); if (result < 0) return result; @@ -276,12 +282,6 @@ static int __init acpi_processor_driver_ cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead", NULL, acpi_soft_cpu_dead); - if (!cpufreq_register_notifier(&acpi_processor_notifier_block, - CPUFREQ_POLICY_NOTIFIER)) { - acpi_processor_cpufreq_init = true; - acpi_processor_ignore_ppc_init(); - } - acpi_processor_throttling_init(); return 0; err: