Skip to contentSkip to conversation

FAILED: patch "[PATCH] intel_idle: Adjust state names and descriptions for _LPI states" failed to apply to 7.3-stable tree

PATCH New Sasha Levin 1 participant 3 messages Nov 7 – Nov 10

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 4035247966859152a6523bc041f81cb9905695a5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 4035247966859152a6523bc041f81cb9905695a5 Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <[email protected]>
Date: Wed, 21 Oct 2026 17:56:08 +0200
Subject: [PATCH] intel_idle: Adjust state names and descriptions for _LPI
states

The value of the _LPI "State Name" field is used as the description of the given idle state (that is, the value of its "desc" attribute in sysfs) which is not consistent with idle state descriptions used when the idle state information comes from an ACPI _CST object.

To rectify that, use the _LPI "State Name" field value as the value of the "name" sysfs attribute of a given idle state and use the MWAIT hint value from the _LPI register address value to derive the value of its "desc" sysfs attribute in analogy with the _CST case.

Fixes abc5c103c66d ("intel_idle: Add ACPI _LPI support")
Cc 7.3+ <[email protected]> # 7.3+
[ rjw: Adjusted scnprintf() format string, tweaked changelog ]
---
 Documentation/admin-guide/pm/intel_idle.rst | 12 +++++++-----
 drivers/idle/intel_idle.c                   |  9 +++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/admin-guide/pm/intel_idle.rst +7 -5
index 996e5bd83c425..d1a6251790b80 100644
@@ -145,11 +145,13 @@ for the other idle state types (C2 and C3) the target residency value is 3 times
 the exit latency (again, that is because it reflects the target residency to
 exit latency ratio in the majority of cases for the processor models recognized
 by ``intel_idle``).  The name of the idle state (to be returned by the ``name``
-idle state attribute in ``sysfs``) is either "Cx_LPI" (if it comes from ``_LPI``
-processing) or "Cx_ACPI", where x is the index of that idle state in the final
-list (note that the minimum value of x is 1, because 0 is reserved for the
-"polling" state), and its target residency is based on the exit latency value.
-All of the idle states in the final list are enabled by default in this case.
+idle state attribute in ``sysfs``) either is equal to the state name value that
+comes from ``_LPI`` processing (with the possible fallback to "Cx_LPI" if the
+state name is not provided) or it is "Cx_ACPI", where x is the index of that
+idle state in the final list (note that the minimum value of x is 1, because 0
+is reserved for the "polling" state), and its target residency is based on the
+exit latency value.  All of the idle states in the final list are enabled by
+default in this case.
 
 
 .. _intel-idle-initialization:
drivers/idle/intel_idle.c +7 -2
index a045a384b949d..9f5e1c47aba29 100644
@@ -1903,8 +1903,13 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
 
 		state = &drv->states[drv->state_count++];
 
-		scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
-		strscpy(state->desc, lpi_state->desc);
+		if (strlen(lpi_state->desc) > 0)
+			strscpy(state->name, lpi_state->desc);
+		else
+			scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
+
+		scnprintf(state->desc, CPUIDLE_DESC_LEN, "ACPI LPI MWAIT 0x%02llx",
+			  lpi_state->address);
 		state->exit_latency = lpi_state->wake_latency;
 		state->target_residency = lpi_state->min_residency;
 		state->flags = MWAIT2flg(lpi_state->address);
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/2 intel_idle: Use 2-argument strscpy()

From: Andy Shevchenko <[email protected]>

[ Upstream commit 2094ae12eed8e83dd91a631ac0a582fee5934c36 ]

Use 2-argument strscpy(), which is not only shorter but also provides an additional check that destination buffer is an array.

Stable-dep-of: 403524796685 ("intel_idle: Adjust state names and descriptions for _LPI states")

---
 drivers/idle/intel_idle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/idle/intel_idle.c +2 -2
index 651408df9c24a..c5b65f7d7271c 100644
@@ -1906,7 +1906,7 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
 		state = &drv->states[drv->state_count++];
 
 		scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
-		strscpy(state->desc, lpi_state->desc, CPUIDLE_DESC_LEN);
+		strscpy(state->desc, lpi_state->desc);
 		state->exit_latency = lpi_state->wake_latency;
 		state->target_residency = lpi_state->min_residency;
 		state->flags = MWAIT2flg(lpi_state->address);
@@ -1956,7 +1956,7 @@ static void __init intel_idle_init_cstates_acpi_cst(struct cpuidle_driver *drv)
 		state = &drv->states[drv->state_count++];
 
 		snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate);
-		strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
+		strscpy(state->desc, cx->desc);
 		state->exit_latency = cx->latency;
 		/*
 		 * For C1-type C-states use the same number for both the exit
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/2 intel_idle: Adjust state names and descriptions for _LPI states

From: "Rafael J. Wysocki" <[email protected]>

[ Upstream commit 4035247966859152a6523bc041f81cb9905695a5 ]

The value of the _LPI "State Name" field is used as the description of the given idle state (that is, the value of its "desc" attribute in sysfs) which is not consistent with idle state descriptions used when the idle state information comes from an ACPI _CST object.

To rectify that, use the _LPI "State Name" field value as the value of the "name" sysfs attribute of a given idle state and use the MWAIT hint value from the _LPI register address value to derive the value of its "desc" sysfs attribute in analogy with the _CST case.

Fixes abc5c103c66d ("intel_idle: Add ACPI _LPI support")
Cc 7.3+ <[email protected]> # 7.3+
[ rjw: Adjusted scnprintf() format string, tweaked changelog ]
---
 Documentation/admin-guide/pm/intel_idle.rst | 12 +++++++-----
 drivers/idle/intel_idle.c                   |  9 +++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/admin-guide/pm/intel_idle.rst +7 -5
index 996e5bd83c425..d1a6251790b80 100644
@@ -145,11 +145,13 @@ for the other idle state types (C2 and C3) the target residency value is 3 times
 the exit latency (again, that is because it reflects the target residency to
 exit latency ratio in the majority of cases for the processor models recognized
 by ``intel_idle``).  The name of the idle state (to be returned by the ``name``
-idle state attribute in ``sysfs``) is either "Cx_LPI" (if it comes from ``_LPI``
-processing) or "Cx_ACPI", where x is the index of that idle state in the final
-list (note that the minimum value of x is 1, because 0 is reserved for the
-"polling" state), and its target residency is based on the exit latency value.
-All of the idle states in the final list are enabled by default in this case.
+idle state attribute in ``sysfs``) either is equal to the state name value that
+comes from ``_LPI`` processing (with the possible fallback to "Cx_LPI" if the
+state name is not provided) or it is "Cx_ACPI", where x is the index of that
+idle state in the final list (note that the minimum value of x is 1, because 0
+is reserved for the "polling" state), and its target residency is based on the
+exit latency value.  All of the idle states in the final list are enabled by
+default in this case.
 
 
 .. _intel-idle-initialization:
drivers/idle/intel_idle.c +7 -2
index c5b65f7d7271c..ec951c148d4a2 100644
@@ -1905,8 +1905,13 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
 
 		state = &drv->states[drv->state_count++];
 
-		scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
-		strscpy(state->desc, lpi_state->desc);
+		if (strlen(lpi_state->desc) > 0)
+			strscpy(state->name, lpi_state->desc);
+		else
+			scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
+
+		scnprintf(state->desc, CPUIDLE_DESC_LEN, "ACPI LPI MWAIT 0x%02llx",
+			  lpi_state->address);
 		state->exit_latency = lpi_state->wake_latency;
 		state->target_residency = lpi_state->min_residency;
 		state->flags = MWAIT2flg(lpi_state->address);
Signature · 1 line
2.53.0