Witko / nvidia-xrun

Utility to run separate X with discrete nvidia graphics with full performance
GNU General Public License v2.0
488 stars 69 forks source link

nvidia-xrun says /sys/bus/pci/devices/0000:00:01.0/power/control is not a dirrectory #162

Closed GrasSoft closed 2 years ago

GrasSoft commented 2 years ago

Hello, this is my first time submitting an issue, I hope I am writing in the right place. I have a Lenovo P52s laptop which has a quadro p500 along with its iGPU. I would like to use this dGPU while playing games or in blender. Found out that nvidia-xrun would to the trick. After following the arch wiki guide I got stuck on the above mentioned error. I do not know why it searches for that device on the pci because the dGPU id is PCI:2:0:0 and specified this in the /etc/X11/nvidia-xorg.conf.d/30-nvidia.conf Any idea? Thank you in advance!

michelesr commented 2 years ago

Have you read the readme ? You need to set the bus id both in the Xorg config and in /etc/default/nvidia-xrun (the last if you use a recent version, e.g. nvidia-xrun-git).

BTW have you tried to use prime offloading (prime-run) ? That might be easier than nvidia-xrun, but if you want to power manage the nvidia card you still need some sort of script to do so.

michelesr commented 2 years ago

These are the scripts I'm using to turn the card off and on (and I have a systemd service similar to the off script to do that at boot):

GrasSoft commented 2 years ago

Have you read the readme ? You need to set the bus id both in the Xorg config and in /etc/default/nvidia-xrun (the last if you use a recent version, e.g. nvidia-xrun-git).

BTW have you tried to use prime offloading (prime-run) ? That might be easier than nvidia-xrun, but if you want to power manage the nvidia card you still need some sort of script to do so.

https://wiki.archlinux.org/title/Lenovo_ThinkPad_P52s according to this link it is not very compatible with my system.

GrasSoft commented 2 years ago

Have you read the readme ? You need to set the bus id both in the Xorg config and in /etc/default/nvidia-xrun (the last if you use a recent version, e.g. nvidia-xrun-git).

BTW have you tried to use prime offloading (prime-run) ? That might be easier than nvidia-xrun, but if you want to power manage the nvidia card you still need some sort of script to do so.

/etc/default/nvidia-xrun are correctly set for both the NVIDIA graphic card and the PCI express controller that hosts it. How do i find the PCIe controller that hosts it?

michelesr commented 2 years ago

How do i find the PCIe controller that hosts it

lspci? It should look something like this:

00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 07)

Maybe try lspci | grep PCIe ?

GrasSoft commented 2 years ago

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08) 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07) 00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08) 00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model 00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21) 00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21) 00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21) 00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1) 00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1) 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1) 00:1d.2 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #11 (rev f1) 00:1f.0 ISA bridge: Intel Corporation Sunrise Point LPC Controller/eSPI Controller (rev 21) 00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21) 00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21) 00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21) 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21) 04:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78) 07:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01) 08:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01) 08:01.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01) 08:02.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01) 09:00.0 System peripheral: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] (rev 01) 3f:00.0 USB controller: Intel Corporation JHL6240 Thunderbolt 3 USB 3.1 Controller (Low Power) [Alpine Ridge LP 2016] (rev 01) 40:00.0 Non-Volatile memory controller: Lenovo Device 0006 This is what i get, no PCIe anywhere

michelesr commented 2 years ago

Maybe this:

Sunrise Point-LP PCI Express Root Port #7 (rev f1) 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI 
michelesr commented 2 years ago

Which version of nvidia-xrun are you using? If it's the last released version you won't need to set the controller, as that one relies on bbswitch rather than messing around with the bus directly in the scripts

GrasSoft commented 2 years ago

Which version of nvidia-xrun are you using? If it's the last released version you won't need to set the controller, as that one relies on bbswitch rather than messing around with the bus directly in the scripts

I use the latest one from git

GrasSoft commented 2 years ago

output.txt

This is my output when i try to run nvidia-xrun on tty3

michelesr commented 2 years ago

I use the latest one from git

If you're using latest master then it relies on Linux power management functions, so yeah you'll need to set the ids (card and bus) correctly. Make sure to format them properly, if you're not sure you can explore your filesystem at /sys/bus/pci/devices to find the right id format

michelesr commented 2 years ago

output.txt

This is my output when i try to run nvidia-xrun on tty3

Where's 28 coming from? The device id in lspci is 00:1d.0, try to find the equivalent in /sys/bus/pci/devices

GrasSoft commented 2 years ago

output.txt This is my output when i try to run nvidia-xrun on tty3

Where's 28 coming from? The device id in lspci is 00:1d.0, try to find the equivalent in /sys/bus/pci/devices

I tried 29 afterwards, isnt that the decimal representation of hex 1d?

michelesr commented 2 years ago

What's the output of ls /sys/bus/pci/devices?

GrasSoft commented 2 years ago

What's the output of ls /sys/bus/pci/devices?

0000:00:00.0 0000:00:14.0 0000:00:1c.6 0000:00:1f.2 0000:04:00.0 0000:08:02.0 0000:00:02.0 0000:00:14.2 0000:00:1d.0 0000:00:1f.3 0000:07:00.0 0000:09:00.0 0000:00:04.0 0000:00:16.0 0000:00:1d.2 0000:00:1f.4 0000:08:00.0 0000:3f:00.0 0000:00:08.0 0000:00:1c.0 0000:00:1f.0 0000:00:1f.6 0000:08:01.0 0000:40:00.0

michelesr commented 2 years ago

000:00:1d.0 should be your CONTROLLER_BUS_ID for the nvidia-xrun config file, but I'm not sure how it needs to be formatted in the Xorg configuration

michelesr commented 2 years ago

Note that this prints your bus id in hexadecimal, but the Xorg configuration script requires that you provide it in decimal, so you'll need to covert it. You can do this with bash:

Yeah looks like it. So you want the hex id for the controller in the /etc/default/nvidia-xrun config file then, and the decimal equivalent of the card id in the Xorg.conf file I think

michelesr commented 2 years ago

To be clear, here you need 000:00:1d.0 and here you need the decimal equivalent of the id for the card (note that you need to set also this correctly (by finding your card ID in lspci, there should be an NVIDIA card there)

Edit: changed some wrong links and typos above

GrasSoft commented 2 years ago

000:00:1d.0

there does not see, to be any dGPU on my lspci, i think it was removed on reboot

GrasSoft commented 2 years ago

output.txt You were right, now it finds the directory but i get this new error. Could be from my xinit script.

michelesr commented 2 years ago
sudo tee /sys/bus/pci/rescan <<<1

Should trigger a rescan and then the card should be there

GrasSoft commented 2 years ago

output.txt You were right, now it finds the directory but i get this new error. Could be from my xinit script.

if [ $# -gt 0 ]; then $* else gnome-session fi this is my xinit

michelesr commented 2 years ago
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86EmojiPicker
Errors from xkbcomp are not fatal to the X server

This is the error but I have no idea what it means, you'll need to do a research online.

michelesr commented 2 years ago
Could not find provider with name modesetting

Or maybe this? I'm not sure, sorry.

GrasSoft commented 2 years ago
sudo tee /sys/bus/pci/rescan <<<1

Should trigger a rescan and then the card should be there

02:00.0 3D controller: NVIDIA Corporation GP108GLM [Quadro P500 Mobile] (rev a1)

so the id 0000:02:00:00 is the GPU on the PCI.

michelesr commented 2 years ago
Could not find provider with name modesetting

It must be it as the xkbcomp error is not fatal.

michelesr commented 2 years ago

Is it something to do with the modesetting driver? Does your Intel graphic card support that?

michelesr commented 2 years ago

My guess, after reading this is that maybe the wrong card is selected as output (the Intel card with modesetting drivers should be used for it) but I'm not sure about it.

michelesr commented 2 years ago

I think you might need to be more explicit in the output configuration, e.g. hardcode the intel card id, maybe try to add MatchDriver "i915" to the output section? E.g.

Section "Device"
  Identifier "intel"
  MatchDriver "i915"
  Driver "modesetting"
  Option "AccelMethod" "none"
EndSection
GrasSoft commented 2 years ago

in the xorg.conf?

michelesr commented 2 years ago

in the xorg.conf?

Yes, in the xorg.conf for nvidia-xrun, in the section for the intel device. If that doesn't work either maybe hardcode the bus id for the intel card? Can't think of anything else, I'm not really expert with Xorg, sorry.

michelesr commented 2 years ago

@GrasSoft to avoid confusion maybe you should close this issue and open a different one for the Xorg problem? Also it might be worhty raising the issue somewhere else, as it involves drivers and Xorg more than nvidia-xrun itself

GrasSoft commented 2 years ago

@michelesr I came back, the problem is with xinitrc. I will close this issue and will post on the Xorg board. Thank you very much for your help.