* [PATCH 2/4] kvm tools: Add '--no-dhcp' to disable kernel DHCP
2011-11-17 13:04 [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Sasha Levin
@ 2011-11-17 13:04 ` Sasha Levin
2011-11-17 13:04 ` [PATCH 3/4] kvm tools: Support event idx in virtio-net Sasha Levin
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-11-17 13:04 UTC (permalink / raw)
To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin
This new option disables the kernel DHCP which runs when starting
a custom rootfs.
This is useful when we want to start a rootfs but are using a network
other than the usermode IP proxy (a network which doesn't provide DHCP).
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/builtin-run.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 3b00bf0..43cf2c4 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -91,6 +91,7 @@ static bool balloon;
static bool using_rootfs;
static bool custom_rootfs;
static bool no_net;
+static bool no_dhcp;
extern bool ioport_debug;
extern int active_console;
extern int debug_iodelay;
@@ -432,6 +433,7 @@ static const struct option options[] = {
OPT_CALLBACK_DEFAULT('n', "network", NULL, "network params",
"Create a new guest NIC",
netdev_parser, NULL),
+ OPT_BOOLEAN('\0', "no-dhcp", &no_dhcp, "Disable kernel DHCP in rootfs mode"),
OPT_GROUP("BIOS options:"),
OPT_INTEGER('\0', "vidmode", &vidmode,
@@ -861,8 +863,11 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
if (using_rootfs) {
strcat(real_cmdline, " root=/dev/root rw rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p");
- if (custom_rootfs)
- strcat(real_cmdline, " init=/virt/init ip=dhcp");
+ if (custom_rootfs) {
+ strcat(real_cmdline, " init=/virt/init");
+ if (!no_dhcp)
+ strcat(real_cmdline, " ip=dhcp");
+ }
} else if (!strstr(real_cmdline, "root=")) {
strlcat(real_cmdline, " root=/dev/vda rw ", sizeof(real_cmdline));
}
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] kvm tools: Support event idx in virtio-net
2011-11-17 13:04 [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Sasha Levin
2011-11-17 13:04 ` [PATCH 2/4] kvm tools: Add '--no-dhcp' to disable kernel DHCP Sasha Levin
@ 2011-11-17 13:04 ` Sasha Levin
2011-11-17 13:04 ` [PATCH 4/4] kvm tool: Add event idx support to virtio-blk Sasha Levin
2011-11-17 13:24 ` [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Pekka Enberg
3 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-11-17 13:04 UTC (permalink / raw)
To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin
Support event idx both when using vhost and when using simple TAP mode.
I did simple TCP stream performance test with vhost, and it showed another 9%
increase over regular vhost mode.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/net.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index 58ca4ed..118517f 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -102,7 +102,9 @@ static void *virtio_net_rx_thread(void *p)
virt_queue__set_used_elem(vq, head, len);
/* We should interrupt guest right now, otherwise latency is huge. */
- ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_RX_QUEUE);
+ if (virtio_queue__should_signal(&ndev->vqs[VIRTIO_NET_RX_QUEUE]))
+ ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans,
+ VIRTIO_NET_RX_QUEUE);
}
}
@@ -140,7 +142,8 @@ static void *virtio_net_tx_thread(void *p)
virt_queue__set_used_elem(vq, head, len);
}
- ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_TX_QUEUE);
+ if (virtio_queue__should_signal(&ndev->vqs[VIRTIO_NET_TX_QUEUE]))
+ ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_TX_QUEUE);
}
pthread_exit(NULL);
@@ -314,7 +317,8 @@ static u32 get_host_features(struct kvm *kvm, void *dev)
| 1UL << VIRTIO_NET_F_HOST_TSO6
| 1UL << VIRTIO_NET_F_GUEST_UFO
| 1UL << VIRTIO_NET_F_GUEST_TSO4
- | 1UL << VIRTIO_NET_F_GUEST_TSO6;
+ | 1UL << VIRTIO_NET_F_GUEST_TSO6
+ | 1UL << VIRTIO_RING_F_EVENT_IDX;
}
static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
@@ -453,7 +457,7 @@ static struct virtio_ops net_dev_virtio_ops = (struct virtio_ops) {
static void virtio_net__vhost_init(struct kvm *kvm, struct net_dev *ndev)
{
- u64 features = 0;
+ u64 features = 1UL << VIRTIO_RING_F_EVENT_IDX;
struct vhost_memory *mem;
int r;
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] kvm tool: Add event idx support to virtio-blk
2011-11-17 13:04 [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Sasha Levin
2011-11-17 13:04 ` [PATCH 2/4] kvm tools: Add '--no-dhcp' to disable kernel DHCP Sasha Levin
2011-11-17 13:04 ` [PATCH 3/4] kvm tools: Support event idx in virtio-net Sasha Levin
@ 2011-11-17 13:04 ` Sasha Levin
2011-11-17 13:24 ` [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Pekka Enberg
3 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-11-17 13:04 UTC (permalink / raw)
To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/blk.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index ed4e099..9495f28 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -93,7 +93,8 @@ void virtio_blk_complete(void *param, long len)
virt_queue__set_used_elem(req->vq, req->head, len);
mutex_unlock(&bdev->mutex);
- bdev->vtrans.trans_ops->signal_vq(req->kvm, &bdev->vtrans, queueid);
+ if (virtio_queue__should_signal(&bdev->vqs[queueid]))
+ bdev->vtrans.trans_ops->signal_vq(req->kvm, &bdev->vtrans, queueid);
virtio_blk_req_push(req->bdev, req);
}
@@ -170,7 +171,9 @@ static u8 get_config(struct kvm *kvm, void *dev, u32 offset)
static u32 get_host_features(struct kvm *kvm, void *dev)
{
- return 1UL << VIRTIO_BLK_F_SEG_MAX | 1UL << VIRTIO_BLK_F_FLUSH;
+ return 1UL << VIRTIO_BLK_F_SEG_MAX
+ | 1UL << VIRTIO_BLK_F_FLUSH
+ | 1UL << VIRTIO_RING_F_EVENT_IDX;
}
static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX
2011-11-17 13:04 [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Sasha Levin
` (2 preceding siblings ...)
2011-11-17 13:04 ` [PATCH 4/4] kvm tool: Add event idx support to virtio-blk Sasha Levin
@ 2011-11-17 13:24 ` Pekka Enberg
2011-11-17 13:36 ` Sasha Levin
3 siblings, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2011-11-17 13:24 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, Nov 17, 2011 at 3:04 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> Support the event index feature in the virtio spec.
>
> The results are less notifications between the guest and host, and in
> result faster operation of the virt queues.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
What's this patch doing? There's no mention of VIRTIO_RING_F_EVENT_IDX
in the diff...
> ---
> tools/kvm/include/kvm/virtio.h | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
> index c6c380d..cd24285 100644
> --- a/tools/kvm/include/kvm/virtio.h
> +++ b/tools/kvm/include/kvm/virtio.h
> @@ -38,6 +38,8 @@ static inline bool virt_queue__available(struct virt_queue *vq)
> {
> if (!vq->vring.avail)
> return 0;
> +
> + vring_avail_event(&vq->vring) = vq->last_avail_idx;
> return vq->vring.avail->idx != vq->last_avail_idx;
> }
>
> @@ -51,6 +53,11 @@ static inline void *guest_pfn_to_host(struct kvm *kvm, u32 pfn)
> return guest_flat_to_host(kvm, (unsigned long)pfn << VIRTIO_PCI_QUEUE_ADDR_SHIFT);
> }
>
> +static inline int virtio_queue__should_signal(struct virt_queue *vq)
> +{
> + return vring_used_event(&vq->vring) <= vq->vring.used->idx;
> +}
> +
> struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, u32 head, u32 len);
>
> u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out, u16 *in, struct kvm *kvm);
> --
> 1.7.8.rc1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX
2011-11-17 13:24 ` [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Pekka Enberg
@ 2011-11-17 13:36 ` Sasha Levin
2011-11-17 13:44 ` Pekka Enberg
0 siblings, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2011-11-17 13:36 UTC (permalink / raw)
To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, 2011-11-17 at 15:24 +0200, Pekka Enberg wrote:
> On Thu, Nov 17, 2011 at 3:04 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> > Support the event index feature in the virtio spec.
> >
> > The results are less notifications between the guest and host, and in
> > result faster operation of the virt queues.
> >
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>
> What's this patch doing? There's no mention of VIRTIO_RING_F_EVENT_IDX
> in the diff...
It allows enabling the VIRTIO_RING_F_EVENT_IDX feature in various
virtio-* devices by updating the avail event idx and providing a
function to allow the devices to query the vq and decide if they need to
signal the VQ or not.
--
Sasha.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX
2011-11-17 13:36 ` Sasha Levin
@ 2011-11-17 13:44 ` Pekka Enberg
0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-11-17 13:44 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
> On Thu, 2011-11-17 at 15:24 +0200, Pekka Enberg wrote:
>> On Thu, Nov 17, 2011 at 3:04 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
>> > Support the event index feature in the virtio spec.
>> >
>> > The results are less notifications between the guest and host, and in
>> > result faster operation of the virt queues.
>> >
>> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>>
>> What's this patch doing? There's no mention of VIRTIO_RING_F_EVENT_IDX
>> in the diff...
On Thu, Nov 17, 2011 at 3:36 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> It allows enabling the VIRTIO_RING_F_EVENT_IDX feature in various
> virtio-* devices by updating the avail event idx and providing a
> function to allow the devices to query the vq and decide if they need to
> signal the VQ or not.
Right. The changelog is extremely confusing as is the ordering in the
patch series. You usually write something like "in preparation for
enabling XYZ support, add helper functions" and include the
conversions immediately after the helpers.
I'll fix the issues myself later today when I have the change to merge
patches. That is, unless you beat me to it and send a v2 of the
series.
Pekka
^ permalink raw reply [flat|nested] 7+ messages in thread