From nobody Wed Feb 11 03:51:32 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 1C78B2820D2 for ; Thu, 24 Apr 2025 16:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511631; cv=none; b=c3IQo83Hff5XY3NBQpBx3AyZ4WZbNMs3P+XRuXla0Ki9oa56Z9b1C1rYzWWy66KI7Z9DEh2JrclOx+9WH2YJHJz31Lgz5rkN+d9vBaK0nOdbV6/cd0EGlgEvx2b69U4T7cMjtT0f649gkOPixtpeKV/jlTJ+zyoQ2lPl+P+l7Rw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511631; c=relaxed/simple; bh=aDJVHGaFvaN7ytJ3XZQ82dd5Q/CiK/ofSwCmDjO8+jY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=J6bThba3F0reyRrKI50Gec5Dw1VxrBNxc1hAly3+jzw/KisJpKektu9HgwmTC+JqsgECpHANKUb23lrW2G+NCcEU0fNBI0I+Ztj+zq7uTQNjIsUtn+kOru9UqyvBkicO7vfHeAZWLf409RmQW1RsRgoUACSZseBVCeBkAOzPCNg= 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=KNiYkABA; arc=none smtp.client-ip=209.85.214.170 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="KNiYkABA" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-223fb0f619dso14812305ad.1 for ; Thu, 24 Apr 2025 09:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745511629; x=1746116429; 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=VAEMnNThm5BtYQLpYvVy8LbqrgUr5WpG4VLt5eZ55BY=; b=KNiYkABAKvuybyX51ypI/jTgfwSwU5Apv3vCr3wuXxUb2JmNcXpIS9LjFiyL4fydlv 5XHfm+J3hzLrl7R5gV5qK02tEEFdNtrEl/Yh+4QK31PL23Iz03kabEEqq4DfhCe/PlYt 4dbjlDLVhDJG6WRpHqOUFiEkUJGwewUdV3c19jV6P6cBS04DVFxuw04G3ZaEybWQy3/n NcZdJxvvcX9UyPuRMN0ycxk+Lg8gvbiRJ4VvJoQ1z+pNzTyxpDwb6JYxM5stP021y59g sAHALTFuWik6+kO0q9Ar4qRLUKPDYx3+fDti8qCdjGpbCkdxcfV6kmTffsIQ0Pu+T0pB Vy0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745511629; x=1746116429; 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=VAEMnNThm5BtYQLpYvVy8LbqrgUr5WpG4VLt5eZ55BY=; b=pX1eEO5DMPEyW215EZmEip0u7G44GwixzySPrKaoYzYPulfNiCVup3S37lXSxwkX0M R6zMCeOzsjMJ3FJ09nBYlETdn5Kez+KZgwbiMS+Pz9VMc+YuVA6vKNpCC7VyM0oYOSzu UVlW19v2uNuMzY/1zqL87jEaosDFpA5hDSInd010BnBxpbH2bA+yde2gf5VIqOQOCSid zdYpuJ8Pqy6ahQhOug2wNm15RgJrKRphyEzQmwvwdt9I9olpE8BicQqdyC9BD2f94PeR yZZPoRilA10fpJCdIzgoWJPPo/s1lDEm+f71+hquq1HDCJkuk6wM4QD1PQezRmX4DS5V DN5w== X-Forwarded-Encrypted: i=1; AJvYcCXeY+l4MVu7B5v2e1/rSm1UO97N3TeaVZFMlzV/uunI3dUEl2eTo0wkBbFUrjcfaodStzsVGk+JbSvbGeA=@vger.kernel.org X-Gm-Message-State: AOJu0YyW/Ml6SDwq3mTI0dp/AFzLjuKZ+EJWdGO0ZWilBHtXCGixs2PV d3XLrBx5xWkkQpi/EA6/jjihq0KKJjSLpWifqjZAfFjHCkg0KNspIY3f9oiE2C0= X-Gm-Gg: ASbGncvgNl/6rOu56b3G+BGapn8uZ7DwfsPeggmvq5AbTAK5TQuDDuEwiyicgk33lKk XmV3onmrkNO2Ab8ZELnjjTgGzwVCAD65U5ItqS+EzAwgdT8qyR65xxM3E0pwsGck79BJxoGcTSE Y9Ies4z9fBWaGkiMw30hXc6/4u+JG3ViHK2dw5cQwfWytvF9Dw5XP3fw+N9vxNnZhM0JJAXQ3Es biFvGUGPdtwQTpV61T1juD5CWrXPVy5f2y6FIeCge2cwpgmbgJKFMTepKpzedZRSwwns0OCCP8A vAwEBfZegwhGtNweCpF0yUv5Du9j1NQLrYyg3xZBvA== X-Google-Smtp-Source: AGHT+IEC3G34HKnmp/Vwarv5ELQVHqGjzcRLSaOEM6FO3zSw7ZdDlftUSYsTgO6oH/156Kb1ZAVPTA== X-Received: by 2002:a17:903:2f84:b0:224:26fd:82e5 with SMTP id d9443c01a7336-22db3dc764dmr44052455ad.48.1745511629400; Thu, 24 Apr 2025 09:20:29 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db510304csm15416315ad.204.2025.04.24.09.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 09:20:28 -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 V2 1/5] cpufreq: acpi: Re-sync CPU boost state on system resume Date: Thu, 24 Apr 2025 21:50:14 +0530 Message-Id: <9c7de55fb06015c1b77e7dafd564b659838864e0.1745511526.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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable During CPU hotunplug events (such as those occurring during suspend/resume cycles), platform firmware may modify the CPU boost state. If boost was disabled prior to CPU removal, it correctly remains disabled upon re-plug. However, if firmware re-enables boost while the CPU is offline, the CPU may return with boost enabled=E2=80=94even if it was originally disabled=E2=80=94once it is hotplugged back in. This leads to inconsistent behavior and violates user or kernel policy expectations. To maintain consistency, ensure the boost state is re-synchronized with the kernel policy when a CPU is hotplugged back in. Note: This re-synchronization is not necessary during the initial call to ->init() for a CPU, as the cpufreq core handles it via cpufreq_online(). At that point, acpi_cpufreq_driver.boost_enabled is initialized to the value returned by boost_state(0). Fixes: 2b16c631832d ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_i= nit()") Reported-by: Nicholas Chin Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D220013 Tested-by: Nicholas Chin Reviewed-by: Lifeng Zheng Signed-off-by: Viresh Kumar --- drivers/cpufreq/acpi-cpufreq.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 924314cdeebc..d26b610e4f24 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -909,8 +909,19 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy= *policy) if (perf->states[0].core_frequency * 1000 !=3D freq_table[0].frequency) pr_warn(FW_WARN "P-state 0 is not max freq\n"); =20 - if (acpi_cpufreq_driver.set_boost) - policy->boost_supported =3D true; + if (acpi_cpufreq_driver.set_boost) { + if (policy->boost_supported) { + /* + * The firmware may have altered boost state while the + * CPU was offline (for example during a suspend-resume + * cycle). + */ + if (policy->boost_enabled !=3D boost_state(cpu)) + set_boost(policy, policy->boost_enabled); + } else { + policy->boost_supported =3D true; + } + } =20 return result; =20 --=20 2.31.1.272.g89b43f80a514 From nobody Wed Feb 11 03:51:32 2026 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 8665028466A for ; Thu, 24 Apr 2025 16:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511635; cv=none; b=OsOkgORe8pkey+X4U+afcNt7vDvZrXiLw05ceFfMtRuQxlqM7zpvaHGv95z1orKHpOXh3EXpbH0lWnznSuxjxof38vm4Mh9WEZrekACXaO214yCSGa2W4ryjMNbcnY+iiu2VPEbRMs9TJ99EjrQxB0PVf1ETLLwZBp/D0A9ASSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511635; c=relaxed/simple; bh=N86G+xPvh3Fs6OA8eDZ5k/0ObrQcBlpZHqZBKD5QejE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nem95Tf3fmEVVWn+F/gezajcuJVPqFu2LhKNkkbgOd3r4ysd+mRKtG4uTaLzJFCfZBp4OSNZF0lCC8Ra056ogkyaVGkdF4oNAfyonJW9zEC03LSsf6zSE+YeOs79N5HM/9XLfZOHN78SpgMrMGEW2jCRVNhj8cVYMn0tj0j+AFU= 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=Czv/FUBV; arc=none smtp.client-ip=209.85.210.174 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="Czv/FUBV" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-7396f13b750so1355313b3a.1 for ; Thu, 24 Apr 2025 09:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745511633; x=1746116433; 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=29re1A6IAQcw58La3we0Qeu64CWcO3h8durF8s3FMdc=; b=Czv/FUBVFtDpsxyQt6JZM3F3PhUj1i65g3DJlWttU/PYQHRSRFkMbt6xDBTBFHdu7B FOlSWPD/fmgkcacag1ccoIU0hAHvu5MiPo9WADLP1PVXUz+f1P056PQtPw87PhD5GIKu mYtkyucrqvFrysNVqLQIR1yYsPKgA/KPkglu1sgmYdKiY2mufI9GnTRsgYhVG3oUWhC3 khwdzoWy5BjOr4/LEdSrER1LtdGSu8+9/UPoKVFCnjol9BDjGE2j+fi50Y89VB+eX+cA HyS79E+T8e53Obvw39zb5YsHPJmWIXKLEr6hFKGe1nXI869aQ6b8l2EzgYc5Xfo9kld/ op9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745511633; x=1746116433; 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=29re1A6IAQcw58La3we0Qeu64CWcO3h8durF8s3FMdc=; b=VFYlVH1M8cPzXCPPO/tqHY1PaHNjklGLH8Je+luC2KJrJoh46Ke9IbiNyqtzkvXDjb 3aMfW39Op8cNbchw4de6iHV0VONy62V8pf9boSxwpOc38BPzgNNQMRWwEPQRY0H46XCt g+9qLQlQV9qNl7PZTeyi11FB4UQwEkiztthNhpWMgPZUsVCci60e0EQFlemErE2burBa dU9ot+TatczC9F6eePUw/r5Cu4EuZ88z26Ju8f0A1YkGePLzQQ80hbwHnYWBeqHpOnWX hTTAKnLrLWsHwmOjALhvczx0nEDuvf7ftBxAsHG5uXV1o11cP5b4VWIqZ6QI7+cqRLZX hMtw== X-Forwarded-Encrypted: i=1; AJvYcCU6BmGfQMmpyKOtnNsbyOqY0OXl/+7YGTzM1IaKacF68SIDXgTb18BnyuFMDxNMeSHi2bJlOAIFXZ2bUf8=@vger.kernel.org X-Gm-Message-State: AOJu0YwNSacl40BsPSAAMVNwH6OGAm5aV6slH+HUju3wDsJzYk7RWisq WGP05InIEGSIbHpzwiW02RdBMDfm6x6+5sRXaXzYEncjZxAy+Hd7xgPXimGKThQ= X-Gm-Gg: ASbGnctrSRd/sMKVOII7RTSk+0Qwc/2o0etqPC88uzQ87jE94q1TYfUHgkFOvGR0xbr VJIcLHRy6ML58GJYAxzW89OROiGO/UCBhPrdfR2r1sFSoJ2PuAYOn4zJeDZj4yqFHWhutvzVQbO Qj2Q31pUpWXRmVvJl9cKTM67jrUcNRJnCvdJVn1rFqWvICPSismpBcvqbjfFyCyjLCf98zkATMd X+UoNbTrwIIX7gLd/PFb81bApTxeK03xau9qbyl9qT6JXC2XGu8je35eBFulyeMuT12bttG4XUf faAG9UF0qsdK3Zc9gJ0hRITQ99BNzEAs20y8tXuaPA== X-Google-Smtp-Source: AGHT+IG578Ic64K8QbKa3qjFUhYhINjMm+PC0YZTjvGdvoBcCT0kxu+uUXe6zvVhuX1i3Rbt1n0WTQ== X-Received: by 2002:a05:6a00:3987:b0:73d:b1ff:c758 with SMTP id d2e1a72fcca58-73e247d7bfemr4497488b3a.18.1745511632704; Thu, 24 Apr 2025 09:20:32 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73e25a6a415sm1588401b3a.85.2025.04.24.09.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 09:20:32 -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 V2 2/5] cpufreq: Don't unnecessarily call set_boost() Date: Thu, 24 Apr 2025 21:50:15 +0530 Message-Id: <3003fbdcc1850128fe7fb653d7ddb8afc4d66170.1745511526.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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The policy specific boost value may already be set correctly in cpufreq_boost_trigger_state(), don't update it again unnecessarily. Reviewed-by: Lifeng Zheng 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) =20 cpus_read_lock(); for_each_active_policy(policy) { - if (!policy->boost_supported) + if (!policy->boost_supported || policy->boost_enabled =3D=3D state) continue; =20 policy->boost_enabled =3D state; --=20 2.31.1.272.g89b43f80a514 From nobody Wed Feb 11 03:51:32 2026 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 B6505284B53 for ; Thu, 24 Apr 2025 16:20:36 +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=1745511638; cv=none; b=CYHN11qoq4ds2EK/a1JKh3KcCRlnj3LOuAZUJ0IERgT+7ehb9p9OerknJQJN0IWBYLyRiwtzww2hkkBLPRfBPFE8tvV2ZXjyOVpjWb0AnjZJiIyRf2T0AWTk8E7N3XxNQscdiXHPz5PHz73fReHh6u9XUK5OO/6LEspCvI1ccLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511638; c=relaxed/simple; bh=Oyi1VC9Aa9JQ7UlLN4XL/e3gaecAn+Lfe0RV04nRiz4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZgjMIKrgTchq/V95u93FbzlA8/pckYbpArOk2GIStPxoiSPtV8ZNs0StO3FvAuMdlh+SCq+Y3BIzS8CQyBAi8MyGbmDxSUV9F7/UPtUfBz7gc/JkMqbu7mehGSwDSKV7XQqxwsUrxIu2o8AfyjfeDQjkmKaBWTBJorzLvlLKVG0= 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=lrHPe4Iy; 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="lrHPe4Iy" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-306b78ae2d1so1094355a91.3 for ; Thu, 24 Apr 2025 09:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745511636; x=1746116436; 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=k3Iw9xQG/mrFyYZCbOAjR0BlEmMfeP4/b2L1nOaJiVM=; b=lrHPe4IyLQVnfHpCkQcgHZVwjohbgfRkQqoMxdeJvmkHuCH9I60NIxEelw8xvV90RO VtmtnZxUcKHWMJw/yGiCzkrTn9EdXeClaZeoAZVtO7fi5d61RbSn+GXafEwA6y4Ac01S dpaIinBhbU2AvVqLUjzXgB+1DLBkWyU8mamP7ck9i9HfLY3HuU7m20RE9va05Kbl8SJQ hU3b7QUbVDy1EETpugBabfn+tT7/TKUChvWs9TwrZJk0k/QgFrXoOtlNGiA+a1y4G4Tz Ohco33Fh7Nxr4FqDrW4XdpxJi1b9Muq9COC0yPs8MEuW/HYjWTkz09UcrlGtTCWSxCeV R7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745511636; x=1746116436; 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=k3Iw9xQG/mrFyYZCbOAjR0BlEmMfeP4/b2L1nOaJiVM=; b=pblfbLfRn/48T1AmzoWNtlvRkwG7DNmLqQMv3MWyzsA1VxSGUwBxWU/19v0PJH/DZA 7nqhJQxTTx3h3X+KO8740dOfn4pfX/JKBVbs73mcV8dmwd/2oJpPCI7KMzvhfjrR3he6 OzTTg4HWL/tLL6EJpucuFpWv+NXYDpFNr9/MCl/IQgD58QiPuN3OTNag2P8kgKbJljHh +iciHWuMQ4u61Fddr2SnlvVMKMbcX9FQ9Fc48wJf3Sal1w6PShJMDbVUv8rlkuA2a4J+ cl9jWs4D6u9DYgdLyEX5ViGZUrfozz18gRa/MesAesHeaFqwWImLjXYpkjIHFfXi4ody WNEg== X-Forwarded-Encrypted: i=1; AJvYcCWiO3ajOTpPX3P5Sagl2Nwjo/AMDovPnAl5O6BFu+WynTXHi0hBfJ31X4Cj2aVf/mHLj1FdLIvhdG6chX0=@vger.kernel.org X-Gm-Message-State: AOJu0YysCqWs6NApmDVlQxpCuewfJj2+qHJmWbHtfilqTtNtKvpWZKLs ZiJlW4i98F++6xryFlsQprlhNF8YudR57gcyeqSTKA9N1peNEawevsqOxeliUNg= X-Gm-Gg: ASbGncs4iQ/wkyJzMP16KiYnIOHGYg9WSIri/Zwl13HuBuAicwM6PsJaLl3j0grjVke BgMwY0CUbJVCp8v2jQpqhWceYDnNPN11kGXfhBi6NqsDaGmy6bLC9xdpxyY2PCZHqFpgneHEK0l qeuKAqQ/PJ/QdeG28pQ1AnEWAxn5+OCz1IXd0IpaMbBMlv3L+XuuGnC7inpxmogae7VK8Z9HgkS ojJ04FczXP6dBUCMnJ+1Q9frzzHUG1f9iT1GeCT7PVF9WBCtUdXOG/gPZQ6xMPk4d4V5/pNQVwj R0JYaVJqiCOcxEQt7YghyuNLZNOLhJk43EqsVBP44w== X-Google-Smtp-Source: AGHT+IHGXeYbJl+WVCP6syWgqbdXcskKjaFSK6A+47jDuoLV06ng53DbEMZnSaX1tXXmXEMs6y+aTg== X-Received: by 2002:a17:90a:f94e:b0:2f8:4a3f:dd2d with SMTP id 98e67ed59e1d1-309f554b804mr421908a91.15.1745511635971; Thu, 24 Apr 2025 09:20:35 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-309ef060362sm1570181a91.16.2025.04.24.09.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 09:20:35 -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 V2 3/5] cpufreq: Introduce policy_set_boost() Date: Thu, 24 Apr 2025 21:50:16 +0530 Message-Id: <1863178ac17340c810519c8593014b8e561797ea.1745511526.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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce policy_set_boost() to update boost state of a cpufreq policy. No intentional function change. Reviewed-by: Lifeng Zheng Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 49 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e31891c7b500..24745088403b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -620,6 +620,22 @@ static ssize_t show_local_boost(struct cpufreq_policy = *policy, char *buf) return sysfs_emit(buf, "%d\n", policy->boost_enabled); } =20 +static int policy_set_boost(struct cpufreq_policy *policy, bool enable) +{ + int ret; + + if (policy->boost_enabled =3D=3D enable) + return 0; + + policy->boost_enabled =3D enable; + + ret =3D cpufreq_driver->set_boost(policy, enable); + if (ret) + policy->boost_enabled =3D !policy->boost_enabled; + + return ret; +} + static ssize_t store_local_boost(struct cpufreq_policy *policy, const char *buf, size_t count) { @@ -635,21 +651,14 @@ static ssize_t store_local_boost(struct cpufreq_polic= y *policy, if (!policy->boost_supported) return -EINVAL; =20 - if (policy->boost_enabled =3D=3D enable) - return count; - - policy->boost_enabled =3D enable; - cpus_read_lock(); - ret =3D cpufreq_driver->set_boost(policy, enable); + ret =3D policy_set_boost(policy, enable); cpus_read_unlock(); =20 - if (ret) { - policy->boost_enabled =3D !policy->boost_enabled; - return ret; - } + if (!ret) + return count; =20 - return count; + return ret; } =20 static struct freq_attr local_boost =3D __ATTR(boost, 0644, show_local_boo= st, store_local_boost); @@ -1618,15 +1627,12 @@ static int cpufreq_online(unsigned int cpu) policy->cdev =3D of_cpufreq_cooling_register(policy); =20 /* Let the per-policy boost flag mirror the cpufreq_driver boost during i= nit */ - if (cpufreq_driver->set_boost && policy->boost_supported && - policy->boost_enabled !=3D cpufreq_boost_enabled()) { - policy->boost_enabled =3D cpufreq_boost_enabled(); - ret =3D cpufreq_driver->set_boost(policy, policy->boost_enabled); + if (cpufreq_driver->set_boost && policy->boost_supported) { + ret =3D policy_set_boost(policy, cpufreq_boost_enabled()); if (ret) { /* If the set_boost fails, the online operation is not affected */ pr_info("%s: CPU%d: Cannot %s BOOST\n", __func__, policy->cpu, - str_enable_disable(policy->boost_enabled)); - policy->boost_enabled =3D !policy->boost_enabled; + str_enable_disable(cpufreq_boost_enabled())); } } =20 @@ -2861,15 +2867,12 @@ static int cpufreq_boost_trigger_state(int state) =20 cpus_read_lock(); for_each_active_policy(policy) { - if (!policy->boost_supported || policy->boost_enabled =3D=3D state) + if (!policy->boost_supported) continue; =20 - policy->boost_enabled =3D state; - ret =3D cpufreq_driver->set_boost(policy, state); - if (ret) { - policy->boost_enabled =3D !policy->boost_enabled; + ret =3D policy_set_boost(policy, state); + if (ret) goto err_reset_state; - } } cpus_read_unlock(); =20 --=20 2.31.1.272.g89b43f80a514 From nobody Wed Feb 11 03:51:32 2026 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (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 ED2FB288C9F for ; Thu, 24 Apr 2025 16:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511641; cv=none; b=Fcd2ghgIhxXs/AI4y2x6ikUGTcAIOcUK6snHkAgd7OypUnuKO2+ky42ul7UMtZVWuTeB8VKkJW3UYrvXnfGferp/3EJtHrvXCCr2vx65dhV5mtpqG2Id33vlPrm4QXypTCR6KmUtokqQKl5NG3ynuvGXzLOSWklBvQNeeqxIaOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511641; c=relaxed/simple; bh=aQN5teKVGNGQm4z2BGpbj1y8aIdHhsEm4YbiL+C0864=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OR7v5gxs7dzKqZf5TRHdyL/oW1JuKvqWqfk7ADbqvjLdGgeH5dEB/jfBkiWXggMno3P311JCVbdh8b6CZBR1S8KVUe4q3eEH5R6w+Cva8avoUQLyxEho2SxVPLVJLQpCRQSuZc20hVqCxdTURBxbLmLYRiTyQUQy0zUxAemEbz0= 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=uhauOXai; arc=none smtp.client-ip=209.85.215.178 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="uhauOXai" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-af589091049so868907a12.1 for ; Thu, 24 Apr 2025 09:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745511639; x=1746116439; 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=z1EcXJf5+RLLmpglmtLJhsY9yapkHMCfsVON2VNDCH0=; b=uhauOXaie3VIlx6jiF279viqG4pZgd6vYYbugKuNKexgresp5jqsG/otA9RknSXMYS Bugnq9kR+aLzqHpz0BOH2vYCl18eqNuiWF6VWsXyGvUEuxKKnz/Nzb/5q49DaraqyH4F zFlg867D1IaZA4O/QfD9T3dG+XcyAvxkovvdx1qeZpVq+dSyK1TGyJYTqO/QQxeKFX2z FPP5ZHwJ61hRaP5qumvoayM8AYawicEkiuiVT+d3EeZm5JL9hRZHO/HvMnvORUw19paf Uf6soZ3eCekUGU4Dnci1SBjSxSkNe+2piOywW5TrXQgXcaHXxK35ZSvweZpO5Tjk8B06 0bhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745511639; x=1746116439; 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=z1EcXJf5+RLLmpglmtLJhsY9yapkHMCfsVON2VNDCH0=; b=t+C/lUnZEXKSe7ywmFpN7onRvYIvCdeZMb1DWoL9XM+MduPUijy5I5bDCEqe1dlrD3 zv30yOKNmhMyntPvLgkawpk2Ov5LK1HOzltUzIdP5CnI7ZUq/CBVpRoVw4FTiuAhBWyX jWHFrmZ3sklxCaBAsdVNnM2nC7ELZex0qjAyNlXzzXgS/Jyd4wsAI7qmMFeNvh64DDNl 2twRyCOL0dw1KrYSpsH2XMQhYdBSd72l+Ssp+ioVdbibLqLyVAf0LltI5oL4I0izA6vE +6/g0Wtb2ztnAAEgQxQ89oSgf9o4PvM61rZJ1E5goX/lqyUsBFphTTIN6K/qtnMrSo6G B1oA== X-Forwarded-Encrypted: i=1; AJvYcCVDj18Q7Ms+hx54ID4MA/xqof8SeJkDB/za6JDGd7iFLbx+N7smthavfKP7ZqlLqqI7Fu+QwaadllpEkr0=@vger.kernel.org X-Gm-Message-State: AOJu0YzlOdjkYKcDTJmE0xJcl9zcI1jaLtejslMwgsAm3S6kFUkDtPzU +atizzDu7V+XPPU2Tuf6v0I7TU9F52YVbJnrgolSD4UYBP6H/KnCDYelfQWLAdY= X-Gm-Gg: ASbGncsHWZqUjr+VKOTGelAYtqrn6qAJerUIHDKWYRc3Y/+DofSgHECXf52k7MbIyrB qgdehEMruJ/pd2llUrkw8zhaxpo0LC7KSjwagldlKt0G1gCx2BhWaiFuWY0L9e3Y5AK9ABdzkOI OvGoCkW4OHNu+tMB/5zXu4d+sK+ry/g5bfyiVJdmumzRPP/j7ogoOa7IryGqK1zO6iiqE2atrC/ 9tEXGYmd25EvHvL1ZHm+YYJ7ztcKs8HIqtF6vEs5Ngwmt7k4eybtRToKPT7yPoNhXy6mZXnXWD8 t7ip+ZaK1Ps4TKrbzRWn3+fwLny/rQqRGEEzI7nmpg== X-Google-Smtp-Source: AGHT+IF2xaoqZl8hWDUiXJ8nEem/xafyn/QQzYjrSVu1qxUZTPGra1ixV/+mmDNdtV5/54Q+x2U2eA== X-Received: by 2002:a17:90a:d88c:b0:2ff:6788:cc67 with SMTP id 98e67ed59e1d1-309ed36e9d0mr4033176a91.34.1745511639284; Thu, 24 Apr 2025 09:20:39 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-309ef03c806sm1581702a91.8.2025.04.24.09.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 09:20:38 -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 V2 4/5] cpufreq: Preserve policy's boost state after resume Date: Thu, 24 Apr 2025 21:50:17 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Lifeng Zheng 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 =3D of_cpufreq_cooling_register(policy); =20 - /* Let the per-policy boost flag mirror the cpufreq_driver boost during i= nit */ - 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 =3D policy_set_boost(policy, cpufreq_boost_enabled()); if (ret) { /* If the set_boost fails, the online operation is not affected */ --=20 2.31.1.272.g89b43f80a514 From nobody Wed Feb 11 03:51:32 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 522B3289346 for ; Thu, 24 Apr 2025 16:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511644; cv=none; b=Mc94om1pMCBxSe+pnSWcGxxanpDQrKFeOlzU3ksER0Qw7Va0fof08g6HebQLs4AYMRKIrvWM3b/2Ru/3IAR66j+kdcDnXdFZOpBnGFn8/51u66RS254MAk8T8ohf30EsmkhotMK5eAQ1M9yWVMGKsPoKYUVqXbTTLzT6OX0BRss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511644; c=relaxed/simple; bh=sr91ZCkfh9/+1qgwRvc7NFp+/ypX7PeuKKUTBWh2e5M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Am3ewCBKmsKVNKBPjtLQgtqLHqYXMEf4cdvOTTrapnZ4UdK0GdZze8T8iBV4/aw5mNAsmbwjgYLdaaY+tWoQtSDiJC1s7bZxRpsI+uunuH/ZiydLkyv+d5kH7uAESbUu5Fjp+sU9WcCkxeDTn9FW2nZXhIR2MYmHpb+cPQ8mntU= 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=ezjT/iNz; arc=none smtp.client-ip=209.85.214.170 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="ezjT/iNz" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2240b4de12bso19030765ad.2 for ; Thu, 24 Apr 2025 09:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745511642; x=1746116442; 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=QSyaOuxRYv6eWeED9vze/Zx1Ra4wgUaI0r8PRqeWN0U=; b=ezjT/iNz+b4drFWmN5xEGoQAS/QQfBWV70zcg4XGRg3+y3mb8py47MBHlkz95iwkqx eP4pCK26BXLfmDPwJdR9Xjv5y+P0esh6g58flAlhAIjrDpqh26jK6qzeTwBIxhWZ61rC 6njYkWiHNdIpoGADe0SWeU5Bsk9S37YZAix2SUwEBA4nLAWRppd+/bmFBodDThMJZwem /GQDbAXtTaHuAhgz0JsmaOdR9+zDaxFhCJIyYkpbGmJIJAL3uT7Gowg4H1mHpVNXjpfN qasDeD6KLxybk0me0GcHOjMtcW7V9+HMxcpaLQlM/aCVn/HXdXxZ++88tqzKUQRBJbjN hAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745511642; x=1746116442; 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=QSyaOuxRYv6eWeED9vze/Zx1Ra4wgUaI0r8PRqeWN0U=; b=pp2KTsrI+pzBweLAJOTCzZdZtcTi0AGeDIWfAmplj/+aIeSw2+ACJLQOgC7M4egE+n bL0ThoDKrkKegdNslSOAZ/w7icfg6j7tcQKXtlNO0ADCo75PvusMtxPMochoDOk0mm3j HV56hmK8NHL6UXj4AxboIMsnaf89a7SYmzdvyb56vsXigrfxbkP12UJExuJwZLULilmK SFN+WJhMeV7cqKaTPZEulUy1SJyFFAJAsma/DRbHHlYitwFHPjtYT4qHqYNVao0hrWHc 6Vq8Cdz5QA68+EecE3Z0ZJpDW5yMwTpe1tO+75F1lgo9xDTgVCVW8fcKStfePgzxcvYU fZgg== X-Forwarded-Encrypted: i=1; AJvYcCUHO2UJblUiv2yHpfQLUCDPXUWEEh+Ar4+PO0Ug+gCF1mc42efxWoRo2hp5Bk8xNyI38WAQI2nURDHoIhA=@vger.kernel.org X-Gm-Message-State: AOJu0YweEFtoNQR0Z+u8dX9u7IuHAbBBtIpM4ffBiAZ5KiGjaj+o1yjp 7zOp75WIKGJXz9vE7ZOCbLOF7WI9uzlNZ87Kao6EqrCe35P5pV9Zrb8hUhK347g= X-Gm-Gg: ASbGncvTAr/OPaU32FrmJUPNY37bJGnOvy50QltA786Q/ersNaoyOvL99oYTOM8om/O vfElv/0PBWSHWBNx+k++60OIILxMhC6aLjYgswxQcDzxLj0ySrHaVOeuJ2X1N3Ytn/2ccXw9FQf m/fqgalXKjCC6IMONReckzdL0CBYaGhuUDjB+bHE8yXh5dqTfX2+ZAhFWsbTfECLNRIWL5nlTxU uNqNkMWjrD5xhaV7JXgtQxvjlzfUnw21uamKNcf0XNxbn1VHilPyu69FC3a9d0EsiWSiw8Hrvu4 65TD7xRTjqTuzc9PEh7vvuCZoWsnkosmmZvYWzIffQ== X-Google-Smtp-Source: AGHT+IEYPSmkALRG18EbLkZ4r4Mc9Zk2ENSNaMuK68sqW3bha49PXaIcVchPcu5dRFET7GZx/n/KrQ== X-Received: by 2002:a17:902:f64d:b0:223:f408:c3e2 with SMTP id d9443c01a7336-22dbd41875bmr1217355ad.14.1745511642636; Thu, 24 Apr 2025 09:20:42 -0700 (PDT) Received: from localhost ([122.172.83.32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db5216b7csm15475485ad.232.2025.04.24.09.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Apr 2025 09:20:42 -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 V2 5/5] cpufreq: Force sync policy boost with global boost on sysfs update Date: Thu, 24 Apr 2025 21:50:18 +0530 Message-Id: <852ff11c589e6300730d207baac195b2d9d8b95f.1745511526.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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If the global boost flag is enabled and policy boost flag is disabled, a call to `cpufreq_boost_trigger_state(true)` must enable the policy's boost state. The current code misses that because of an optimization. Fix it. Suggested-by: Lifeng Zheng Reviewed-by: Lifeng Zheng Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0ad459bc8f84..4ac5d4fcfdd4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2863,8 +2863,10 @@ static int cpufreq_boost_trigger_state(int state) unsigned long flags; int ret =3D 0; =20 - if (cpufreq_driver->boost_enabled =3D=3D state) - return 0; + /* + * Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to + * make sure all policies are in sync with global boost flag. + */ =20 write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver->boost_enabled =3D state; --=20 2.31.1.272.g89b43f80a514