From patchwork Thu Apr 24 16:20:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 884171 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 235702820D3 for ; Thu, 24 Apr 2025 16:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511631; cv=none; b=QD/Mv6kQ9jysvTXg5WYDvvxW6jmirmfpjbF2EAmv5P+Zl92rMu75yylt1hjSUkLVPoPLRblT3kItleraGTiNRlzzuvsHUKWh0nJNnQJnA2yZLZCdMMxPfh9PzVPYGc/3rTsnd5spfc1q+3ibUHCYVEgxqDabMHjkdxT1R3XM2+Q= 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.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="KNiYkABA" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-22423adf751so14402845ad.2 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=LqW5xEnspe/SCB9pqEjzSTlWWOXJWQildNjhX8sxJs+JJP+JtLNC8w1qcmvq7SsEVb 5TDg3W6Bz8lvQGSaxENDdwoXAF5vL8CaAq88DBTGEjsTKaPzV+unGifUq75dymTymzd6 bKg3wTb6vrBFNPY8QmVJbhHCKRqESmGH2P2AcC9/clVL6bGd6NZCDw4RLhoLIiYvdcos vssbFefiks/SfkgPbVaxV7sjL7F9HGGWr5FIRnATJzma3QniG9HjujTqlAYZ66kbcopv en6pmNTwqf3UiPwuwCiDgFZClnC8V/JGej+tzv/wb+nNswLcxRXwmuCos1XuKHOsO85m A+tw== X-Gm-Message-State: AOJu0YzzabG1ps86jW1TfdY/3cgR/0BqffWuRJWN+WfD+cXySAK1GOx2 P6ZWThwijVMv0akOOwIQfoZ/oe7CnJBcB6tMuQjtg/hz3Ny5wu6uXN/BeN4nRfk= X-Gm-Gg: ASbGncssFcqdmVD458Ytkj6n6wDc3Rvo1gaRZM6mVtIcjxC9oaHH0zzg3Z78LY9tEgj 8DMx9/kxZCeCJ3kZq1bSxGkKfNsRPxK1bU96UktRY+nlpwMzT0oqnyZXFYEW2SEvld+Hc7jJK5Q iwqjMbdtixhsMNUKqj7Bb+4wR42fCvB4kgiKDE+pQL0ipiQii03Kj6PUjMUd9kXj2Vbu6dhHAt0 uFo6+yuPHtJXmLKXSfZ8d7pj3oTRt1nbUGK/iyIXlPthYfYHKYKAT0qcd61zUKmLPsWzF/1Hylz hgFhETa6/6PeZ332xa+fi0hY7p9odc6mkp7zRAdhTw== 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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—even if it was originally disabled—once 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_init()") Reported-by: Nicholas Chin Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220013 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 != freq_table[0].frequency) pr_warn(FW_WARN "P-state 0 is not max freq\n"); - if (acpi_cpufreq_driver.set_boost) - policy->boost_supported = 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 != boost_state(cpu)) + set_boost(policy, policy->boost_enabled); + } else { + policy->boost_supported = true; + } + } return result; From patchwork Thu Apr 24 16:20:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 884170 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 B6769284B5C 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-3081f72c271so1260012a91.0 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=UIWsMiOwjcwuGOYCI9vvGcFtXjqQAaU6c1qvGPlp6l1EEOjtWsSkeJyDcB4ijRflgL x7AhAwBIk+AcraSQ6koTT847GLJBSHcApoiyhNrxjoVoTtozDUl/TV/uF6dOVNt8haiN DGX8TfcRQgsqZ8MO5qqgjXVVwe3Luk6yHLdwTGfPXsMvEb/v+XOT8+SQeQg3cEXukSD5 HeFhBTNeKFtSNdaKl1/vWFVvLRxkjnqU+sWJ7Hq67ETh1ln8rceRHWpUL+QUePaiCJoP VnQLNXn7FdTvxOK7eCr07B2eYYvgFvHDULVdqTGMQXo3i5eFJOxP7Yy3+PT6tU4nBkPB CuiQ== X-Gm-Message-State: AOJu0YwaNu5OWaXvB6ezgp46DqeymubS9s+MZ0SMqKTsaPl+BOua4p6x cp8JjnbUp8le0vdvxmz8yWvsina+TFDRSgeGGS9IQWMGP6/PM7iU6bX0bA4quGM= X-Gm-Gg: ASbGnctqsN87Wk0nXVF4uXOfOP+osFBRg8x9gyS8oyPfkygqzOa4D05ECuBnBVTGfLu RgAm4P7IC+XqVsIudw6dvakSlc77+QUBO43J7wYBGY1MYpdm74bdz28PmKa4sYGZ8JkTPlobHYe DMBPHPs4Gud2fWHrWmMc65305QrMiBQnV0WlnvTBPC9OfxX6BnxiedkfzHOWZjJygUpxo96EbFd 7CHfqIetg4iF/1lVLheWwQOFg1GqTurK/iIVvk1sqj8unWCyw3xOL3aTRzcezHOgbgKcbynPKiU 9W4qjPfyR+A1UiSx4k75HwMYYmaZb75lLHagh0kFag== 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); } +static int policy_set_boost(struct cpufreq_policy *policy, bool enable) +{ + int ret; + + if (policy->boost_enabled == enable) + return 0; + + policy->boost_enabled = enable; + + ret = cpufreq_driver->set_boost(policy, enable); + if (ret) + policy->boost_enabled = !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_policy *policy, if (!policy->boost_supported) return -EINVAL; - if (policy->boost_enabled == enable) - return count; - - policy->boost_enabled = enable; - cpus_read_lock(); - ret = cpufreq_driver->set_boost(policy, enable); + ret = policy_set_boost(policy, enable); cpus_read_unlock(); - if (ret) { - policy->boost_enabled = !policy->boost_enabled; - return ret; - } + if (!ret) + return count; - return count; + return ret; } static struct freq_attr local_boost = __ATTR(boost, 0644, show_local_boost, store_local_boost); @@ -1618,15 +1627,12 @@ static int cpufreq_online(unsigned int cpu) 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 && - policy->boost_enabled != cpufreq_boost_enabled()) { - policy->boost_enabled = cpufreq_boost_enabled(); - ret = cpufreq_driver->set_boost(policy, policy->boost_enabled); + if (cpufreq_driver->set_boost && policy->boost_supported) { + ret = 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 = !policy->boost_enabled; + str_enable_disable(cpufreq_boost_enabled())); } } @@ -2861,15 +2867,12 @@ static int cpufreq_boost_trigger_state(int state) cpus_read_lock(); for_each_active_policy(policy) { - if (!policy->boost_supported || policy->boost_enabled == state) + if (!policy->boost_supported) continue; - policy->boost_enabled = state; - ret = cpufreq_driver->set_boost(policy, state); - if (ret) { - policy->boost_enabled = !policy->boost_enabled; + ret = policy_set_boost(policy, state); + if (ret) goto err_reset_state; - } } cpus_read_unlock(); From patchwork Thu Apr 24 16:20:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 884169 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.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 3BDFC289345 for ; Thu, 24 Apr 2025 16:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745511644; cv=none; b=eyc15yKjcUs+xVEJoteb2hZmYse0HNXpQ72bwoQXndqdayB2/YJ5AXi9ejL+xGersO9IterwuNHRv36cx8fXvdSKMLLokc5Ymx8Tbr0lOpgHLOHGVXZm5mAspq+bRxRSMdTni6qC51rgteJ7sbEn5vnsUhOhYsNf5+WiRHMQSn4= 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.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="ezjT/iNz" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2295d78b45cso19647355ad.0 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=VoNtKczRakzHAO7LZFOFCAQHaIVMiCltQjLNhXSwcNAmqLgGeORwUpNUJ6ToRWTpZK rBe4GsjSDhKp74BIZ/VHoBln6DcqMRYBPhpTHhej3jM9iw/nLFHT5GGE2OgxmDRgGzcC AfFtMYbbHkd4BjY8sm/GfYajCiAx93fa4FMvJ0rFtH/IV1+r98LENNDWgyfyBGhWpPi8 IQ/aWEOnv86D31FKN1wvENXwj9MhfoSMP26vsKlBcdedTVvqTT/LygWSlljHnvoTDqPS 3cZ/LsB4oycWA+4K0GtkTHEWDbBDwd8RsMxA5zj159UUeUdGaurN80mQ1TifMTONs52+ qFkg== X-Gm-Message-State: AOJu0YzAfiCWrPtPNg7zfw8YLDH8GmuTm9JAlUcAkrUAllUp1BVimN7L CHMP4X2UrcHi+kQBcrrKgiFrLHYMJ3/d6vjL3U0O2YIzE9oOtDRQdIVOOp2hUKY= X-Gm-Gg: ASbGncvTpcCvCcL1tI/mU8U3YN5/FUQja8jNHgzGF3CUt4NGoQg4dhJKFOujAg63Nn5 kQD0u7zdvKVDewmUCb67SPcKTysrbJnmekZGzt/tEWO0/vptP3DIQMLF3kGCjJDb4QXThy2gAZ7 w9+RiNmcsPuydOe+9bC30IfGaE+rTHvRkzSQgz8pW8hGT2MhLlnFNSUJIro5dTFkCxuZ2HwUBco IQnUvPreSKYTZeWH3PDPzJMFWXzMrMu0aoYjoX1Kk/F+xlM/ByY7anZEFoaf7Ta/NKGVsJBEMvt 74DvLjq++75Ttuo4mS6vkA+VVnaVKczo1fagPQMQQw== 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 = 0; - if (cpufreq_driver->boost_enabled == 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. + */ write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver->boost_enabled = state;