Bug 216963

Summary: Power profile switch broken for Lenovo Thinkpad X1 Yoga (Gen 6) after upgrade 6.1.6 -> 6.1.7
Product: ACPI Reporter: Iyán (me)
Component: Power-ProcessorAssignee: acpi_power-processor
Status: RESOLVED CODE_FIX    
Severity: normal CC: agurenko, Chris, jakob.helgesson, johnsimcall, leodream2008, leonard.r.koenig, mpearson-lenovo, nate, plumerlis
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 6.1.7 Subsystem:
Regression: Yes Bisected commit-id:

Description Iyán 2023-01-23 22:31:51 UTC
Hi,

I cannot change between low-power, balanced and performance modes after upgrading to linux 6.1.7 on my Lenovo Thinkpad X1 Yoga (Gen 6).

Probably this patch is the culprit:
https://github.com/torvalds/linux/commit/fde5f74ccfc771941b018b5415fa9664426e10ad

I don't see anything else in the changelog that would cause issues with this.

I will gladly share any additional info needed to debug this.

Cheers,
Iyán
Comment 1 Mark Pearson 2023-01-24 03:19:34 UTC
Just a note that I am looking at this and have reproduced it. It's my fault - I think I made two dumbass mistakes in the patch you identified.

I have a fix that I'm testing locally - but I want to just do a bit more sanity before I push it for review - to make sure I don't make things worse (especially as it's late and I'm prone to making more mistakes in the evening). I'll aim to have it upstream for review tomorrow.

Many thanks for the bug - very much appreciated. I should have caught this one in testing but I didn't expect to have any effects on Intel platforms at all and missed it :( Sorry.

Mark
Comment 2 Iyán 2023-01-24 07:13:18 UTC
Hey Mark,

No problem, I'll be happy to test your new patch on my machine when it's ready.

Iyán
Comment 3 Nate Graham 2023-01-24 22:34:27 UTC
FWIW after upgrading to Kernel 6.1.7 on my X1 Yoga gen 4, I see a slightly different issue: attempting to switch to Balanced mode using Fn+H or the Plasma GUI switches to Powersave mode instead. Switching to Performance mode using Fn+H or the GUI still works. So effectively, the system only has Powersave and Performance modes right now.
Comment 4 Jakob 2023-01-25 16:37:34 UTC
Hey,

I'm running a Thinkpad X1 Carbon Gen 10 with an Intel Core i7 1260p.
For me, upgrading to 6.1.7 also broke power switching. In regular operation pressing Fn+L Fn+M Fn+H aka low-power (Low), balanced (Medium) and performance (High).

Since upgrading to 6.1.7 all of the above-mentioned keybinds all resulted in low-power being set. Manually echoing balanced to /sys/firmware/acpi/platform_profile results in the balanced mode being activated, however doing the same with performance results in instantly switching back to low-power.

If needed I'm happy to help out with testing possible fixes.

Jakob
Comment 5 Mark Pearson 2023-01-25 19:43:06 UTC
Hi Nate & Jakob,

That sounds like the same I am seeing on the X1C9. I think my patch will fix that for you.

The issue I introduced is that the code that reports back the profile mode got broken. I read the BIOS to determine the profile mode and had added a change to also determine the functional mode (MMC/PSC/AMT) at the same time (the standard API returns both). 

What I had missed is that some Intel platforms have a different API for getting the platform profile in MMC mode. It's honestly a bit of a BIOS quirkiness in implementation specific to some platforms. The problem is that API does not return the functional mode - and missing that broke how the operational mode is reported back to user space.

Upstream patch is: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=fixes&id=1bc5d819f0b9784043ea08570e1b21107aa35739

It's been accepted by the maintainer and marked for stable so hopefully it will propagate fairly quickly (the fix for the AMD platforms that broke this did!)

Mark
Comment 6 Iyán 2023-01-25 21:43:40 UTC
Hey Mark,

I build the kernel with your new patch and issue solved for me!

Cheers,
Iyán
Comment 7 Mark Pearson 2023-01-25 22:15:55 UTC
Phew! I've been testing it here but it takes time for each platform and today has been tied up with meetings - really appreciate the feedback. Thank you!
Comment 8 Leonard/Janis Robert König 2023-02-02 07:33:44 UTC
Fixed in 6.1.9 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/thinkpad_acpi.c?h=linux-6.1.y#n10519

Already gave it a test drive and everything is working back to normal.
Comment 9 Iyán 2023-02-02 07:42:44 UTC
Yeah, I updated to 6.1.9 using Arch's repos and it works just fine. Closing.