Giter Club home page Giter Club logo

vfio-tools's Introduction

VFIO-Tools

A collection of tools and scripts that aim to make PCI passthrough a little easier. For more in-depth guides on how to use these tools, as well as PCI passthrough related news, benchmarks and tutorials, visit us on https://passthroughpo.st

libvirt_hooks

QEMU hook helper

This contains a hook-helper for libvirt which allows easier per-VM hooks. Simply drop the qemu file in $SYSCONFDIR/libvirt/hooks/ (usually /etc/libvirt/hooks) and you're ready to add hooks. You can have a virtually limitless number of hook scripts per VM and per hook call, just keep in mind that a failed hook will prevent a VM from starting. The way to add hooks is as follows:

  • Create a file in a path matching this structure:
$SYSCONFDIR/libvirt/hooks/qemu.d/vm_name/hook_name/state_name/yourhook.conf
  • You can put anything you like in the hook, as long as you make sure you start your hook with a hashbang (i.e. #!/bin/bash).
  • When you're done setting up your hook, run chmod +x on your hook file to make it executable.
  • If you've added the qemu hook helper file for the first time, you need to restart libvirt in order for it to be detected.

switch_displays.sh

This hook allows you to automatically switch your monitor input to your VM's display. To achieve this you need to have ddcutil installed and working and you need a DDC/CI capable monitor. For a more detailed explanation and write-up, check out https://passthroughpo.st

vfioselect

vfio-pci helper

Makes assigning PCI devices to vfio-pci a bit easier, can generate modprobe rules, or bind a device to vfio-pci without needing to reboot. Requires dialog.

Usage: vfioselect [<arguments>]
  -t,--tmpfile  <path>   Specify path to temporary file
  -g,--genfile  <path>   Specify path to modprobe rule
  -o,--online            Attempt to bind/unbind without the need to reboot
  -h,--help              Display this help dialogue
  • vfioselect parses the rules that you define, if you have a rule already made, it is best to rename it to the default for vfioselect (vfioselect.conf), but a config file can be specified via -g /path/to/config.conf
  • If binding with a GPU shared between host and guest, it might be a good idea to use a qemu hook to switch input after the machine boots.

 

We enjoy creating these tools for the community and everything we make is completely free and open source -- but developing them takes a lot of time and effort. Consider becoming a Patron to keep projects like these alive.

vfio-tools's People

Contributors

basharkey avatar bsherman avatar jolan avatar kdrag0n avatar mdplusplus avatar sharkwipf avatar shoelaceman avatar stefsinn avatar tkoham avatar w23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vfio-tools's Issues

Somewhat confused about the hugepages hooks

I'm no expert, so please forgive me if I'm missing something obvious here. But when I look at the two hooks for hugepages - alloc_hugepages.sh and unalloc_hugepages.sh - two things appear odd to me:

  1. The comment block at the top instructs the user to place both files into both /prepare/begin/ and /release/end/. Is this really correct? Surely you would only want the alloc hook when starting up the VM, and would only want the unalloc hook when shutting it down?

  2. The alloc hook defines a prepMemory function, but as far as I can tell (with my limited Bash knowledge), nothing ever calls it? Is it not important to prepare that memory for allocation?

hugepages.sh script doesn't handle start[ed]/begin hooks

After upgrading to libvirt 7.0.0 (at least, the version published to Arch's community package repo on 1/20/2021) I started getting errors from the hugepages.sh script. It was trying to call functions for the start/begin and started/begin events.

I'm not sure what has changed as the libvirt docs mention those qemu events being in place for years now, and I never received these errors before.

Creating some empty functions with the appropriate names seems to be working on my machine.

How generate TOTAL_CORES_MASK and HOST_CORES_MASK

TOTAL_CORES_MASK=FF # 0-7, bitmask 0b11111111

HOST_CORES_MASK=11 # 0,4, bitmask 0b00010001

how to generate this values?

i have a 48thread machine (dual cpu), i have pinning my VM like this

  <cputune>
    <vcpupin vcpu='0' cpuset='10'/>
    <vcpupin vcpu='1' cpuset='34'/>
    <vcpupin vcpu='2' cpuset='11'/>
    <vcpupin vcpu='3' cpuset='35'/>
    <vcpupin vcpu='4' cpuset='22'/>
    <vcpupin vcpu='5' cpuset='46'/>
    <vcpupin vcpu='6' cpuset='23'/>
    <vcpupin vcpu='7' cpuset='47'/>
  </cputune>

and use this in kernel parameters

isolcpus=10,11,22,23,34,35,46,47 nohz_full=10,11,22,23,34,35,46,47 rcu_nocbs=10,11,22,23,34,35,46,47

how adapt these values to my config?

greetings

Can't launch VMs when using hooks

Sorry if this is a very beginner question, I'm trying to set up a macOS VM in a notebook with a single graphics card, so I read this guide

When using the hook script I can't launch the VM and when I try to stop the service ´sudo systemctl stop libvirtd.service´, the libvirtd process uses 100% CPU and never stops the service and I have to force restart the system.

Are there logs that I can give you to help me troubleshoot this?

When trying -o: "syntax error in expression"

I'm trying to pass my Powercolor RX Vega 64 to my guest as shown in this screenshot:
Screenshot

When I use sudo vfioselect -o I get the following error:

/etc/modprobe.d/vfioselect.conf written successfully.
Bind: 30:00.0
30:00.1
Unbind:

./vfioselect: line 107: 30:00.0
30:00.1: syntax error in expression (error token is ":00.0
30:00.1")

When I start it without the -o switch I have no problems however.

EDIT: After a reboot the devices are actually still bound to amdgpu instead of vfio-pci. So even when it's not giving me an error message, it is actually not working.

Guess I'll go back to manually edit the module files myself.

EDIT 2: Sry, it actually works after issuing a sudo update-initramfs -u. There should be a notification that this update is not automatically performed by vfioselect.
There's still the syntax error when using the -o switch, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.