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

Fixed suspend in nvidia and hybrid mode #127

Merged
merged 4 commits into from
Sep 11, 2023
Merged

Fixed suspend in nvidia and hybrid mode #127

merged 4 commits into from
Sep 11, 2023

Conversation

Boria138
Copy link
Contributor

@Boria138 Boria138 commented Sep 7, 2023

I had suspend not working on nvidia and hybrid mods after I added to envycontrol settings for nvidia from https://github.com/CachyOS/CachyOS-Settings everything worked.

I had suspend not working on nvidia and hybrid mods after I added to envycontrol settings for nvidia from https://github.com/CachyOS/CachyOS-Settings everything worked.
@bayasdev
Copy link
Owner

bayasdev commented Sep 7, 2023

I wonder if removing

options nvidia NVreg_PreserveVideoMemoryAllocations=1

prevents Gnome Wayland from showing up

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 7, 2023

I wonder if removing

options nvidia NVreg_PreserveVideoMemoryAllocations=1

prevents Gnome Wayland from showing up

As far as I know it defaults to 1, but I'll check that tomorrow and report back

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 7, 2023

Oh, a little off-topic pr but I'll write here anyway, I talked to someone who tweaks Nvidia for CachyOS about the fact that they include rtd3 by default on all cards including those that are not supported, referring to you I wrote that this is not a good practice, to which I replied that in Fedora also in the default drivers is rtd3 and no one has complained about the problem of power saving, so you have faq error rtd3 can be enabled on older cards before Turing nothing will happen.

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 8, 2023

It also seems to me that you can remove the disabling of usb devices because since the kernel version 5.5 they work normally, and now even on lts kernel like 5.15 so it is not to the point

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 9, 2023

@bayasdev I take it because my pr hides Wayland session in GDM you will not add it ? It's just that you haven't contacted me for a whole day, then I guess pr can be closed ?

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 9, 2023

If you're still going to take the pr I'll tweak it a bit, because even though Nvidia's website says that since kernel 5.5 all disable devices work fine with dynamic power management I've had my computer freeze during tests without disabling these devices, I guess I was too hasty in removing their disablement.

@pingarelho
Copy link

Is this on AMD + Nvidia? Cause I'm having issues on hybrid mode when waking up from sleep. I'm getting errors amdgpu: couldn't schedule ib on ring <gfx-low> and [amdgpu] *ERROR* Error scheduling IBs (-22).

@Boria138
Copy link
Contributor Author

Boria138 commented Sep 9, 2023

Is this on AMD + Nvidia? Cause I'm having issues on hybrid mode when waking up from sleep. I'm getting errors amdgpu: couldn't schedule ib on ring <gfx-low> and [amdgpu] *ERROR* Error scheduling IBs (-22).

I've only tested with intel + Nvidia, whether this fix will help you I don't know, but you can always grab envycontrol from my repository and try it out

@bayasdev
Copy link
Owner

If you're still going to take the pr I'll tweak it a bit, because even though Nvidia's website says that since kernel 5.5 all disable devices work fine with dynamic power management I've had my computer freeze during tests without disabling these devices, I guess I was too hasty in removing their disablement.

@Boria138 sadly I don't own any Nvidia hardware newer than Pascal so I'm unable to test your changes. Those Udev rules come from the official Nvidia docs through.

@Boria138
Copy link
Contributor Author

If you're still going to take the pr I'll tweak it a bit, because even though Nvidia's website says that since kernel 5.5 all disable devices work fine with dynamic power management I've had my computer freeze during tests without disabling these devices, I guess I was too hasty in removing their disablement.

@Boria138 sadly I don't own any Nvidia hardware newer than Pascal so I'm unable to test your changes. Those Udev rules come from the official Nvidia docs through.

I've already returned the rules back as without them there were freezes, which is strange because on the Nvidia website it is written that the drivers work normally with kernel 5.5, but no matter I returned it and also removed nvidia-uvm as specifically to manage hybrid graphics it is not needed, it only fixes the error in plymouth.

@Boria138
Copy link
Contributor Author

PR is ready and tested, I'd also like to ask @pingarelho to do a test as I only have intel and haven't checked if this will fix the sleep when using amd

@bayasdev
Copy link
Owner

@Boria138 also add a try catch block around the calls to subprocess.run where you toggle the systemd unit as it may fail on systems that use other init system

@Boria138
Copy link
Contributor Author

@bayasdev review my code please

@bayasdev
Copy link
Owner

@Boria138 thanks, will test later after I get access to my gaming laptop. So far it looks good.

@pingarelho
Copy link

@Boria138 will gladly test that for you when I have time! today or tomorrow I'll post an update here.

@pingarelho
Copy link

pingarelho commented Sep 11, 2023

Can confirm that this PR fixes waking up from sleep on my Ryzen 5 4600H + GTX 1650 laptop in hybrid mode with rtd3. Awesome.

@Boria138
Copy link
Contributor Author

@bayasdev I already wrote it above but I will repeat in the faq you wrote that using rtd3 on unsupported hardware increases battery consumption which is probably not true because first of all at the moment rtd3 is completely broken and therefore you could not make correct measurements secondly this feature is enabled by default at least in Fedora and Manjaro I have not noticed any complaints from owners of unsupported hardware so could you do the test again with my corrections so as not to mislead people if you are really wrong ?

@bayasdev bayasdev merged commit b93bdf4 into bayasdev:main Sep 11, 2023
@Boria138 Boria138 deleted the fix-suspend branch September 12, 2023 04:43
@@ -207,6 +217,15 @@ def graphics_mode_switcher(graphics_mode, user_display_manager, enable_force_com
f"Enable PCI-Express Runtime D3 (RTD3) Power Management: {rtd3_value or False}")
cleanup()

if logging.getLogger().level == logging.DEBUG:
service = subprocess.run(["systemctl", "enable", "nvidia-persistenced.service"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of using nvidia-persistenced? It doesn't bring any improvements for PRIME setups. Nvidia-persistenced only makes sense for headless computational graphics setups, i.e. without a running X session. This does not affect the operation of RTD3 in any way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before adding the inclusion of nvidia-persistent I ran some tests and without this service enabled the total system consumption was higher

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw no change on my system with AMD iGPU + 3050 Mobile when enabling nvidia-persistenced. Can you provide steps to reproduce the powerdown along with nvidia-persistenced? Just FYI that nvidia-persistenced, according to the source code, does nothing related to GPU power managment other than disabling NUMA memory blocks used by CUDA.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in your case nothing has changed since you have amd I have done tests on Nvidia + Intel bundle and with the service enabled the total system consumption which I looked through upower was lower by several watts to make sure that it is not a trivial error I have done these tests several times and the consumption was always lower with this service than without it.

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

Successfully merging this pull request may close these issues.

4 participants