Stuttering GPU passthrough, or maybe CPU?


Recommended Posts

I have found some info here https://www.redhat.com/archives/vfio-users/2016-February/msg00206.html its the same processor as i have, and according to this guy it helped to allocate multiple cores to the same virtual core, like this

<vcpupin vcpu='0' cpuset='4-5'/>
However, unRAID does only seem to use the first nr that is entered after the = mark, so in this example unraid only used core nr 4 and not the inteded 4 and 5.

And when i click edit on my VM after i have enabled this using the xml edit only core 4 is checked.

 

Is there any other way i can make it so my VM uses 2 real cores per virtual core?

 

While I have done some manual manipulation of the XML's for UnRAID, I have not played with the vcpu - logical assignments directly.

So if you edit the XML manually, and change the setting from 1 - 1 (vcpu to logical) to be 1 - 2, and save, when you go to edit XML again, does your input persist?

I would think it should.

 

You can also use the <emulatorpin cpuset => entry for core assignment to force the emulator (440FX) to run on a specific core, and not interfere with interrupts from the host (UnRAID).

You can assign it to the same cores as the VM, or an alternate core just for its usage.

You'll have to play/experiment as needed, but should help if latency is the main issue.

You'll find this discussion here https://www.redhat.com/archives/vfio-users/2015-September/msg00041.html

Link to comment

Changes that i make stay, but when i set 0-1 the VM only recognizes the 0, and when i open the gui edit in the webgui i only see the nr 0 selected (the xml file still shows 0-1).

 

I tried <emulatorpin cpuset => and when i selected the same cores as the vm was using i got rly horrible results, the DPC Latency program was all red, but when i changed to different cores then the vm was using i got better results, still not nearly good enough tho.

 

When i have multiple chrome windows open and for example a youtube video at the same time my vm cpu freaks out completely and stays at 100% all the time. So i am beginning to think its CPU related for sure...

Link to comment

Changes that i make stay, but when i set 0-1 the VM only recognizes the 0, and when i open the gui edit in the webgui i only see the nr 0 selected (the xml file still shows 0-1).

 

I tried <emulatorpin cpuset => and when i selected the same cores as the vm was using i got rly horrible results, the DPC Latency program was all red, but when i changed to different cores then the vm was using i got better results, still not nearly good enough tho.

 

When i have multiple chrome windows open and for example a youtube video at the same time my vm cpu freaks out completely and stays at 100% all the time. So i am beginning to think its CPU related for sure...

What you are seeing is how it is supposed to look if I understand the explanation correct. The VM will only see one virtual core, but unraid will give it both 0 and 1. You will not see this reflected in the VM template as it doesn't care about the custom tags you make in the edit XML. Limetech have to program support for the tag you are using first.

Link to comment

I am now trying this

  <cputune>
    <vcpupin vcpu='0' cpuset='4-5'/>
    <vcpupin vcpu='1' cpuset='6-7'/>
    <emulatorpin cpuset='2-3'/>
  </cputune>

 

And this should make my vm believe i have 2 cores at around 8Ghz per core since 1 physical core is around 4Ghz, but my vm only reports 2 cores at 4Ghz.

 

Or is there any other way i can see if it works or not? System feels slow so i dont think it works.

Link to comment

I don't think you will see the cores in the VM at 8 GHz  :)

Try running some benchmarks. Passmark should be good. Don't know if its free or not though.

 

I did this and i got way less scores when trying to use 2x cores for each vm core, so i would say unraid dont support this, unless there is some other way of doing it that i am not aware of. When looking at the forum i posted about earlier it seems that vfio supports this outside of unraid.

 

Edit:

To clarify the picture, upper test is

  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4-5'/>
    <vcpupin vcpu='1' cpuset='6-7'/>
    <emulatorpin cpuset='2-3'/>
  </cputune> 

and then the bottom test is

  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <emulatorpin cpuset='2-3'/>
  </cputune> 

cpu_test.png.a02b0bc32729cc1d55346d95946d2b89.png

Link to comment

I decided to see what the latency checker says for me, even though I don't feel lag/etc...

I moved the windows I had open around, pinned to the left, right.

Anyhow, almost every time I did it, I got a bad red spike

However it never felt felt anything other than as expected, bare metal, etc...

My mouse doesn't jerk, jump, nada.

 

Now you have a real issue with a game, and that is certainly not normal, however I think the latency checker results at times can be taken with a grain of salt. I do GPU accelerated playback regularly without issue, and 1080P YouTube play without any issues either. I don't have a 4k output like you however.

 

Didn't expect the result to look this bad.

latency.png.e6b76e374d869830f90e71eaa49ac6d7.png

Link to comment

I decided to leave the latency monitor app open while running some tests with PassMark Performance Test.

Most of the tests didn't generate a lot of spikes (2D, CPU, Memory), however the All option under Disk made the bars consistently as high as possible until completed (see pic of red bars spiked for a period of time).

Have you tried other Virtio drivers?

I know there have been complaints with the newest versions on the VFIO group, but not certain the exact issues.

latency2.png.fd58967e628893a2cf106c869c401073.png

Link to comment

I decided to see what the latency checker says for me, even though I don't feel lag/etc...

I moved the windows I had open around, pinned to the left, right.

Anyhow, almost every time I did it, I got a bad red spike

However it never felt felt anything other than as expected, bare metal, etc...

My mouse doesn't jerk, jump, nada.

 

Now you have a real issue with a game, and that is certainly not normal, however I think the latency checker results at times can be taken with a grain of salt. I do GPU accelerated playback regularly without issue, and 1080P YouTube play without any issues either. I don't have a 4k output like you however.

 

Didn't expect the result to look this bad.

 

The 4k videos on youtube lag even if i dont run them fullscreen. So i think you can still try them as reference, LinusTech have 4k if y are willing to try it out. My cpu goes to 100% on 4k and both video and sound stutters.

Link to comment

I don't think you will see the cores in the VM at 8 GHz  :)

Try running some benchmarks. Passmark should be good. Don't know if its free or not though.

 

I did this and i got way less scores when trying to use 2x cores for each vm core, so i would say unraid dont support this, unless there is some other way of doing it that i am not aware of. When looking at the forum i posted about earlier it seems that vfio supports this outside of unraid.

 

Edit:

To clarify the picture, upper test is

  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4-5'/>
    <vcpupin vcpu='1' cpuset='6-7'/>
    <emulatorpin cpuset='2-3'/>
  </cputune> 

and then the bottom test is

  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <emulatorpin cpuset='2-3'/>
  </cputune> 

That is definitely not working. Is it supported by the qemu unraid runs?

The score for the 4 cores looks good compared to around 9000 on all eight cores.

 

Edit: I read about the cputune section now and I think you have an error in the first setup with two vcpu and 4 host cores. You have set emulatorpin cpuset=2-3 and this overrides the vcpupin above if I remember correctly.

So try to change it to 2-5 or which cores you want the host to use.

Link to comment

I thought emulatorpin only told the host to run the emulator process on those specific cores?

 

Edit: what i mean is that i thought that the cores specified in emulatorpin was real cores that i could tell the host to offload some processes to.

Link to comment

 

That is definitely not working. Is it supported by the qemu unraid runs?

The score for the 4 cores looks good compared to around 9000 on all eight cores.

 

Edit: I read about the cputune section now and I think you have an error in the first setup with two vcpu and 4 host cores. You have set emulatorpin cpuset=2-3 and this overrides the vcpupin above if I remember correctly.

So try to change it to 2-5 or which cores you want the host to use.

 

I dont know what version of qemu unraid uses, have tried to figure it out but i dont rly know how. i think i read somewhere that cpuset 0-2 should be supported in qemu 0.9.0.

Link to comment

Since i am not entirely sure how emulatorpin is supposed to be used i removed it, but i still got the same results when trying to use 4 physical cores assigned to 2 virtual cores.

 
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4-5'/>
    <vcpupin vcpu='1' cpuset='6-7'/>
  </cputune> 

I still did not get the expected scores.

no_emulatorpin.png.8f3571d32d330ab45f78f9cddf044021.png

Link to comment

Let's look at some other possibilities causing your lag.

Was the GPU you passed through always the same as the one unraid grabs for the console? If so, could you install both GPUs and pass through the card that unraid do not use for the console?

 

Another thing is to reinstall windows and use ovmf instead of seabios.

 

Do you feel it's lagging also using the desktop?

Link to comment

I feel lag when i watch youtube or play games or have multiple chrome windows open at once.

I have tried the other gpu and got the same problem.

Also tried OVMF but i did not get far as it seems the vm got corrupted after 3 boots or so, could not even start it using the commands fs0: cd efs/boot bootx64.efs. Even tried using rEFInd boot manager.

Link to comment

Currently trying to get OVMF to work again, but after install and first reboot i just cant get it to work again. It installs just fine and in the middle of the install it reboots 2 times, those times i need to use fs0: cd efi/boot bootx64.efi to get it to start again, after sucessfull install i am left at the desktop and everything seems fine, after i then shutdown or reboot the vm i can not get it to start at all again. After running those commands again from the shell the vm just restarts.

So i mounted a secondary vdisk that have rEFInd on it and i can boot into that using the shell commands, and rEFInd can see the windows boot manager but the vm just restart again if i select it.

Link to comment

Currently trying to get OVMF to work again, but after install and first reboot i just cant get it to work again. It installs just fine and in the middle of the install it reboots 2 times, those times i need to use fs0: cd efi/boot bootx64.efi to get it to start again, after sucessfull install i am left at the desktop and everything seems fine, after i then shutdown or reboot the vm i can not get it to start at all again. After running those commands again from the shell the vm just restarts.

So i mounted a secondary vdisk that have rEFInd on it and i can boot into that using the shell commands, and rEFInd can see the windows boot manager but the vm just restart again if i select it.

 

Extract the file located here...https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-0-20160309.b1592.gc31313d.noarch.rpm

Inside the RPM package is another file that needs to be extracted, extract both using 7zip application.

Once extracted, locate the file OVMF-pure-efi in usr\share\edk2.git\ovmf-x64 and copy it to /boot/config.

In your XML, locate the following and change the OVMF path to like this below...

  <os>

    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>

    <loader type='pflash'>/boot/config/OVMF-pure-efi.fd</loader>

 

Start your VM

 

If configured correctly it should boot fine.

Link to comment

 

Extract the file located here...https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-0-20160309.b1592.gc31313d.noarch.rpm

Inside the RPM package is another file that needs to be extracted, extract both using 7zip application.

Once extracted, locate the file OVMF-pure-efi in usr\share\edk2.git\ovmf-x64 and copy it to /boot/config.

In your XML, locate the following and change the OVMF path to like this below...

  <os>

    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>

    <loader type='pflash'>/boot/config/OVMF-pure-efi.fd</loader>

 

Start your VM

 

If configured correctly it should boot fine.

 

When i extract the second file i find nothing inside it.

Also where is /boot/config? is it in the vdisk for my vm? If so how do i get access to the files inside whitout having a vm running? do i need to mount that vdisk to another working vm?

 

Edit: Oh, I guess u mean /boot/config in the unraid os?

Link to comment

Managed to extract it, was just me not being used to 7zip.

However when i try to move the file from a shared unraid folder to the place described i get this

sudo mv OVMF-pure-efi.fd /boot/config/OVMF-pure-efi.fd
mv: failed to preserve ownership for ‘/boot/config/OVMF-pure-efi.fd’: Operation not permitted

Link to comment

Managed to extract it, was just me not being used to 7zip.

However when i try to move the file from a shared unraid folder to the place described i get this

sudo mv OVMF-pure-efi.fd /boot/config/OVMF-pure-efi.fd
mv: failed to preserve ownership for ‘/boot/config/OVMF-pure-efi.fd’: Operation not permitted

 

The path to the OVMF file can be your share. I just used /boot/config as an example.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.