Archive-only list for patches
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Shinji Nomoto <fj5851bi@fujitsu.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 6.16-6.6] cpupower: Fix a bug where the -t option of the set subcommand was not working.
Date: Mon, 25 Aug 2025 08:14:59 -0400	[thread overview]
Message-ID: <20250825121505.2983941-10-sashal@kernel.org> (raw)
In-Reply-To: <20250825121505.2983941-1-sashal@kernel.org>

From: Shinji Nomoto <fj5851bi@fujitsu.com>

[ Upstream commit b3eaf14f4c63fd6abc7b68c6d7a07c5680a6d8e5 ]

The set subcommand's -t option is documented as being available for boost
configuration, but it was not actually functioning due to a bug
in the option handling.

Link: https://lore.kernel.org/r/20250522061122.2149188-2-fj5851bi@fujitsu.com
Signed-off-by: Shinji Nomoto <fj5851bi@fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

**Backport Status: YES**

This commit is a clear bug fix that should be backported to stable
kernel trees. Here's my detailed analysis:

## Bug Analysis

The commit fixes a critical bug where the `-t` option for the `cpupower
set` subcommand was documented and accepted as a valid option (defined
in `set_opts[]` structure), but was completely non-functional due to a
missing character in the `getopt_long()` call.

### Specific Code Changes

The bug is in line 58-59 of the original code:
```c
while ((ret = getopt_long(argc, argv, "b:e:m:",
                          set_opts, NULL)) != -1) {
```

The fix adds the missing `t:` to the argument string:
```c
while ((ret = getopt_long(argc, argv, "b:e:m:t:",
                          set_opts, NULL)) != -1) {
```

### Root Cause

When the turbo-boost feature was added in commit `eb426fc6bdd6` (merged
in v6.6-rc1), the developer:
1. Added the option to the `set_opts[]` array correctly
2. Added the case handler for 't' in the switch statement
3. **BUT forgot to add "t:" to the getopt_long argument string**

This means that while the option was defined and had handling code,
`getopt_long()` would never recognize `-t` as a valid option, making the
feature completely unusable.

## Why This Should Be Backported

1. **Clear Bug Fix**: This is an obvious bug where documented
   functionality doesn't work at all. Users trying to use `cpupower set
   -t` or `--turbo-boost` would get errors.

2. **Small and Contained**: The fix is a single-line change adding 2
   characters ("t:") to a string. This is as minimal as fixes get.

3. **No Side Effects**: The change only enables already-implemented
   functionality. It doesn't introduce new code paths or change existing
   behavior.

4. **User Impact**: The turbo-boost control feature is important for
   power management, and users on stable kernels with v6.6+ would expect
   this documented feature to work.

5. **Affects Stable Versions**: The bug was introduced in v6.6-rc1 and
   affects all kernels from v6.6 onwards that include the turbo-boost
   feature.

6. **Low Risk**: There's virtually no regression risk - the worst case
   is the option continues not working, which is the current state.

This is exactly the type of fix that stable kernel rules recommend: a
clear bug fix that restores documented functionality with minimal code
change and no architectural modifications.

 tools/power/cpupower/utils/cpupower-set.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index 0677b58374ab..59ace394cf3e 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -62,8 +62,8 @@ int cmd_set(int argc, char **argv)
 
 	params.params = 0;
 	/* parameter parsing */
-	while ((ret = getopt_long(argc, argv, "b:e:m:",
-						set_opts, NULL)) != -1) {
+	while ((ret = getopt_long(argc, argv, "b:e:m:t:",
+				  set_opts, NULL)) != -1) {
 		switch (ret) {
 		case 'b':
 			if (params.perf_bias)
-- 
2.50.1


  parent reply	other threads:[~2025-08-25 12:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 12:14 [PATCH AUTOSEL 6.16-5.15] fs: writeback: fix use-after-free in __mark_inode_dirty() Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16-6.1] cdc_ncm: Flag Intel OEM version of Fibocom L850-GL as WWAN Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16-6.6] LoongArch: Save LBT before FPU in setup_sigcontext() Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16] btrfs: clear block dirty if submit_one_sector() failed Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16] platform/x86/amd: pmc: Drop SMU F/W match for Cezanne Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16] LoongArch: Add cpuhotplug hooks to fix high cpu usage of vCPU threads Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16-6.12] btrfs: zoned: skip ZONE FINISH of conventional zones Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16-5.10] drm/amd/display: Don't warn when missing DCE encoder caps Sasha Levin
2025-08-25 12:14 ` [PATCH AUTOSEL 6.16-6.1] Bluetooth: hci_sync: Avoid adding default advertising on startup Sasha Levin
2025-08-25 12:14 ` Sasha Levin [this message]
2025-08-25 12:15 ` [PATCH AUTOSEL 6.16-6.12] drm/rockchip: vop2: make vp registers nonvolatile Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250825121505.2983941-10-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=fj5851bi@fujitsu.com \
    --cc=patches@lists.linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox