Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions from RUNTIME_PM_ON_*="" are not possible atm #614

Closed
Mintulix opened this issue Jan 26, 2022 · 6 comments
Closed

Exceptions from RUNTIME_PM_ON_*="" are not possible atm #614

Mintulix opened this issue Jan 26, 2022 · 6 comments

Comments

@Mintulix
Copy link

TLP 1.5.0

What I want:
Using the Bios defaults for all PCI devices in AC and BAT mode with one exception (Nvidia dGPU should always be in PM-mode, because the Intel iGPU alone is used).

How to accomplish that:

Method 1a (works):

RUNTIME_PM_ON_AC="auto"
RUNTIME_PM_ON_BAT="auto"
RUNTIME_PM_DISABLE="..." # exclude all devices from PM that aren't in PM-mode by Bios default except the dGPU -> list 10 devices

Method 1b (works):

RUNTIME_PM_ON_AC="on"
RUNTIME_PM_ON_BAT="on"
RUNTIME_PM_ENABLE="..." # include all devices that are in PM-mode by Bios default, adding the dGPU -> list 13 devices

Method 2 (preferred, much more elegant, but it doesn't work because RUNTIME_PM_ENABLE is ignored):

RUNTIME_PM_ON_AC="" # Bios defaults
RUNTIME_PM_ON_BAT="" # Bios defaults
RUNTIME_PM_ENABLE="01:00.0" # always enable PM for the dGPU -> list 1 device

The "faulty" code part is in /usr/share/tlp/func.d/05-tlp-func-pm:

    if [ -z "$ccontrol" ]; then
        # do nothing if unconfigured
        echo_debug "pm" "set_runtime_pm($1).not_configured"
        return 0
    fi

I'm sure it's there for a reason, but for me disabling the "return 0" does the trick.
What do you think? Should method 2 be allowed, or rather why must there be a return if RUNTIME_PM_ON_* is unconfigured?

@linrunner
Copy link
Owner

linrunner commented Jan 27, 2022

Hi,

indeed a very special use case. Btw it's not BIOS defaults but kernel driver defaults.

RUNTIME_PM_ON_AC="", RUNTIME_PM_ON_BAT="" is explicitly meant (and documented) to disable the whole feature. I will have to think about whether it is safe to include RUNTIME_PM_ENABLE, RUNTIME_PM_DISABLE in the check as well.

In the meantime, you can trick the logic with an invalid value:

RUNTIME_PM_ON_AC="nil" 
RUNTIME_PM_ON_BAT="nil" 
RUNTIME_PM_ENABLE="01:00.0"

@Mintulix
Copy link
Author

Hi, thanks for your workaround. It works as expected, so you can leave the code unchanged. Perhaps this workaround should be documented?
My idea to leave as many settings unchanged from kernel driver as possible was, on AC the fans were driving me crazy and on BAT I had problems with some components after some time (still testing...).
Again, thank you for this program and your answer, for me this is fixed.

@linrunner
Copy link
Owner

@Mintulix What lasts long becomes implemented after all :-). If you still follow this: please test with the main branch.

Important: you need to change your config to

RUNTIME_PM_ON_AC="" 
RUNTIME_PM_ON_BAT="l" 
RUNTIME_PM_ENABLE="01:00.0"

because "nil" is now considered invalid and the whole feature skipped.

@Mintulix
Copy link
Author

Mintulix commented Dec 7, 2022

Hey, within one year, what more could one want? ;-)
I didn't test much more since then, because your workaround worked so great. TLP was doing its job in background, so all good.
Tested your changes and it works like before (with the nil-solution), thanks a lot for solving this special use case.

@linrunner
Copy link
Owner

Great. Thanks for testing.

@linrunner : add use case to the doc https://linrunner.de/tlp/settings/runtimepm.html

@linrunner
Copy link
Owner

Hi @ALL : TLP 1.6 Beta 1 is out and contains the change -> #700

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants