From patchwork Tue Apr 22 09:53:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 883440 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9653213E81 for ; Tue, 22 Apr 2025 09:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315650; cv=none; b=Ss3qO7OeWTAvJKrQ8QpL5SLUvTEWiW7+HLkzPIjtvRuxm3JPhmrtxeRYiXBq1n8UVFA24bV5tpuzxk6qisNTP7+pStrNn3NwLWhDUyeEA68XUJpsIhCVfwEbP2qRmC/jtgmDtngHe+EC540WGDKvArFAbmR7AjVmNuDjGslwxCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315650; c=relaxed/simple; bh=L2eTTuTa1eQwii4P70WWj60+AqgdSCjTwbfYuCR+exI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=WpQESr9AJBlf8iV2y/9TqPcchr2JNGexagkzIEHzWKGA9BLv844qUl+g1MIaHQgMp12Wk7OywkEH/a5x9V0yDkkdO9rAmwUh4o6fpaEp5wPGV6XHuGeuNSBsizyfLe2BDnnxFIcj4V4qZyqlfQSjN/6ZWE0QBQHtvcaRzIjl/ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=El46f7pB; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="El46f7pB" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-301302a328bso5203004a91.2 for ; Tue, 22 Apr 2025 02:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745315648; x=1745920448; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6gXRQ3l/ZDI7m3p/8+vMXIVMOdLVmbzl70e5WfDPUXI=; b=El46f7pBW5AY3T/pW8ccCde9pT8HEfOL4tJyCzbKl4MObmTKgcLTI3hWJDEVHyq35p IXBrshZIgp2r7zZN7anakE12qwwBa4l0yGwwYxgLdCj5xfjHjFC4bSyXF9SGexGX+34o zvtHDcnU2rFmfMccd1wW7PWWCFzD511w2Jm/+L6WFGema53B5XdoGTi6vK3al6rfrWLx fxUOOtPxpwN4byRtSq9vC8KnhYJ5lsA3jzKkDO2EOuPk7JLJp6vzRAkRuSS9hXSJZdut gLSDg3NeqkCIpAtxcFtzRADZoqNCWLR0JgMdOwmlyNQea/3zivp6nQI0Q4/RwZuuTmTU HEGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745315648; x=1745920448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6gXRQ3l/ZDI7m3p/8+vMXIVMOdLVmbzl70e5WfDPUXI=; b=m56lRleWn6PxwWvEweOCXTLURDkvsLhOImgCkEICKOxAU8wM1w+/rLO7EfTXAjGrmT paNNbNe/ydoJgDanFv9AfZdQ/RFDntRD2YCP/x5FMGFaUs6vl2smv0FBAqX6YYejmwm/ gAPYw/wERZ9LRzdc1AFQ8SeeJZb2a2zsI5QRDxYcrrtBWzViDkFWAnwGtCXedXT65WFy Ch9df/jE4kfixvsghlzRLS0LhIRtPzMzY4h9NmkDPkWieXdGBDeb8VxuJjd3GUFVCdqw HorqZLblt61n+wZ6zBJL45nO/XabOe/3gpUoJBtEq6h1Wss9qwq2/bEypn+EHd02bF26 UnOQ== X-Gm-Message-State: AOJu0YyXENsWBr4sVIVuxW6ZTLtqqdh+4k3ZZlS48DFVd+GqeZuYQdiM RmmlV0uZhYu+i/vw5EG2NZUuLHXLB8g7oUmczWZf8/eX2ncpqCfPP1V78wd4CgY= X-Gm-Gg: ASbGncuDwSKqxDOF1i0qj83wHtFtOYYJ/WulIhvIZiqVUwu+5wgNpI6oSqnIquRL7Vv 343HHIY03jNM54ZiqcHuTJm6wkv2Y4lfDWpASNO1QhNjtCyI1/N085qn9LEQ8qS3/m8M/zDGlC/ WYg/PzlMRg7uxIVXbwKPH5ySMTgbrS/1IiXYD7RS9Upq1ecRNg3/RuO2mXNM41MfChfEPUfczKN GO3Fxer1GRVzMdtSIpA4vt2ngYslRoIkFxQDvR8b77374PzojmHGX1xnxn09/w4IIgm/ru/3QTm YD8CjxJjLKDFtxWbC02MieAoRFqvliTdrdR5NTnSrLoE0hkRoOI2 X-Google-Smtp-Source: AGHT+IE/wvqq9gqVFeBQZ9f+2ocmH5VwKgVfi/GMhqbq95+Km5GimJ+CgXmeQp3d6qdUw6qoPnp7hQ== X-Received: by 2002:a17:90b:544c:b0:2fe:6942:3710 with SMTP id 98e67ed59e1d1-3087bb3978cmr17322956a91.3.1745315647911; Tue, 22 Apr 2025 02:54:07 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3087df1e5bbsm8138605a91.24.2025.04.22.02.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 02:54:07 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar , Lifeng Zheng Cc: linux-pm@vger.kernel.org, Vincent Guittot , Nicholas Chin , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] cpufreq: acpi: Don't enable boost on policy exit Date: Tue, 22 Apr 2025 15:23:51 +0530 Message-Id: <7ce4ffb166beef83cf1bd703a41bf91622011585.1745315548.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The boost-related code in cpufreq has undergone several changes over the years, but this particular piece remained unchanged and is now outdated. The cpufreq core currently manages boost settings during initialization, and only when necessary. As such, there's no longer a need to enable boost explicitly when entering system suspend. Previously, this wasn’t causing issues because boost settings were force-updated during policy initialization. However, commit 2b16c631832d ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()") changed that behavior—correctly—by avoiding unnecessary updates. As a result of this change, if boost was disabled prior to suspend, it remains disabled on resume as expected. But due to the current code forcibly enabling boost at suspend time, the system ends up with boost frequencies enabled after resume, even if the global boost flag was disabled. This contradicts the intended behavior. Don't enable boost on policy exit. Fixes: 2b16c631832d ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()") Reported-by: Nicholas Chin Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220013 Signed-off-by: Viresh Kumar --- This was sent separately earlier. No changes from that. drivers/cpufreq/acpi-cpufreq.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 924314cdeebc..7002e8de8098 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -89,8 +89,9 @@ static bool boost_state(unsigned int cpu) return false; } -static int boost_set_msr(bool enable) +static void boost_set_msr_each(void *p_en) { + bool enable = (bool)p_en; u32 msr_addr; u64 msr_mask, val; @@ -107,7 +108,7 @@ static int boost_set_msr(bool enable) msr_mask = MSR_K7_HWCR_CPB_DIS; break; default: - return -EINVAL; + return; } rdmsrl(msr_addr, val); @@ -118,14 +119,6 @@ static int boost_set_msr(bool enable) val |= msr_mask; wrmsrl(msr_addr, val); - return 0; -} - -static void boost_set_msr_each(void *p_en) -{ - bool enable = (bool) p_en; - - boost_set_msr(enable); } static int set_boost(struct cpufreq_policy *policy, int val) @@ -532,15 +525,6 @@ static void free_acpi_perf_data(void) free_percpu(acpi_perf_data); } -static int cpufreq_boost_down_prep(unsigned int cpu) -{ - /* - * Clear the boost-disable bit on the CPU_DOWN path so that - * this cpu cannot block the remaining ones from boosting. - */ - return boost_set_msr(1); -} - /* * acpi_cpufreq_early_init - initialize ACPI P-States library * @@ -931,7 +915,6 @@ static void acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) pr_debug("%s\n", __func__); - cpufreq_boost_down_prep(policy->cpu); policy->fast_switch_possible = false; policy->driver_data = NULL; acpi_processor_unregister_performance(data->acpi_perf_cpu); From patchwork Tue Apr 22 09:53:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 883439 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE9BD215046 for ; Tue, 22 Apr 2025 09:54:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315656; cv=none; b=jQFzgvBdJzoIGx3zAfm0Z0MQanDWiqgpujIAuDRTFVPv5sur1DfmDWIzZoPYZpTfQeoPZojte0o7Cwrhg8GQoicncfg77lrsavSx0D49Sa1QMB79zHrgaI8V39mK6mJHuh/w1FvWOJeIR7+J95f3wf3fNfzMmXKpZEr9C9JUkzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315656; c=relaxed/simple; bh=Hwb5Wg8id68V2WnDvFD72dDP1oue3BffEk4N4k7Vew0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s7pZzlIRZpRpwXZrpzxdII/Me/rF33b5LPIvh07tclqbzF9KZmOmOsAGcVQB9jFwLG4TMbCUdp3iMtEgGPzaOt6nAhqPz9GRO/XmXYbqLrWTm5pf1LuS1i8uewNILJPg3rbxKlQA8DXbwL0Q9wyTddRSefhPMlyNP5TEDEWwRww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YGlbdwNG; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YGlbdwNG" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-b0b2d1f2845so3334142a12.3 for ; Tue, 22 Apr 2025 02:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745315654; x=1745920454; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N5Kzn75CoyUpVkgbkAVHgMpizfueeVqLotFm0lBfgI4=; b=YGlbdwNGAPeOUUFTNkdOnb2i8AmfrcPvKDGsegtFj0tKWo1+jyL8iQQuqcqbjJ46Td lW2Q89V+VxQfYOqxMakbQx22n438HMtL34Dkat/9mH9oDuI6A8/qgUn7Sk2B9NMTLFaT Bv1Brw4dOX42c9hXunQhrHxK7FnDFTX1Ikkgo8nzT6pwsjTw6ahQTJTdQDPyDtWrbr+u P4vpQZ/lWoAPKvtHZa6fcZA02u9z0BEA/buvFjT37C+egHqDnLC4gSq8mFw7tGQQA/6S E6GKbicO/13MLlU9E02vJJSjjoGh/OQyqaI3bNqfts0EOYhDbXr0kfOcsgy2L+zs/YR1 pe+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745315654; x=1745920454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N5Kzn75CoyUpVkgbkAVHgMpizfueeVqLotFm0lBfgI4=; b=CJnSxRnMmPF+CzbToiAtqIb+rQdXa8NMkqKXiviZC8t7UFEtDs403ClTUm/1FZeih3 KH3DN/kJ9FuAvD3n76EA7DZLjGZ2W/wJhTFQycRVbeYARM1Vvwo+9aj2DFB8QuANk9Nz QA4rjM6WpEJqc9Bw72Ym2ij9phKUsz+Fh3sAqnkmY4DKL2AU0Od77lpa+etvFNF+ak6T L9qP3NFZRAjots7QXCSGbQmwxX21yoca90mjYYucS9TS+iKmapjnhkwVfO+fqXi847ue yEynrRQXTctF0WbN4g29YSeRT9KHGylqUXLfEm41x12tEQkV8iQJCzTRvMOBgEgUK3SK AaVA== X-Gm-Message-State: AOJu0YyEjGJpzuWZfWmy2UY1WwsK78UXIvMpWtJPKBB5nAmahFWfNL60 mbKCslBeNIGB2HxiY8YRCjdHLk+nnN+00nzaa79/6nyBfvReHlqbdELyaqMQ2dA= X-Gm-Gg: ASbGncs+kPw2qXCj7Y30Uou584P9NFlm+CW8JUeHAkHLjf8eSNQm7fgGgZva/ibublv eMrAENvNEb5io6HK2Lrofi8BOTAun/NobfesiRVv4KnK5kN5lISV1eJFz2E2N+00Vd+/lN7FJ4m GQ5sFQ/FOvVPh7wMlfwIrjnkmGHIL8M9Af2qZPxOD71kpSqRCE7ihLUvsNmvjwM656hi16S/Pk1 eJK1P+etm4dn64Lazn92R30lewNeKEFJBeLCIV4NGEOdEAmS7alOC5fudapfXlMNIFkIfZrTXPx Z5agNT/4oXI8Wz555zRFBKuN75I2KnVadehOoBESxQ== X-Google-Smtp-Source: AGHT+IErqjm03tFu5yST3yF0F1z9Zzqt2vjP0tGj95/hMaoPb1Uko0h1jfw4cKpAm3i77EYr44591g== X-Received: by 2002:a17:90a:d64f:b0:2fe:d766:ad95 with SMTP id 98e67ed59e1d1-3087bb47646mr23455072a91.9.1745315654223; Tue, 22 Apr 2025 02:54:14 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3087e12a154sm8221994a91.48.2025.04.22.02.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 02:54:13 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lifeng Zheng , Nicholas Chin , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] cpufreq: Don't unnecessarily call set_boost() Date: Tue, 22 Apr 2025 15:23:53 +0530 Message-Id: <1ec6ec55f8413b0387a19a531dff0c3194847f24.1745315548.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The policy specific boost value may already be set correctly in cpufreq_boost_trigger_state(), don't update it again unnecessarily. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3841c9da6cac..e31891c7b500 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2861,7 +2861,7 @@ static int cpufreq_boost_trigger_state(int state) cpus_read_lock(); for_each_active_policy(policy) { - if (!policy->boost_supported) + if (!policy->boost_supported || policy->boost_enabled == state) continue; policy->boost_enabled = state; From patchwork Tue Apr 22 09:53:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 883438 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B67D217701 for ; Tue, 22 Apr 2025 09:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315663; cv=none; b=MR1JOs2CmLHa6q1Cn4xlOmKkAisBScTqtTGJtnmrH44lFQeTQ5riIp2Pk9IHzaolpAS7kRmL5vTaxDf1bFlgDn6rXKnQgEdZ+LzdEWsoPDLLMyQP4FJ9BNrhnvrsfNlxRqoeUMLy3ImGovDxJN3LsDzjLwIwUZpF5BeayiLjSMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745315663; c=relaxed/simple; bh=cVq4c4NXGO0/VRDBrGImjhxsKCiirGO3AQu1B/IYzYM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=joabf1ytxz5/XSppZsPytjQ3QEWS3WufsNnQW3OAz3MPkkjM+RweiSjcY7lW4h+1JVnvsMTYZdhBNk/KlG8HdtpVv5xtW7lguHW3GmEjRirq3DI97e8hfyIuWZloaO0MVxh9M6+zcwGJkwrTu1g95OxinNUtgsPLg0jqGpp18M8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fUKu4uJY; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fUKu4uJY" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-22c33e5013aso55314565ad.0 for ; Tue, 22 Apr 2025 02:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745315661; x=1745920461; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sL1kGrQ7pxuW+GJmcKXt495d/ijkj0h7CpDbYSylQOg=; b=fUKu4uJY24/vIz/k4INH6gCfqJeNyaN0tICWa+SEpHetPJTnUteeSFdY4HBemKdDdq MeKB9u6H5M0W4QqypC2MRtgQHszrccpmBnbHvuxGHvDOwnCTgNzcIiRInqdVt8xpeC3Q AHCsb5GG1wrvX5ds4Jukl2EoC+WH5yvccZ6o5mJH1rblYHmfGLITT9TTPglcW8jRgm39 iEl2dK7PjGk5+YDC5mE6DPRY7XvnQw5+qf8wiJuPWRB6+2YP9RIhpdusCsm5dR8SobkZ tgJ8wCpV9G7rulpbOUboFOfHwxxN7yu1Fb9gauyJkQ3jw5X93sWM2u4xYMspP1Wo3Z4e M7uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745315661; x=1745920461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sL1kGrQ7pxuW+GJmcKXt495d/ijkj0h7CpDbYSylQOg=; b=SVuyJ58OFez2xLgh1gb8MnqVZe7XEY9RQISwr0koVCx3gROgcHYnrTNh/kBiQApKTm yg9kYv1P0YYmUPHitQ2GTkIhVw27RcXN19ak5T4/nCWQ2n5xPQRl7twC/dZT0sv9u7/S 3sJVvP9WJQMwSUD9/fEocnk4mvuCPAjVgEChpbqm/bLklj/BB/1JgQQD9qFaLcHi5M7a E/AvhsvOwkxuvJ3BaphiKgPdlF1lPiC/KTSu21xobZfFoo7+2lnsBABxQfDOEgChK8t4 jN+e3DV6xG1Wj4FpI10qgp3NI9MxHTbY7GrAYNewY2PkKQMM/sybTOUUe4nlHA66IbRt OA2A== X-Gm-Message-State: AOJu0Yw/dJFD8BHlKXIO+djjDskgMDgOLmyvXHYrdQuqKDB0TH4vS6gF okJuW19qw/AETSxxKFTkJEvhkAr1PenW5A/OoUPdhoNtk1sVpzwBUJhsY2Lp7io= X-Gm-Gg: ASbGncv2YVwGhzPHtVT9OLmAI8YWtyB/N7ZmXMzinj0jyc+P+RU+HlgVytooiI+M6se q39Gwv8CgQs2PzaVlmcbgBQjAyJ2V8lbw0VvexEUc1L3mjaCbN2KsnCUMYZ2HjYfbdtRGEMGSS8 xJAO43zwC2D2CAlPhqo656UJTU0DaXqNT0rz+8rJw+y7N1LbulZHYhg6uIC0tw7azUHBjRySFne 8kZ6oawnMWhGlX7PKL8pY3XuaKLdJYZz+Yyehj0srIGQP5MWGVMS9CwyPQplV/QmcTDQ+XTGd5s qng6O7TKHJkH6ryiLMz8cmgZ87Syz16JGU183PQN8A== X-Google-Smtp-Source: AGHT+IE/mIyh+fwUIcGlS3NjRNjJYXWPWCmv1heiExkWyxbfPD18Am5wJjrUdBt38apOdY3phcgTJw== X-Received: by 2002:a17:903:986:b0:224:e33:889b with SMTP id d9443c01a7336-22c5359a406mr246903215ad.12.1745315660864; Tue, 22 Apr 2025 02:54:20 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50bf2548sm81060525ad.64.2025.04.22.02.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 02:54:20 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lifeng Zheng , Nicholas Chin , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] cpufreq: Preserve policy's boost state after resume Date: Tue, 22 Apr 2025 15:23:55 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If the global boost flag was enabled and policy boost flag was disabled before a suspend resume cycle, cpufreq_online() will enable the policy boost flag on resume. While it is important for the policy boost flag to mirror the global boost flag when a policy is first created, it should be avoided when the policy is reinitialized (for example after a suspend resume cycle). Though, if the global boost flag is disabled at this point of time, we want to make sure policy boost flag is disabled too. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 24745088403b..0ad459bc8f84 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1626,8 +1626,13 @@ static int cpufreq_online(unsigned int cpu) if (new_policy && cpufreq_thermal_control_enabled(cpufreq_driver)) policy->cdev = of_cpufreq_cooling_register(policy); - /* Let the per-policy boost flag mirror the cpufreq_driver boost during init */ - if (cpufreq_driver->set_boost && policy->boost_supported) { + /* + * Let the per-policy boost flag mirror the cpufreq_driver boost during + * initialization for a new policy. For an existing policy, maintain the + * previous boost value unless global boost is disabled. + */ + if (cpufreq_driver->set_boost && policy->boost_supported && + (new_policy || !cpufreq_boost_enabled())) { ret = policy_set_boost(policy, cpufreq_boost_enabled()); if (ret) { /* If the set_boost fails, the online operation is not affected */