Skip to contentSkip to conversation

MSI-X doesn't work when running Windows as guest

Qemu-devel Gal Hammer 4 participants 8 messages Sep 12, 2013 – Sep 13, 2013

lore
Share & tools
lore

Gal Hammer

author
#0 lore raw

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2
msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!). pci_default_write_config addr: 66 value: 1 size: 2
msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device
ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
-drive

file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none \
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent

---< snip >---

Thanks,

Gal.

#1 lore raw
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Maybe we should change the default for new machine types and when -enable-kvm is specified?

Eduardo?
Anthony?

Signature · 1 line
MST
#2 lore raw
Quoted 59 lines · Michael S. Tsirkin
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Quoted 5 lines

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)? What exactly is missing on qemu64 that causes the above problem?

Signature · 1 line
Eduardo
#3 lore raw
Quoted 60 lines · Eduardo Habkost
Quoted 59 lines · Michael S. Tsirkin
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Quoted 8 lines
Quoted 5 lines

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)?

This will likely mean extending tcg to emulate more CPU features. Do you want to spend cycles on this?

Quoted 2 lines

What exactly is missing on qemu64 that causes the above problem?

I remember windows checks that cpu is modern enough to enable msi-x.
Dont' remember the exact details.

Quoted 2 lines
Signature · 1 line
Eduardo
#4 lore raw
Quoted 64 lines · Michael S. Tsirkin
Quoted 63 lines · Eduardo Habkost
Quoted 62 lines · Michael S. Tsirkin
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)?

This will likely mean extending tcg to emulate more CPU features. Do you want to spend cycles on this?

Why? Features that are not supported by TCG are automatically removed on from CPUID on X86CPU initialization.

Quoted 7 lines
Quoted 3 lines

What exactly is missing on qemu64 that causes the above problem?

I remember windows checks that cpu is modern enough to enable msi-x.
Dont' remember the exact details.

It would be interesting to find out what exactly is necessary to make this work. Adding new feature bits to qemu64 should be harmless for TCG, but increasing family/model too much without adding new features may require a little more testing to check if guests don't get confused.

Signature · 1 line
Eduardo
#5 lore raw
Quoted 81 lines · Eduardo Habkost
Quoted 64 lines · Michael S. Tsirkin
Quoted 63 lines · Eduardo Habkost
Quoted 62 lines · Michael S. Tsirkin
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)?

This will likely mean extending tcg to emulate more CPU features. Do you want to spend cycles on this?

Why? Features that are not supported by TCG are automatically removed on from CPUID on X86CPU initialization.

Quoted 4 lines
Quoted 3 lines

What exactly is missing on qemu64 that causes the above problem?

Quoted 8 lines
Quoted 3 lines

I remember windows checks that cpu is modern enough to enable msi-x.
Dont' remember the exact details.

It would be interesting to find out what exactly is necessary to make this work. Adding new feature bits to qemu64 should be harmless for TCG, but increasing family/model too much without adding new features may require a little more testing to check if guests don't get confused.

That's why I'm saying switching to kvm64 is easier.

Quoted 2 lines
Signature · 1 line
Eduardo
#6 lore raw
Quoted 86 lines · Michael S. Tsirkin
Quoted 85 lines · Eduardo Habkost
Quoted 64 lines · Michael S. Tsirkin
Quoted 63 lines · Eduardo Habkost
Quoted 62 lines · Michael S. Tsirkin
Quoted 47 lines · Gal Hammer

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)?

This will likely mean extending tcg to emulate more CPU features. Do you want to spend cycles on this?

Why? Features that are not supported by TCG are automatically removed on from CPUID on X86CPU initialization.

Quoted 7 lines
Quoted 3 lines

What exactly is missing on qemu64 that causes the above problem?

I remember windows checks that cpu is modern enough to enable msi-x.
Dont' remember the exact details.

Quoted 6 lines
Quoted 4 lines

It would be interesting to find out what exactly is necessary to make this work. Adding new feature bits to qemu64 should be harmless for TCG, but increasing family/model too much without adding new features may require a little more testing to check if guests don't get confused.

That's why I'm saying switching to kvm64 is easier.

Thinking back I think it's the CPU model that does it. Gal, could you please try adding -cpu qemu64,model=6? Also please try -cpu kvm64,model=2.

Quoted 2 lines
Quoted 2 lines
Signature · 1 line
Eduardo
#7 lore raw

Am 13.09.2013 14:31, schrieb Michael S. Tsirkin:

Quoted 92 lines · Michael S. Tsirkin
Quoted 91 lines · Eduardo Habkost
Quoted 89 lines · Michael S. Tsirkin
Quoted 64 lines · Eduardo Habkost
Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Gal Hammer
Quoted 47 lines

Hi,

I've notice that the virtio-serial Windows' driver doesn't use MSI-X vectors when running using upstream qemu or qemu-kvm-1.2.2-13.fc18.x86_64. The same VM works with MSI-X when using qemu-kvm-0.12.1.2-2.355.el6.x86_64.

From what I saw, Windows is trying to enable MSI-X by writing a 2 bytes value to device's PCI-config address 66h.

So when everything works well the flow goes like this:

pci_default_write_config value: 8000 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: e107 len: 2
pci_default_write_config value: 1 len: 2
msix_enabled 0 (67)
pci_default_write_config value: 8001 len: 2
msix_enabled 1 (67)

But on upstream it goes:

pci_default_write_config addr: 66 value: 8000 size: 2 pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)
pci_default_write_config addr: 66 value: e307 size: 2 (NOTE: Value is diffrent!).
pci_default_write_config addr: 66 value: 1 size: 2 msix_enabled 0 (67)

(NOTE: Missing the write of 8001).

My qemu's command line:

---< snip >---

/usr/bin/qemu-kvm -m 1G -smp 2 -enable-kvm -usb -device usb-tablet \
-device

ide-drive,drive=drive-virtio0-0-0,id=virtio0-0-0,bootindex=1 \
        -drive file=win7_32_viorng.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none
\
        -monitor stdio \
        -vga qxl -spice id=on,disable-ticketing,port=5903 \
        -device virtio-serial-pci,id=virtio-serial0,vectors=2 \
        -chardev spicevmc,id=spicechannel0,name=vdagent
Quoted 5 lines

---< snip >---

Thanks,

Gal.

So it's a known change from qemu-kvm to qemu.
With qemu-kvm the default cpu was kvm64.
With qemu the default cpu is qemu64 even if you use -enable-kvm.

Not an issue for libvirt as that specifies -cpu, but will be an issue for command-line users.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe we should change the default for new machine types and when -enable-kvm is specified?

What about simply making qemu64 as good as kvm64 (on newer machine-types)?

This will likely mean extending tcg to emulate more CPU features. Do you want to spend cycles on this?

Why? Features that are not supported by TCG are automatically removed on from CPUID on X86CPU initialization.

Quoted 7 lines
Quoted 3 lines

What exactly is missing on qemu64 that causes the above problem?

I remember windows checks that cpu is modern enough to enable msi-x.
Dont' remember the exact details.

It would be interesting to find out what exactly is necessary to make this work. Adding new feature bits to qemu64 should be harmless for TCG, but increasing family/model too much without adding new features may require a little more testing to check if guests don't get confused.

Quoted 4 lines
Quoted 1 line

That's why I'm saying switching to kvm64 is easier.

Thinking back I think it's the CPU model that does it. Gal, could you please try adding -cpu qemu64,model=6?

Or try git://github.com/afaerber/qemu-cpu.git qom-cpu branch, which has Eduardo's model=6 patch already. (Please keep me in the loop.)

Andreas

Quoted 6 lines

Also please try -cpu kvm64,model=2.

Quoted 2 lines
Quoted 2 lines
Signature · 1 line
Eduardo
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg