Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Rusty Russell
Rusty Russell writes: > I'll create some patches and see if it's too ugly to live... Hmm, with rough userspace testing I managed to get the speed penalty pretty low. Here are the two patches, inline: vringh: handle case where data goes across multiple ranges. QEMU seems to only use separate me

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Rusty Russell
Rusty Russell writes: > "Michael S. Tsirkin" writes: >> On Mon, Jan 21, 2013 at 10:22:03PM +1030, Rusty Russell wrote: >>> Rusty Russell writes: >>> > "Michael S. Tsirkin" writes: >>> >>> + iov->iov[iov->i].iov_base = (__force __user void *)addr; >>> >>> + iov->iov[i

[PATCH v2 3/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Asias He
We can get all the pages in one time instead of calling gup N times. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 54 ++- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c i

[PATCH v2 2/3] tcm_vhost: Use iov_num_pages to calculate sgl_count

2013-01-21 Thread Asias He
Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index ca35c16..796a6b0 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -479,11 +479,9 @

[PATCH v2 0/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Asias He
Changes in v2: - Use GFP_KERNEL instead of GFP_ATOMIC - Handle pages pinned less than wanted Asias He (3): tcm_vhost: Introduce iov_num_pages tcm_vhost: Use iov_num_pages to calculate sgl_count tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl drivers/vhost/tcm_vhost.c | 68

[PATCH v2 1/3] tcm_vhost: Introduce iov_num_pages

2013-01-21 Thread Asias He
Add a helper to calculate the number of pages needed for a iov entry. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 3720604..ca35c16 100644 --- a/drivers/vhost/tcm_vhost.

Re: [PATCH 2/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Asias He
On 01/22/2013 02:57 AM, Marcelo Tosatti wrote: > On Mon, Jan 21, 2013 at 04:05:27PM +0800, Asias He wrote: >> We can get all the pages in one time instead of calling >> gup N times. >> >> Signed-off-by: Asias He >> --- >> drivers/vhost/tcm_vhost.c | 33 - >> 1 file

Re: [PATCH] virtio_console: Let unconnected rproc device receive data.

2013-01-21 Thread Rusty Russell
sjur.brandel...@stericsson.com writes: > From: Sjur Brændeland > > Allow rproc serial ports to receive data before the port > is connected. > > Rproc serial ports usually talk to very simple remote devices > with no control queue managing open/close events. So we must > let remote devices write to

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Mon, Jan 21, 2013 at 10:22:03PM +1030, Rusty Russell wrote: >> Rusty Russell writes: >> > "Michael S. Tsirkin" writes: >> >>> +iov->iov[iov->i].iov_base = (__force __user void *)addr; >> >>> +iov->iov[iov->i].iov_len = desc.len; >

Re: [RFC] virtio_console: Add DRIVER and INTERFACE to uevent.

2013-01-21 Thread Rusty Russell
sjur.brandel...@stericsson.com writes: > From: Sjur Brændeland > > Add information so rproc-serial can be easily recogniced > from user space. Add the following information to uevent: > DRIVER=virtio_console|virtio_rproc_serial > INTERFACE=grand-parent/parent/name > > Signed-off-by: Sjur Brændela

Re: [PATCH V6 1/3] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-21 Thread Rusty Russell
Wanlong Gao writes: > As Michael mentioned, set affinity and select queue will not work very > well when CPU IDs are not consecutive, this can happen with hot unplug. > Fix this bug by traversal the online CPUs, and create a per cpu variable > to find the mapping from CPU to the preferable virtua

Re: [PATCH] virtio_console: Use virtio device index to generate port name

2013-01-21 Thread Rusty Russell
sjur.brandel...@stericsson.com writes: > From: Sjur Brændeland > > Use virtio device index for creating unique device port names. > Current index allocation in virtio is based on a monotonically > increasing variable "index". A better handling of this is to > use device index which is allocated by

Re: [PATCH] virtio_console: Don't access uninitialized data.

2013-01-21 Thread Rusty Russell
sjur.brandel...@stericsson.com writes: > From: Sjur Brændeland > > Don't access uninitialized work-queue when removing device. > The work queue is initialized only if the device multi-queue. > So don't call cancel_work unless this is a multi-queue device. > > This fixes the following panic: Thank

Re: [PATCH 2/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Marcelo Tosatti
On Mon, Jan 21, 2013 at 04:05:27PM +0800, Asias He wrote: > We can get all the pages in one time instead of calling > gup N times. > > Signed-off-by: Asias He > --- > drivers/vhost/tcm_vhost.c | 33 - > 1 file changed, 20 insertions(+), 13 deletions(-) > > diff -

Re: [PATCH v5 0/3] make mac programming for virtio net more robust

2013-01-21 Thread David Miller
From: Amos Kong Date: Mon, 21 Jan 2013 19:17:20 +0800 > Currenly mac is programmed byte by byte. This means that we > have an intermediate step where mac is wrong. > > Third patch introduced a new vq control command to set mac > address, it's atomic. > > V2: check return of sending command, de

Re: [PATCH v4 2/3] net: split eth_mac_addr for better error handling

2013-01-21 Thread Stefan Hajnoczi
On Sun, Jan 20, 2013 at 10:43:08AM +0800, ak...@redhat.com wrote: > From: Stefan Hajnoczi > > When we set mac address, software mac address in system and hardware mac > address all need to be updated. Current eth_mac_addr() doesn't allow > callers to implement error handling nicely. > > This pat

Re: [QEMU PATCH v4 2/3] virtio-net: introduce a new macaddr control

2013-01-21 Thread Stefan Hajnoczi
On Sat, Jan 19, 2013 at 09:54:27AM +0800, ak...@redhat.com wrote: > @@ -350,6 +351,18 @@ static int virtio_net_handle_mac(VirtIONet *n, uint8_t > cmd, > struct virtio_net_ctrl_mac mac_data; > size_t s; > > +if (cmd == VIRTIO_NET_CTRL_MAC_ADDR_SET) { > +if (iov_size(iov, iov

Re: [QEMU PATCH v4 1/3] virtio-net: remove layout assumptions for ctrl vq

2013-01-21 Thread Stefan Hajnoczi
On Sat, Jan 19, 2013 at 09:54:26AM +0800, ak...@redhat.com wrote: > From: "Michael S. Tsirkin" > > Virtio-net code makes assumption about virtqueue descriptor layout > (e.g. sg[0] is the header, sg[1] is the data buffer). > > This patch makes code not rely on the layout of descriptors. > > Sign

Re: [PATCH 0/5] vhost-scsi: Add support for host virtualized target

2013-01-21 Thread Anthony Liguori
"Nicholas A. Bellinger" writes: > Hi MST & Co, > > On Thu, 2013-01-17 at 18:43 +0200, Michael S. Tsirkin wrote: >> On Fri, Sep 07, 2012 at 06:48:14AM +, Nicholas A. Bellinger wrote: >> > From: Nicholas Bellinger >> > >> > Hello Anthony & Co, >> > >> > This is the fourth installment to add

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Michael S. Tsirkin
On Mon, Jan 21, 2013 at 10:22:03PM +1030, Rusty Russell wrote: > Rusty Russell writes: > > "Michael S. Tsirkin" writes: > >>> + iov->iov[iov->i].iov_base = (__force __user void *)addr; > >>> + iov->iov[iov->i].iov_len = desc.len; > >> > >> The following comment from the previous v

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Michael S. Tsirkin
On Mon, Jan 21, 2013 at 02:24:31PM +0200, Michael S. Tsirkin wrote: > On Mon, Jan 21, 2013 at 10:22:03PM +1030, Rusty Russell wrote: > > Rusty Russell writes: > > > "Michael S. Tsirkin" writes: > > >>> + iov->iov[iov->i].iov_base = (__force __user void *)addr; > > >>> +

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-21 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Thu, Jan 17, 2013 at 12:40:29PM +1030, Rusty Russell wrote: >> I resist sprinkling __user everywhere because it's *not* always user >> addresses, and it's deeply misleading to anyone reading it. I'd rather >> have it in one place with a big comment. >> I can try

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Rusty Russell
Rusty Russell writes: > "Michael S. Tsirkin" writes: >>> + iov->iov[iov->i].iov_base = (__force __user void *)addr; >>> + iov->iov[iov->i].iov_len = desc.len; >> >> The following comment from the previous version still applies: >> > This looks like it won't do the right t

[PATCH V6 3/3] virtio-net: reset virtqueue affinity when doing cpu hotplug

2013-01-21 Thread Wanlong Gao
Add a cpu notifier to virtio-net, so that we can reset the virtqueue affinity if the cpu hotplug happens. It improve the performance through enabling or disabling the virtqueue affinity after doing cpu hotplug. Cc: Rusty Russell Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Eric Dumazet Cc: virt

[PATCH V6 1/3] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-21 Thread Wanlong Gao
As Michael mentioned, set affinity and select queue will not work very well when CPU IDs are not consecutive, this can happen with hot unplug. Fix this bug by traversal the online CPUs, and create a per cpu variable to find the mapping from CPU to the preferable virtual-queue. Cc: Rusty Russell C

[PATCH V6 2/3] virtio-net: split out clean affinity function

2013-01-21 Thread Wanlong Gao
Split out the clean affinity function to virtnet_clean_affinity(). Cc: Rusty Russell Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Eric Dumazet Cc: virtualization@lists.linux-foundation.org Cc: net...@vger.kernel.org Signed-off-by: Wanlong Gao --- V5->V6: NEW drivers/net/virtio_net.c | 67 +++

[PATCH v5 3/3] virtio-net: introduce a new control to set macaddr

2013-01-21 Thread Amos Kong
Currently we write MAC address to pci config space byte by byte, this means that we have an intermediate step where mac is wrong. This patch introduced a new control command to set MAC address, it's atomic. VIRTIO_NET_F_CTRL_MAC_ADDR is a new feature bit for compatibility. Signed-off-by: Amos Kon

[PATCH v5 2/3] net: split eth_mac_addr for better error handling

2013-01-21 Thread Amos Kong
From: Stefan Hajnoczi When we set mac address, software mac address in system and hardware mac address all need to be updated. Current eth_mac_addr() doesn't allow callers to implement error handling nicely. This patch split eth_mac_addr() to prepare part and real commit part, then we can prepar

[PATCH v5 1/3] move virtnet_send_command() above virtnet_set_mac_address()

2013-01-21 Thread Amos Kong
We want to send vq command to set mac address in virtnet_set_mac_address(), so do this function moving. Fixed a little issue of coding style. Signed-off-by: Amos Kong --- drivers/net/virtio_net.c | 89 ++--- 1 files changed, 44 insertions(+), 45 deletion

[PATCH v5 0/3] make mac programming for virtio net more robust

2013-01-21 Thread Amos Kong
Currenly mac is programmed byte by byte. This means that we have an intermediate step where mac is wrong. Third patch introduced a new vq control command to set mac address, it's atomic. V2: check return of sending command, delay eth_mac_addr() V3: restore software address when fail to set hardw

Re: [PATCH 1/6] virtio_host: host-side implementation of virtio rings.

2013-01-21 Thread Michael S. Tsirkin
On Mon, Jan 21, 2013 at 01:04:47PM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > On Thu, Jan 17, 2013 at 08:59:38PM +1030, Rusty Russell wrote: > >> +/* Returns vring->num if empty, -ve on error. */ > >> +static inline int __vringh_get_head(const struct vringh *vrh, > >> +

Re: [PATCH 0/5] vhost-scsi: Add support for host virtualized target

2013-01-21 Thread Michael S. Tsirkin
On Thu, Jan 17, 2013 at 01:07:21PM -0800, Nicholas A. Bellinger wrote: > Hi MST & Co, > > On Thu, 2013-01-17 at 18:43 +0200, Michael S. Tsirkin wrote: > > On Fri, Sep 07, 2012 at 06:48:14AM +, Nicholas A. Bellinger wrote: > > > From: Nicholas Bellinger > > > > > > Hello Anthony & Co, > > >

[PATCH 3/3] tcm_vhost: Use iov_num_pages to calculate sgl_count

2013-01-21 Thread Asias He
Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 59be442..5b77469 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -487,11 +487,9 @

[PATCH 2/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Asias He
We can get all the pages in one time instead of calling gup N times. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index ca35c16..

[PATCH 1/3] tcm_vhost: Introduce iov_num_pages

2013-01-21 Thread Asias He
Add a helper to calculate the number of pages needed for a iov entry. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 3720604..ca35c16 100644 --- a/drivers/vhost/tcm_vhost.

[PATCH 0/3] tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl

2013-01-21 Thread Asias He
Asias He (3): tcm_vhost: Introduce iov_num_pages tcm_vhost: Optimize gup in vhost_scsi_map_to_sgl tcm_vhost: Use iov_num_pages to calculate sgl_count drivers/vhost/tcm_vhost.c | 47 +-- 1 file changed, 29 insertions(+), 18 deletions(-) -- 1.8.1