Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Blacklisting a GPU

  1. #1
    Join Date
    Aug 2021
    Location
    Italy
    Beans
    24
    Distro
    Kubuntu

    Red face Blacklisting a GPU

    Hello, I took a look at this guide https://www.youtube.com/watch?v=ID3dlVHDl0c.
    To cut a long story short it tells you to make sure to have virtualization extensions enabled ( I enabled vt-d and vt-x ), and after updating your system run a script ( https://github.com/pavolelsig/passth...lper_ubuntu_20), reboot and your second gpu should be bound to vfio-pci.
    After doing that if I run lspci -k I get this one



    01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050] (rev a1)
    Subsystem: NVIDIA Corporation GP107 [GeForce GTX 1050]
    Kernel driver in use: nouveau
    Kernel modules: nvidiafb, nouveau
    01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
    Subsystem: NVIDIA Corporation GP107GL High Definition Audio Controller
    Kernel driver in use: vfio-pci
    Kernel modules: snd_hda_intel

    Only the audio part is bound to vfio-pci.
    Any suggestions?
    Many thanks in advance, perhaps a noob like me shouldn't start learning ubuntu with these intimidating programs

  2. #2
    Join Date
    Sep 2006
    Location
    Minnesota, United States
    Beans
    621

    Re: Blacklisting a GPU

    Hi! *friendly hug* Don't beat yourself up.

    All "newbies" need to be given time to learn, and what works for one GNU/Linux distribution does not always work for another, especially in regards to boot processes. This is not an easy topic! Even the best of us get confused. You need to create or edit three files on an Ubuntu install if you want to bind your GPU to the VFIO driver.

    /etc/modprobe.d/nvidia.conf (to prevent the proprietary and opensource Nvidia drivers from being used).

    Code:
    blacklist nvidia
    blacklist nouveau
    blacklist nvidiafb
    blacklist nouveaufb

    /etc/modprobe.d/vfio.conf (to bind the devices to VFIO) Be sure to include the PCI addresses of both the video card and the onboard audio. You must have both. You can obtain them with

    Code:
    lspci -vnn
    .

    Code:
    options vfio-pci ids=<addresses>
    
    # ex. options vfio-pci ids=10de:1401,10de:0fba
    You should also add the vfio-pci driver to the init image.

    /etc/initramfs-tools/modules (to add the vFIO driver to the boot image)

    Code:
     List of modules that you want to include in your initramfs.
    # They will be loaded at boot time in the order below.
    #
    # Syntax:  module_name [args ...]
    #
    # You must run update-initramfs(8) to effect this change.
    #
    # Examples:
    #
    # raid1
    # sd_mod
    vfio-pci
    Then run
    Code:
    sudo update-initramfs -k all -u
    to update your system. Reboot, and viola, you should be good to go.

    Without digressing too much, you may also be required to modify your boot parameters. A lot depends on your version of GNU/Linux and your firmware. Please let me know if there is anything else I can do.
    Last edited by T.J.; August 25th, 2021 at 04:04 AM. Reason: clarity
    T.J.

  3. #3
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Blacklisting a GPU

    Please go back to your first post and edit it to wrap your output within [code] Put_output_and_commands_here [/code] tags... One, it makes it easier to read. It then doesn't accidentally screw with the forums software. And keeps you in good grace with the Moderators who have to remind people to do that... Looking after/for you.
    (Your link does not work in my locale, but that is not important...)

    Wait please...

    Where is the information for your other Video device? What is the VM Host that you are hosting from? And what will be your Guest VM?

    Because some of that is old news and you don't need to do depending on the VM Host you are using. For some systems, it's really isn't that hard anymore. And just bllindly blacklisting resources, with some VM guests is going to make that a problem in some cases now. Especially if the other video resource, is similar enough...)

    So lets start from square one. Please provide at least enough information that we may steer you in the right direction...

    You know you need two video devices to do a pass through right? Unless it is a headless server... Just saying. Where is the info for that?
    Last edited by MAFoElffen; August 25th, 2021 at 03:02 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  4. #4
    Join Date
    Sep 2006
    Location
    Minnesota, United States
    Beans
    621

    Re: Blacklisting a GPU

    Quote Originally Posted by MAFoElffen View Post
    Please go back to your first post and edit it to wrap your output within [code] Put_output_and_commands_here [/code] tags... One, it makes it easier to read. It then doesn't accidentally screw with the forums software. And keeps you in good grace with the Moderators who have to remind people to do that... Looking after/for you.
    Thanks for the advice. I realize you weren't necessarily referring to me, but it does help to outline the commands.
    T.J.

  5. #5
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Blacklisting a GPU

    Quote Originally Posted by T.J. View Post
    Thanks for the advice. I realize you weren't necessarily referring to me, but it does help to outline the commands.
    Welcome to the Virtualization Section! I wasn't referring to anyone. Just general information. What he is trying to do, he needs to provide some information for others to be able to help him... (In fact, some of us are presently working on a project to help users to be able to easily provide that...)

    I am assuming his Host is Ubuntu. That is what it sounds like from what he described. If he is using KVM as his VM Host, he can add a pass-through through directly from Virt-Manager, by going to his VM Guest's configuration panel, if he checks "Change Configuration before Installation" or from the Guest Details window while it is powered off:

    Add Virtual Hardware > Add Host PCI Device...Then it will display all the host's PCI devices, which when selected, will reserve that specific device for exclusive use by that VM Guest... (it also has a menu for host USB devices)

    If he is using VMware, similar. Windowed, GUI driven. No typing or searching to do manually.

    He needs to realize that it will be "Exclusive" to just that one VM Guest. He will no longer be able to use it for his host, until it is removed from that VM Guest configurations. The VM Host takes care of the blacklisting.

    Depending on what he wants to do, and the guests he wants to run, there are also other options now... Some of us are working with and testing VirGL... Which so far doesn't want to play well yet with NVidia... Other GPU's, better. But, LOL. We'll see how far we can stretch it.

    Please do not be a stranger here. User's need help here also.
    Last edited by MAFoElffen; August 25th, 2021 at 04:42 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  6. #6
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Blacklisting a GPU

    A bit preemptive, but to see what kernel VFIO "drivers" are built into your kernel:
    Code:
    # cat /lib/modules/$(uname -r)/modules.builtin | grep vfio
    kernel/drivers/vfio/vfio.ko
    kernel/drivers/vfio/vfio_virqfd.ko
    kernel/drivers/vfio/vfio_iommu_type1.ko
    kernel/drivers/vfio/pci/vfio-pci.korem
    They will not list them will lsmod...
    Last edited by MAFoElffen; August 25th, 2021 at 05:12 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  7. #7
    Join Date
    Sep 2006
    Location
    Minnesota, United States
    Beans
    621

    Re: Blacklisting a GPU

    Quote Originally Posted by MAFoElffen View Post
    Welcome to the Virtualization Section!
    Why thank you so much!

    It's been my experience that practicing hardware binding that it is just something that should be encouraged as a way to pass on knowledge. You are quite welcome to disagree of course. Using libvirt is not always practical. In rare cases, it actually causes software issues with Windows installations and certain firmware. RedHat, the primary developer of virt-manager, has plans to abandon it in favor of "cockpit" last I read; so helping others gain experience is even more important.

    Quote Originally Posted by MAFoElffen View Post
    Depending on what he wants to do, and the guests he wants to run, there are also other options now... Some of us are working with and testing VirGL... Which so far doesn't want to play well yet with NVidia... Other GPU's, better. But, LOL. We'll see how far we can stretch it.
    I sincerely hope your research turns out well.

    Quote Originally Posted by MAFoElffen View Post
    Please do not be a stranger here. User's need help here also.
    I hope I can.
    T.J.

  8. #8
    Join Date
    Aug 2021
    Location
    Italy
    Beans
    24
    Distro
    Kubuntu

    Smile Re: Blacklisting a GPU

    Thanks a lot for the replies
    So here is my system
    Operating System: Kubuntu 21.04
    KDE Plasma Version: 5.21.4
    KDE Frameworks Version: 5.80.0
    Qt Version: 5.15.2
    Kernel Version: 5.11.0-31-generic
    OS Type: 64-bit
    Graphics Platform: X11
    Processors: 4 × Intel® Core™ i5-7400 CPU @ 3.00GHz
    Memory: 7,6 GiB of RAM
    Graphics Processor: Mesa Intel® HD Graphics 630
    The GPU that I want to use in my virtual machine is a Nvidia GeForce GTX 1050.
    I am using Virtual Machine Manager 3.2.0 "Powered by libvirt" the hypervisor is QEMU/KVM.
    I made a Windows XP vm as a quick test and it works fine ( I know that my nvidia card does not support Winxp so I will make my gpu passthrough test with Win10)
    I am assuming his Host is Ubuntu. That is what it sounds like from what he described. If he is using KVM as his VM Host, he can add a pass-through through directly from Virt-Manager, by going to his VM Guest's configuration panel, if he checks "Change Configuration before Installation" or from the Guest Details window while it is powered off:

    Add Virtual Hardware > Add Host PCI Device...Then it will display all the host's PCI devices, which when selected, will reserve that specific device for exclusive use by that VM Guest... (it also has a menu for host USB devices)
    So is it possible to do everything using Virt-Manager even the blacklisting part?
    Thanks a lot
    Last edited by demonenero84; August 25th, 2021 at 11:40 AM.

  9. #9
    Join Date
    Sep 2006
    Location
    Minnesota, United States
    Beans
    621

    Re: Blacklisting a GPU

    Quote Originally Posted by demonenero84 View Post
    So is it possible to do everything using Virt-Manager even the blacklisting part?
    Thanks a lot
    Honestly, I have never tried, but I do not believe so. Every time I have tried to passthrough without binding the card first, virt-manager fails miserably.

    It is true you can manually unbind and rebind a driver without rebooting, but in my opinion that is overly complicated and rather unreliable. I find that the best way is to simply bind the hardware to the VFIO driver at boot time, assuming that you have a second video card. You can always release it later.

    I'd be happy to help you through the process of solving this problem. Any questions, just ask.
    T.J.

  10. #10
    Join Date
    Aug 2021
    Location
    Italy
    Beans
    24
    Distro
    Kubuntu

    Re: Blacklisting a GPU

    Thanks a lot,
    Can you tell me how to get permission to create and edit "nvidia.conf" and "vfio.conf" in /etc/modprobe.d/ directory?
    I can edit /etc/initramfs-tools/modules so I guess I just have to add what you told me
    assuming that you have a second video card
    Yes, I am using an integrated GPU ( Mesa Intel® HD Graphics 630 )
    Thanks in advance

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •