Patchwork MAkefile: dont rebuild vhost for each target

login
register
mail settings
Submitter Michael S. Tsirkin
Date Dec. 20, 2012, 2:20 p.m.
Message ID <20121220142037.GA23513@redhat.com>
Download mbox | patch
Permalink /patch/207668/
State New
Headers show

Comments

Michael S. Tsirkin - Dec. 20, 2012, 2:20 p.m.
We rebuild vhost_net for each target, but there's
no real reason to, we only have 2 variants: with and
without vhost-net.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 Makefile.target     | 1 +
 hw/Makefile.objs    | 5 +++--
 hw/vhost_net_stub.c | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 hw/vhost_net_stub.c
Paolo Bonzini - Dec. 20, 2012, 2:37 p.m.
Il 20/12/2012 15:20, Michael S. Tsirkin ha scritto:
> diff --git a/hw/vhost_net_stub.c b/hw/vhost_net_stub.c
> new file mode 100644
> index 0000000..387b578
> --- /dev/null
> +++ b/hw/vhost_net_stub.c
> @@ -0,0 +1 @@
> +#include "vhost_net.c"

Nice.  As a follow-up, can you perhaps split the vhost_net.c file in two
following the model of other *-stub.c files?

Paolo
Michael S. Tsirkin - Dec. 20, 2012, 2:54 p.m.
On Thu, Dec 20, 2012 at 03:37:58PM +0100, Paolo Bonzini wrote:
> Il 20/12/2012 15:20, Michael S. Tsirkin ha scritto:
> > diff --git a/hw/vhost_net_stub.c b/hw/vhost_net_stub.c
> > new file mode 100644
> > index 0000000..387b578
> > --- /dev/null
> > +++ b/hw/vhost_net_stub.c
> > @@ -0,0 +1 @@
> > +#include "vhost_net.c"
> 
> Nice.  As a follow-up, can you perhaps split the vhost_net.c file in two
> following the model of other *-stub.c files?
> 
> Paolo

Still thinking about this - keeping it all in a single file makes
it easier to change interfaces, OTOH making stub separate
means less platforms need to be rebuilt when only implementation
changes.
Stefan Hajnoczi - Jan. 4, 2013, 5:33 p.m.
On Thu, Dec 20, 2012 at 04:20:37PM +0200, Michael S. Tsirkin wrote:
> diff --git a/hw/Makefile.objs b/hw/Makefile.objs
> index 2778035..360a43c 100644
> --- a/hw/Makefile.objs
> +++ b/hw/Makefile.objs
> @@ -3,6 +3,9 @@ common-obj-y += loader.o
>  common-obj-$(CONFIG_VIRTIO) += virtio-console.o
>  common-obj-$(CONFIG_VIRTIO) += virtio-rng.o
>  common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
> +common-obj-$(CONFIG_VHOST_NET) += vhost_net.o
> +common-obj-$(CONFIG_VHOST_NET) += vhost.o
> +common-obj-$(CONFIG_NO_VHOST_NET) += vhost_net_stub.o
>  common-obj-y += fw_cfg.o
>  common-obj-$(CONFIG_PCI) += pci_bridge_dev.o
>  common-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o
> @@ -192,8 +195,6 @@ common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o
>  # need to fix this properly
>  obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
>  obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o
> -obj-$(CONFIG_SOFTMMU) += vhost_net.o
> -obj-$(CONFIG_VHOST_NET) += vhost.o
>  obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/
>  obj-$(CONFIG_VGA) += vga.o
>  obj-$(CONFIG_SOFTMMU) += device-hotplug.o

Careful, this change means that you're now including the system-wide
/usr/include/linux/vhost.h header file instead of QEMU's
linux-headers/linux/vhost.h.

I recently hit this with the dataplane patches since they include
virtio_ring.h.

On an outdated build host we may run into trouble when relying on the
system-wide header file.

(The -I linux-headers/ is only added in Makefile.target.)

Stefan
Anthony Liguori - Jan. 21, 2013, 9:41 p.m.
Hi,

Thank you for submitting your patch series.  This note is to inform
you that this patch series no longer applies against the latest
qemu.git tree.

If it's been at least a few days since you submitted this series,
please resubmit a new version of your patch series so it can be
considered for inclusion.  If you submitted recently, please wait a
few days for patch review feedback and then resubmit.

Here is the output from git-am:

Applying: MAkefile: dont rebuild vhost for each target
Using index info to reconstruct a base tree...
M	Makefile.target
M	hw/Makefile.objs
Falling back to patching base and 3-way merge...
Auto-merging hw/Makefile.objs
CONFLICT (content): Merge conflict in hw/Makefile.objs
Auto-merging Makefile.target
Failed to merge in the changes.
Patch failed at 0001 MAkefile: dont rebuild vhost for each target
The copy of the patch that failed is found in:
   /home/aliguori/.patches/git-working/.git/rebase-apply/patch
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


Regards,

Anthony Liguori

Patch

diff --git a/Makefile.target b/Makefile.target
index 8bbad38..f6fddbd 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -103,6 +103,7 @@  endif #CONFIG_BSD_USER
 #########################################################
 # System emulator target
 ifdef CONFIG_SOFTMMU
+CONFIG_NO_VHOST_NET = $(if $(subst n,,$(CONFIG_VHOST_NET)),n,y)
 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 2778035..360a43c 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -3,6 +3,9 @@  common-obj-y += loader.o
 common-obj-$(CONFIG_VIRTIO) += virtio-console.o
 common-obj-$(CONFIG_VIRTIO) += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
+common-obj-$(CONFIG_VHOST_NET) += vhost_net.o
+common-obj-$(CONFIG_VHOST_NET) += vhost.o
+common-obj-$(CONFIG_NO_VHOST_NET) += vhost_net_stub.o
 common-obj-y += fw_cfg.o
 common-obj-$(CONFIG_PCI) += pci_bridge_dev.o
 common-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o
@@ -192,8 +195,6 @@  common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 # need to fix this properly
 obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
 obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o
-obj-$(CONFIG_SOFTMMU) += vhost_net.o
-obj-$(CONFIG_VHOST_NET) += vhost.o
 obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/
 obj-$(CONFIG_VGA) += vga.o
 obj-$(CONFIG_SOFTMMU) += device-hotplug.o
diff --git a/hw/vhost_net_stub.c b/hw/vhost_net_stub.c
new file mode 100644
index 0000000..387b578
--- /dev/null
+++ b/hw/vhost_net_stub.c
@@ -0,0 +1 @@ 
+#include "vhost_net.c"