Skip to contentSkip to conversation

vhost: fix features ack

PATCH Applied Michael S. Tsirkin 7 participants 24 messages Mar 31, 2010 – Apr 13, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: fix features ack

From: David L Stevens <[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

 hw/virtio-net.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
hw/virtio-net.c +8 -0
index 9ddd58c..4c7c46e 100644
@@ -218,6 +218,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
                         (features >> VIRTIO_NET_F_GUEST_ECN)  & 1,
                         (features >> VIRTIO_NET_F_GUEST_UFO)  & 1);
     }
+    if (!n->nic->nc.peer ||
+        n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return;
+    }
+    if (!tap_get_vhost_net(n->nic->nc.peer)) {
+        return;
+    }
+    return vhost_net_ack_features(tap_get_vhost_net(n->nic->nc.peer), features);
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.0.2.280.gc6f05
#1 lore raw
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Regards,

Anthony Liguori

Quoted 23 lines
  hw/virtio-net.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
hw/virtio-net.c +8 -0
index 9ddd58c..4c7c46e 100644
@@ -218,6 +218,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
                          (features>>  VIRTIO_NET_F_GUEST_ECN)&  1,
                          (features>>  VIRTIO_NET_F_GUEST_UFO)&  1);
      }
+    if (!n->nic->nc.peer ||
+        n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return;
+    }
+    if (!tap_get_vhost_net(n->nic->nc.peer)) {
+        return;
+    }
+    return vhost_net_ack_features(tap_get_vhost_net(n->nic->nc.peer), features);
  }
 
  static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
#2 lore raw
Quoted 18 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori <[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 8 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl <[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Quoted 31 lines

Regards,

Anthony Liguori

Quoted 23 lines
  hw/virtio-net.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
hw/virtio-net.c +8 -0
index 9ddd58c..4c7c46e 100644
@@ -218,6 +218,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
                          (features>>  VIRTIO_NET_F_GUEST_ECN)&  1,
                          (features>>  VIRTIO_NET_F_GUEST_UFO)&  1);
      }
+    if (!n->nic->nc.peer ||
+        n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return;
+    }
+    if (!tap_get_vhost_net(n->nic->nc.peer)) {
+        return;
+    }
+    return vhost_net_ack_features(tap_get_vhost_net(n->nic->nc.peer), features);
  }
 
  static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
#3 lore raw
Quoted 33 lines · Luiz Capitulino
Quoted 18 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori <[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 8 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 7 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl <[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Signature · 1 line
MST
#4 lore raw
Quoted 52 lines · Michael S. Tsirkin
Quoted 35 lines · Luiz Capitulino
Quoted 19 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 8 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 9 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 8 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl<[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

Quoted 3 lines

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Compiling objects once is certainly useful. Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

With respect to regressions, it might make sense to slow down these refactorings a bit and increase the amount of regression testing that is happening during them.

Regards,

Anthony Liguori

#5 lore raw
Quoted 3 lines · Anthony Liguori

Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

I'm not so sure. It's pretty low on my list of priorities. Most users only need one target, speed of execution and/or features is likely much more important for them, and these refactorings make code more generic and harder to extend.s

#6 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 4 lines · Anthony Liguori

Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

I'm not so sure. It's pretty low on my list of priorities. Most users only need one target, speed of execution and/or features is likely much more important for them, and these refactorings make code more generic and harder to extend.s

We ought to have a set of device models that are compiled once, with well defined interfaces that model the actual way the various buses communicate. This should all roll into a generic CPU API. Then we should have a set of CPU implementations with choices including various TCG targets and KVM targets.

You can still compile out TCG targets that you don't care about but the key point is to get all of these interfaces correct.

This refactoring effort isn't really paying attention to improving interfaces which I think is a bit problematic.

Regards,

Anthony Liguori

#17 lore raw
In reply to Michael S. Tsirkin
Quoted 42 lines · Michael S. Tsirkin
Quoted 33 lines · Luiz Capitulino
Quoted 18 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori <[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 8 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 7 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl <[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Quoted 6 lines

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

As has been explained many times, knowledge about CPU specific features has no place in devices. Actively removing CPU specifics from devices is good but preventing new bad code to be committed is better.

I don't have distro computing powers (unless some distro's compute center only has two low power machines) and I guess some other developers don't have either. All developers and patch submitters are expected to compile all targets. This patch set has decreased the number of files compiled by about 20%.

Quoted 2 lines

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Maybe I'll try to remember this as your favourite problem solving approach if I happen to dislike the changes your patches may cause in the future. ;-)

#18 lore raw
Quoted 55 lines · Blue Swirl
Quoted 42 lines · Michael S. Tsirkin
Quoted 33 lines · Luiz Capitulino
Quoted 18 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 8 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 7 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716
Author: Blue Swirl<[email protected]>
Date: Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Quoted 7 lines

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

As has been explained many times, knowledge about CPU specific features has no place in devices. Actively removing CPU specifics from devices is good but preventing new bad code to be committed is better.

Quoted 6 lines

I don't have distro computing powers (unless some distro's compute center only has two low power machines) and I guess some other developers don't have either. All developers and patch submitters are expected to compile all targets. This patch set has decreased the number of files compiled by about 20%.

BTW, this seems to do it. I'll commit after some testing.

Regards,

Anthony Liguori

From 7c1920d330fcf7ed5b477bc8e22ca4f7e5e2b343 Mon Sep 17 00:00:00 2001
From: Anthony Liguori <[email protected]>
Date: Wed, 31 Mar 2010 14:20:11 -0500
Subject: [PATCH] Fix -enable-kvm

commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl <[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once

Introduced a regression in -enable-kvm because it left CONFIG_KVM in kvm.h while allowing compiled-once objects to use kvm.h. CONFIG_KVM is set on a per-target basis.

commit 53b67b3052f39b049bc7c79ae1ce132c90098c6c

Author: Blue Swirl <[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Compile acpi only once

Also regressed -enable-kvm because of a thinko.

Once we make these changes, the if(0) magic of kvm_enabled() no longer works so we need empty stub functions.

---
 hw/acpi.c     |    3 +-
 kvm-generic.c |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 kvm.h         |    9 ++--
 3 files changed, 139 insertions(+), 6 deletions(-)
 create mode 100644 kvm-generic.c
hw/acpi.c +2 -1
index 33c6bc8..5c01c2e 100644
@@ -529,7 +529,8 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
 
     register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
 
-    if (kvm_enabled) {
+    s->kvm_enabled = kvm_enabled;
+    if (s->kvm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running.  KVM does not
          * support SMM mode. */
         pci_conf[0x5B] = 0x02;
kvm-generic.c new file +133 -0

133 lines not on this page · raw message

kvm.h +4 -5
index 4f77188..9f57fd5 100644
@@ -19,11 +19,10 @@
 
 extern int kvm_allowed;
 
-#ifdef CONFIG_KVM
-#define kvm_enabled() (kvm_allowed)
-#else
-#define kvm_enabled() (0)
-#endif
+static inline int kvm_enabled(void)
+{
+    return kvm_allowed;
+}
 
 struct kvm_run;
 
Signature · 1 line
1.6.5.2
#10 lore raw
In reply to Anthony Liguori
Quoted 71 lines · Anthony Liguori
Quoted 22 lines · Michael S. Tsirkin
Quoted 19 lines · Luiz Capitulino
Quoted 14 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 11 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git
vhost

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is what I'm currently testing. With vhost disabled, the following

seg

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right

now in master,

Quoted 7 lines
Quoted 7 lines

bisect says it's:

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl<[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000
Quoted 5 lines
Quoted 4 lines

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to

introduce

Quoted 1 line

churn and bugs, they actively make it harder to extend qemu as you can't

use

Quoted 9 lines

target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Quoted 7 lines

Compiling objects once is certainly useful. Long term, I think most of us
want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

With respect to regressions, it might make sense to slow down these
refactorings a bit and increase the amount of regression testing that is happening during them.

I think there are only a few useful refactorings left. MIPS was interesting because of fourfold savings, likewise triple savings with PPC. Refactoring i386/x86_64 devices may be worthwhile, the rest not.

#7 lore raw
In reply to Anthony Liguori
Quoted 24 lines · Anthony Liguori
Quoted 9 lines · Michael S. Tsirkin
Quoted 5 lines · Anthony Liguori

Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

I'm not so sure. It's pretty low on my list of priorities. Most users only

need

Quoted 1 line

one target, speed of execution and/or features is likely much more

important for them,

Quoted 3 lines

and these refactorings make code more generic and harder to extend.s

We ought to have a set of device models that are compiled once, with well
defined interfaces that model the actual way the various buses communicate. This should all roll into a generic CPU API. Then we should have a set of CPU implementations with choices including various TCG targets and KVM targets.

Quoted 5 lines

You can still compile out TCG targets that you don't care about but the key
point is to get all of these interfaces correct.

This refactoring effort isn't really paying attention to improving
interfaces which I think is a bit problematic.

I agree, but with improved memory API, the questionable byte swapping could be eliminated from devices. Do you plan to finish your earlier RFC patches? Were there problems with them?

#8 lore raw
Quoted 8 lines · Blue Swirl
Quoted 4 lines

This refactoring effort isn't really paying attention to improving
interfaces which I think is a bit problematic.

I agree, but with improved memory API, the questionable byte swapping could be eliminated from devices. Do you plan to finish your earlier RFC patches? Were there problems with them?

It's a matter of figuring out a way to do it that makes everyone happy :-)

Regards,

Anthony Liguori

#19 lore raw
In reply to Anthony Liguori
Quoted 75 lines · Anthony Liguori
Quoted 15 lines · Blue Swirl
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Luiz Capitulino
Quoted 8 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost

patchset?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

http://repo.or.cz/w/qemu/aliguori-queue.git
vhost

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is what I'm currently testing. With vhost disabled, the

following seg

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at

fault

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716
Author: Blue Swirl<[email protected]>
Date: Mon Mar 29 19:23:52 2010 +0000

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you

can't use

Quoted 2 lines
Quoted 2 lines

target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely

to

Quoted 5 lines
Quoted 4 lines

need to build on more than one target, distros have enough computing power to build in parallel.

As has been explained many times, knowledge about CPU

specific

Quoted 10 lines

features has no place in devices. Actively removing CPU specifics from devices is good but preventing new bad code to be committed is better.

I don't have distro computing powers (unless some distro's compute center only has two low power machines) and I guess some other developers don't have either. All developers and patch submitters are expected to compile all targets. This patch set has decreased the number of files compiled by about 20%.

Quoted 1 line

BTW, this seems to do it. I'll commit after some testing.

But this makes kvm_enabled() check dynamic and code that was eliminated by compiler for !CONFIG_KVM will now be generated.

Wouldn't adding CONFIG_KVM to config-host.h also solve the problem?

#9 lore raw
In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Anthony Liguori

Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

I'm not so sure. It's pretty low on my list of priorities. Most users only need one target, speed of execution and/or features is likely much more important for them, and these refactorings make code more generic and harder to extend.s

Depends on the user, I suppose. Having 32-bit and 64-bit variants of the same architecture in a single binary would be useful. Having big-endian and little-endian variants of an architecture supported in a single binary would be useful (bonus points if you don't duplicate target-specific code excessively). Having a gigantic all-singing, all-dancing QEMU is perhaps not so useful, but between there and where we are now, there are definitely useful points.

-Nathan

#11 lore raw
In reply to Anthony Liguori
Quoted 53 lines · Anthony Liguori
Quoted 52 lines · Michael S. Tsirkin
Quoted 35 lines · Luiz Capitulino
Quoted 19 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 8 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 9 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 8 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl<[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

Quoted 8 lines
Quoted 3 lines

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Compiling objects once is certainly useful. Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

While it probably make sense to achieve this goal, it doesn't mean it should be done the dirty way.

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#12 lore raw
Quoted 8 lines · Aurelien Jarno

While it probably make sense to achieve this goal, it doesn't mean it should be done the dirty way.

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

Yeah, I'm having real trouble with the KVM regression. I thought I had it fixed but linux-user really made a mess of things. There's no simple solution that doesn't require quite a bit of refactoring which I'd rather do in a less ugly way. We've already been discussing getting rid of all the kvm_enabled() stuff and I think doing that properly is going to be needed to handle this correctly.

I'm thinking we should back out the vl.c changes and try to clean up the KVM bits first. Does that sound reasonable blueswirl or can you think of a cleaner way to deal with kvm?

Regards,

Anthony Liguori

#13 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Aurelien Jarno

While it probably make sense to achieve this goal, it doesn't mean it should be done the dirty way.

Quoted 8 lines
Quoted 4 lines

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

Yeah, I'm having real trouble with the KVM regression. I thought I had it fixed but linux-user really made a mess of things. There's no simple solution that doesn't require quite a bit of refactoring which I'd rather do in a less ugly way. We've already been discussing getting rid of all the kvm_enabled() stuff and I think doing that properly is going to be needed to handle this correctly.

I'm thinking we should back out the vl.c changes and try to clean up the KVM bits first. Does that sound reasonable blueswirl or can you think of a cleaner way to deal with kvm?

And back out can just mean making vl.c compile per-target (along with the thinko fix in acpi.c). That would be a nice temporary solution until we worked out the kvm_enabled() bits correctly.

Regards,

Anthony Liguori

Quoted 4 lines

Regards,

Anthony Liguori

#20 lore raw
In reply to Blue Swirl
Quoted 4 lines

But this makes kvm_enabled() check dynamic and code that was eliminated by compiler for !CONFIG_KVM will now be generated.

Wouldn't adding CONFIG_KVM to config-host.h also solve the problem?

CONFIG_KVM is (and should be) a per-target decision.

Paul

#21 lore raw
In reply to Blue Swirl
Quoted 6 lines · Blue Swirl
Quoted 2 lines

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Maybe I'll try to remember this as your favourite problem solving approach if I happen to dislike the changes your patches may cause in the future. ;-)

My patches are usually posted on list for a week or two before commit to the main tree. So if there's anything to dislike, you just need to post your objections, no reason to go through commit/revert churn.

Signature · 1 line
MST
#14 lore raw
In reply to Anthony Liguori
Quoted 12 lines · Anthony Liguori
Quoted 9 lines · Aurelien Jarno

While it probably make sense to achieve this goal, it doesn't mean it should be done the dirty way.

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

Quoted 6 lines

Yeah, I'm having real trouble with the KVM regression. I thought I had it
fixed but linux-user really made a mess of things. There's no simple solution that doesn't require quite a bit of refactoring which I'd rather do in a less ugly way. We've already been discussing getting rid of all the kvm_enabled() stuff and I think doing that properly is going to be needed to handle this correctly.

Strange, does linux-user use kvm.h (indirectly)?

#15 lore raw
Quoted 15 lines · Blue Swirl
Quoted 13 lines · Anthony Liguori
Quoted 10 lines · Aurelien Jarno

While it probably make sense to achieve this goal, it doesn't mean it should be done the dirty way.

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

Quoted 9 lines
Quoted 7 lines

Yeah, I'm having real trouble with the KVM regression. I thought I had it
fixed but linux-user really made a mess of things. There's no simple solution that doesn't require quite a bit of refactoring which I'd rather do in a less ugly way. We've already been discussing getting rid of all the kvm_enabled() stuff and I think doing that properly is going to be needed to handle this correctly.

Strange, does linux-user use kvm.h (indirectly)?

Yes, because various things in target-i386 use kvm.h.

Regards,

Anthony Liguori

#16 lore raw
In reply to Aurelien Jarno
Quoted 64 lines · Aurelien Jarno
Quoted 53 lines · Anthony Liguori
Quoted 52 lines · Michael S. Tsirkin
Quoted 35 lines · Luiz Capitulino
Quoted 19 lines · On Wed, 31 Mar 2010 13:26:23 -0500 Anthony Liguori<[email protected]>…
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens<[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 8 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

http://repo.or.cz/w/qemu/aliguori-queue.git vhost

Quoted 9 lines

Is what I'm currently testing. With vhost disabled, the following seg faults:

qemu-system-x86_64 -hda ~/images/linux.img -net tap -net nic,model=virtio -enable-kvm

But not when using TCG. I'm not sure that it's your patches at fault and I'm attempting to bisect now to figure that out.

Probably this is the same segfault I'm getting right now in master,
bisect says it's:

Quoted 8 lines

"""
commit ad96090a01d848df67d70c5259ed8aa321fa8716

Author: Blue Swirl<[email protected]>
Date:   Mon Mar 29 19:23:52 2010 +0000

Refactor target specific handling, compile vl.c only once
"""

Why are the compile once patches helpful? They seem to introduce churn and bugs, they actively make it harder to extend qemu as you can't use target-specific code in code that is compiled once, they might have performance penalty - and what do we gain? Any given user is unlikely to need to build on more than one target, distros have enough computing power to build in parallel.

Quoted 8 lines
Quoted 3 lines

Maybe it makes sense to revert the compile once patches, and discuss these issues before re-commit?

Compiling objects once is certainly useful. Long term, I think most of us want to see a single qemu executable that works for all architectures and compiling once is an important step in that direction.

Quoted 7 lines

While it probably make sense to achieve this goal, it doesn't mean it
should be done the dirty way.

For example it is known for a lot of time that the solution for the bswap in the device code is to add a bus model doing the byteswapping. Removing the #ifdef by deciding "this device will only be big/little endian" doesn't seem to go in the right direction.

That was not the goal of the patch, so it doesn't go in the right direction with regards to bus model. The bus model will need a lot of changes for the devices, but since we are not there yet, we don't know what would be the right changes either.

My guess is that the need for byte swapping just disappears for devices. Then the changes done now may or may not be useful. Where I made separate byte swapping and non-swapping versions, perhaps passing the endianness flag and the swapping version will be deleted. The endianness flag may still be useful at board level to decide whether the byte twisting bus will be installed or not. In PPC cases, the bswap lines will be deleted. For the devices that I haven't touched, there are a few #ifdef lines more to be deleted.

#22 lore raw
In reply to Michael S. Tsirkin
Quoted 9 lines · Michael S. Tsirkin

From: David L Stevens <[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 8 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

 hw/virtio-net.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Just making sure this patch does not get lost in the noise:
now that vhost net support is merged, please apply this patch on top. Thanks!

Quoted 21 lines
hw/virtio-net.c +8 -0
index 9ddd58c..4c7c46e 100644
@@ -218,6 +218,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
                         (features >> VIRTIO_NET_F_GUEST_ECN)  & 1,
                         (features >> VIRTIO_NET_F_GUEST_UFO)  & 1);
     }
+    if (!n->nic->nc.peer ||
+        n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return;
+    }
+    if (!tap_get_vhost_net(n->nic->nc.peer)) {
+        return;
+    }
+    return vhost_net_ack_features(tap_get_vhost_net(n->nic->nc.peer), features);
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.0.2.280.gc6f05
#23 lore raw
In reply to Michael S. Tsirkin
Quoted 7 lines · Michael S. Tsirkin

From: David L Stevens <[email protected]>

vhost driver in qemu didn't ack features, and this happens to work because we don't really require any features. However, it's better not to rely on this. This patch passes features to vhost as guest acks them.

Quoted 7 lines

---

Anthony, here's a fixup patch to address an issue in vhost patches. Incidentially, what's the status of the vhost patchset?

Thanks, applied.

Quoted 27 lines
 hw/virtio-net.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
hw/virtio-net.c +8 -0
index 9ddd58c..4c7c46e 100644
@@ -218,6 +218,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
                         (features >> VIRTIO_NET_F_GUEST_ECN)  & 1,
                         (features >> VIRTIO_NET_F_GUEST_UFO)  & 1);
     }
+    if (!n->nic->nc.peer ||
+        n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return;
+    }
+    if (!tap_get_vhost_net(n->nic->nc.peer)) {
+        return;
+    }
+    return vhost_net_ack_features(tap_get_vhost_net(n->nic->nc.peer), features);
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
Signature · 1 line
1.7.0.2.280.gc6f05
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net