Re: [PATCH v7 13/46] virtio: simplify feature bit handling

2014-12-01 Thread David Hildenbrand
Now that we use u64 for bits, we can simply them together. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) Reviewed-by: David Hildenbrand d...@linux.vnet.ibm.com

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread David Hildenbrand
Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ... -static unsigned

Re: [PATCH v7 01/46] virtio: add low-level APIs for feature bits

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:09:08 +0200 Michael S. Tsirkin m...@redhat.com wrote: Add low level APIs to test/set/clear feature bits. For use by transports, to make it easier to write code independent of feature bit array format. Note: APIs is prefixed with __ and has _bit suffix to stress its

Re: [PATCH net-next] vhost: remove unnecessary forward declarations in vhost.h

2014-12-01 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 02:41:21PM +0800, Jason Wang wrote: Signed-off-by: Jason Wang jasow...@redhat.com Applied, thanks. --- drivers/vhost/vhost.h | 4 1 file changed, 4 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..7d039ef 100644 ---

Re: [PATCH v7 28/46] vhost: make features 64 bit

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 04:12:37AM +, Ben Hutchings wrote: On Sun, 2014-11-30 at 18:44 +0300, Sergei Shtylyov wrote: Hello. On 11/30/2014 6:11 PM, Michael S. Tsirkin wrote: We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin m...@redhat.com

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 09:16:41AM +0100, David Hildenbrand wrote: Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 09:16:41AM +0100, David Hildenbrand wrote: Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com

Re: [PATCH net] Revert drivers/net: Disable UFO through virtio in macvtap and tun

2014-12-01 Thread Michael S. Tsirkin
On Tue, Nov 11, 2014 at 05:12:58PM +, Ben Hutchings wrote: This reverts commit 88e0e0e5aa722b193c8758c8b45d041de5316924 for the tap drivers, but leaves UFO disabled in virtio_net. libvirt at least assumes that tap features will never be dropped in new kernel versions, and doing so

Re: [PATCH v7 08/46] virtio: memory access APIs

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:09:50 +0200 Michael S. Tsirkin m...@redhat.com wrote: virtio 1.0 makes all memory structures LE, so we need APIs to conditionally do a byteswap on BE architectures. To make it easier to check code statically, add virtio specific types for multi-byte integers in

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread David Hildenbrand
On Mon, Dec 01, 2014 at 09:16:41AM +0100, David Hildenbrand wrote: Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck

Re: [PATCH v7 12/46] virtio: set FEATURES_OK

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:10:17 +0200 Michael S. Tsirkin m...@redhat.com wrote: set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/uapi/linux/virtio_config.h | 2 ++ drivers/virtio/virtio.c| 29 ++--- 2

Re: [PATCH v7 13/46] virtio: simplify feature bit handling

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:10:22 +0200 Michael S. Tsirkin m...@redhat.com wrote: Now that we use u64 for bits, we can simply them together. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-)

[PATCH RFC v4 net-next 0/5] virtio_net: enabling tx interrupts

2014-12-01 Thread Jason Wang
Hello: We used to orphan packets before transmission for virtio-net. This breaks socket accounting and can lead serveral functions won't work, e.g: - Byte Queue Limit depends on tx completion nofication to work. - Packet Generator depends on tx completion nofication for the last transmitted

[PATCH RFC v4 net-next 1/5] virtio_net: enable tx interrupt

2014-12-01 Thread Jason Wang
On newer hosts that support delayed tx interrupts, we probably don't have much to gain from orphaning packets early. Note: this might degrade performance for hosts without event idx support. Should be addressed by the next patch. Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin

[PATCH RFC v4 net-next 2/5] virtio_net: bql

2014-12-01 Thread Jason Wang
From: Michael S. Tsirkin m...@redhat.com Improve tx batching using byte queue limits. Should be especially effective for MQ. Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin m...@redhat.com Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/net/virtio_net.c | 7 +++

[PATCH RFC v4 net-next 3/5] virtio-net: optimize free_old_xmit_skbs stats

2014-12-01 Thread Jason Wang
We already have counters for sent packets and sent bytes. Use them to reduce the number of u64_stats_update_begin/end(). Take care not to bother with stats update when called speculatively. Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin m...@redhat.com Signed-off-by: Jason Wang

[PATCH RFC v4 net-next 4/5] virtio-net: add basic interrupt coalescing support

2014-12-01 Thread Jason Wang
This patch enables the interrupt coalescing setting through ethtool. Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin m...@redhat.com Signed-off-by: Jason Wang jasow...@redhat.com --- drivers/net/virtio_net.c| 67 +

[PATCH RFC v4 net-next 5/5] vhost_net: interrupt coalescing support

2014-12-01 Thread Jason Wang
This patch implements interrupt coalescing support for vhost_net. And provides ioctl()s for userspace to get and set coalescing parameters. Two kinds of parameters were allowed to be set: - max_coalesced_frames: which is the maximum numbers of packets were allowed before issuing an irq. -

Re: [PATCH RFC v4 net-next 1/5] virtio_net: enable tx interrupt

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 06:17:04PM +0800, Jason Wang wrote: On newer hosts that support delayed tx interrupts, we probably don't have much to gain from orphaning packets early. Note: this might degrade performance for hosts without event idx support. Should be addressed by the next patch.

Re: [PATCH v7 27/46] virtio_net: enable v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 12:40:08PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:30 +0200 Michael S. Tsirkin m...@redhat.com wrote: Now that we have completed 1.0 support, enable it in our driver. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 12:33:15PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 11:26:58 +0200 Michael S. Tsirkin m...@redhat.com wrote: For some places on data path, it might be worth it to cache the correct value e.g. as part of device structure. This replaces a branch with a memory

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 13:46:45 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 12:33:15PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 11:26:58 +0200 Michael S. Tsirkin m...@redhat.com wrote: For some places on data path, it might be worth it to cache the

Re: [PATCH v7 29/46] vhost: add memory access wrappers

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:11:39 +0200 Michael S. Tsirkin m...@redhat.com wrote: Add guest memory access wrappers to handle virtio endianness conversions. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Jason Wang jasow...@redhat.com --- drivers/vhost/vhost.h | 31

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:02:58PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 13:46:45 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 12:33:15PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 11:26:58 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v7 30/46] vhost/net: force len for TX to host endian

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:11:44 +0200 Michael S. Tsirkin m...@redhat.com wrote: vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0. Suppress sparse errors: we use native endian-ness internally but never

Re: [PATCH v7 30/46] vhost/net: force len for TX to host endian

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:20:51PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:44 +0200 Michael S. Tsirkin m...@redhat.com wrote: vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0.

Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:49 +0200 Michael S. Tsirkin m...@redhat.com wrote: Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 93 +++ 1 file

Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 14:37:01 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:49 +0200 Michael S. Tsirkin m...@redhat.com wrote: Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:42:47PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:37:01 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:49 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

2014-12-01 Thread Cornelia Huck
On Sun, 30 Nov 2014 17:12:47 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:40:36PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:34:55 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:02:58PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 13:46:45 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 02:53:05PM +0200, Michael S. Tsirkin wrote: On Mon, Dec 01, 2014 at 01:50:01PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:47 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all fields,

Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 14:53:05 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:50:01PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:47 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 14:51:26 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:40:36PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:34:55 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:02:58PM +0100, Cornelia Huck wrote: On

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 02:00:04PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:51:26 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:40:36PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:34:55 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v7 36/46] vhost/net: suppress compiler warning

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:37:40PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:13 +0200 Michael S. Tsirkin m...@redhat.com wrote: len is always initialized since function is called with size 0. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 2

Re: [PATCH v7 16/46] virtio_blk: v1.0 support

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 15:47:19 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 02:00:04PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 14:51:26 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:40:36PM +0100, Cornelia Huck wrote: On

Re: [PATCH v7 36/46] vhost/net: suppress compiler warning

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 15:48:39 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:37:40PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:13 +0200 Michael S. Tsirkin m...@redhat.com wrote: len is always initialized since function is called with size 0.

Re: [PATCH v7 36/46] vhost/net: suppress compiler warning

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 03:21:03PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 15:48:39 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:37:40PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:13 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v7 36/46] vhost/net: suppress compiler warning

2014-12-01 Thread Cornelia Huck
On Mon, 1 Dec 2014 17:12:08 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 03:21:03PM +0100, Cornelia Huck wrote: On Mon, 1 Dec 2014 15:48:39 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 01:37:40PM +0100, Cornelia Huck wrote: On

Re: [PATCH v7 31/46] vhost: virtio 1.0 endian-ness support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:33:53PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:11:49 +0200 Michael S. Tsirkin m...@redhat.com wrote: Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 93 +++ 1 file

[PATCH v8 04/50] virtio: add support for 64 bit features.

2014-12-01 Thread Michael S. Tsirkin
Change u32 to u64, and use BIT_ULL and 1ULL everywhere. Note: transports are unchanged, and only set low 32 bit. This guarantees that no transport sets e.g. VERSION_1 by mistake without proper support. Based on patch by Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by:

[PATCH v8 05/50] virtio: assert 32 bit features in transports

2014-12-01 Thread Michael S. Tsirkin
At this point, no transports set any of the high 32 feature bits. Since transports generally can't (yet) cope with such bits, add BUG_ON checks to make sure they are not set by mistake. Based on rproc patch by Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Michael S.

[PATCH v8 07/50] virtio: add virtio 1.0 feature bit

2014-12-01 Thread Michael S. Tsirkin
Based on original patches by Rusty Russell, Thomas Huth and Cornelia Huck. Note: at this time, we do not negotiate this feature bit in core, drivers have to declare VERSION_1 support explicitly. For this reason we treat this bit as a device bit and not as a transport bit for now. After all

[PATCH v8 01/50] virtio: add low-level APIs for feature bits

2014-12-01 Thread Michael S. Tsirkin
Add low level APIs to test/set/clear feature bits. For use by transports, to make it easier to write code independent of feature bit array format. Note: APIs is prefixed with __ and has _bit suffix to stress its low level nature. It's for use by transports only: drivers should use

[PATCH v8 10/50] virtio_config: endian conversion for v1.0

2014-12-01 Thread Michael S. Tsirkin
We (ab)use virtio conversion functions for device-specific config space accesses. Based on original patches by Cornelia and Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com

[PATCH v8 11/50] virtio: allow transports to get avail/used addresses

2014-12-01 Thread Michael S. Tsirkin
From: Cornelia Huck cornelia.h...@de.ibm.com For virtio-1, we can theoretically have a more complex virtqueue layout with avail and used buffers not on a contiguous memory area with the descriptor table. For now, it's fine for a transport driver to stay with the old layout: It needs, however, a

[PATCH v8 25/50] virtio_net: stricter short buffer length checks

2014-12-01 Thread Michael S. Tsirkin
Our buffer length check is not strict enough for mergeable buffers: buffer can still be shorter that header + address by 2 bytes. Fix that up. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com Reviewed-by: Jason Wang jasow...@redhat.com ---

[PATCH v8 13/50] virtio: simplify feature bit handling

2014-12-01 Thread Michael S. Tsirkin
Now that we use u64 for bits, we can simply them together. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: David Hildenbrand d...@linux.vnet.ibm.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4

[PATCH v8 26/50] virtio_net: bigger header when VERSION_1 is set

2014-12-01 Thread Michael S. Tsirkin
With VERSION_1 virtio_net uses same header size whether mergeable buffers are enabled or not. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com Reviewed-by: Jason Wang jasow...@redhat.com --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2

[PATCH v8 16/50] virtio_blk: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v8 14/50] virtio: add legacy feature table support

2014-12-01 Thread Michael S. Tsirkin
virtio-blk has some legacy feature bits that modern drivers must not negotiate, but are needed for old legacy hosts (that e.g. don't support virtio-scsi). Allow a separate legacy feature table for such cases. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck

[PATCH v8 21/50] virtio_blk: make serial attribute static

2014-12-01 Thread Michael S. Tsirkin
It's never declared so no need to make it extern. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/block/virtio_blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c

[PATCH v8 27/50] virtio_net: disable mac write for virtio 1.0

2014-12-01 Thread Michael S. Tsirkin
The spec states that mac in config space is only driver-writable in the legacy case. Fence writing it in virtnet_set_mac_address() in the virtio 1.0 case. Suggested-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck

[PATCH v8 31/50] vhost/net: force len for TX to host endian

2014-12-01 Thread Michael S. Tsirkin
vhost/net keeps a copy of the used ring in host memory but (ab)uses the length field for internal house-keeping. This works because the length in the used ring for tx is always 0. In order to suppress sparse warnings, we force native endianness here. Note that these values are never exposed to

[PATCH v8 30/50] vhost: add memory access wrappers

2014-12-01 Thread Michael S. Tsirkin
Add guest memory access wrappers to handle virtio endianness conversions. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Jason Wang jasow...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/vhost/vhost.h | 31 +++ 1 file

[PATCH v8 42/50] virtio_scsi: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++-

[PATCH v8 29/50] vhost: make features 64 bit

2014-12-01 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0. Make vhost_has_feature bool to avoid discarding high bits. Cc: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Cc: Ben Hutchings b...@decadent.org.uk Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Jason Wang jasow...@redhat.com ---

[PATCH v8 32/50] vhost: switch to __get/__put_user exclusively

2014-12-01 Thread Michael S. Tsirkin
Most places in vhost can use __get/__put_user rather than get/put_user since addresses are pre-validated. This should be good for performance, but this also will help make code sparse-clean: get/put_user macros don't play well with __virtioXX bitwise tags. Switch to get/put_user to __ variants

[PATCH v8 36/50] vhost/net: enable virtio 1.0

2014-12-01 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 8ff4a6d..a935c25 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@

[PATCH v8 48/50] virtio_balloon: add legacy_only flag

2014-12-01 Thread Michael S. Tsirkin
We have no plans to support virtio 1.0 in balloon driver. Add an explicit flag to mark it legacy only. This will be used by follow-up patches. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio.h | 2 ++ drivers/virtio/virtio_balloon.c | 1 + 2 files changed, 3

[PATCH v8 44/50] virtio_scsi: export to userspace

2014-12-01 Thread Michael S. Tsirkin
Replace uXX by __uXX and _packed by __attribute((packed)) as seems to be the norm for userspace headers. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/uapi/linux/virtio_scsi.h | 74

[PATCH v8 45/50] vhost/scsi: partial virtio 1.0 support

2014-12-01 Thread Michael S. Tsirkin
Include all endian conversions as required by virtio 1.0. Don't set virtio 1.0 yet, since that requires ANY_LAYOUT which we don't yet support. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- drivers/vhost/scsi.c | 22 -- 1

[PATCH v8 49/50] virtio: make VIRTIO_F_VERSION_1 a transport bit

2014-12-01 Thread Michael S. Tsirkin
Activate VIRTIO_F_VERSION_1 automatically unless legacy_only is set. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/uapi/linux/virtio_config.h | 4 ++-- drivers/virtio/virtio.c| 6 +- drivers/virtio/virtio_ring.c | 2 ++ 3 files changed, 9 insertions(+), 3

[PATCH v8 47/50] virtio_console: virtio 1.0 support

2014-12-01 Thread Michael S. Tsirkin
Pretty straight-forward, just use accessors for all fields. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/uapi/linux/virtio_console.h | 7 --- drivers/char/virtio_console.c | 29 + 2 files changed, 21 insertions(+), 15 deletions(-) diff

[PATCH v8 50/50] virtio: drop VIRTIO_F_VERSION_1 from drivers

2014-12-01 Thread Michael S. Tsirkin
Core activates this bit automatically now, drop it from drivers that set it explicitly. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/block/virtio_blk.c| 1 - drivers/char/virtio_console.c | 1 - drivers/net/virtio_net.c | 1 - drivers/scsi/virtio_scsi.c| 1 - 4

[PATCH v8 09/50] virtio_ring: switch to new memory access APIs

2014-12-01 Thread Michael S. Tsirkin
Use virtioXX_to_cpu and friends for access to all multibyte structures in memory. Note: this is intentionally mechanical. A follow-up patch will split long lines etc. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com ---

[PATCH v8 23/50] virtio_net: pass vi around

2014-12-01 Thread Michael S. Tsirkin
Too many places poke at [rs]q-vq-vdev-priv just to get the vi structure. Let's just pass the pointer around: seems cleaner, and might even be faster. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 38

[PATCH v8 28/50] virtio_net: enable v1.0 support

2014-12-01 Thread Michael S. Tsirkin
Now that we have completed 1.0 support, enable it in our driver. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/net/virtio_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index b8bd719..9ab3c50 100644 ---

[PATCH v8 12/50] virtio: set FEATURES_OK

2014-12-01 Thread Michael S. Tsirkin
set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- include/uapi/linux/virtio_config.h | 2 ++ drivers/virtio/virtio.c| 29 ++--- 2 files changed, 24 insertions(+), 7

[PATCH v8 15/50] virtio_net: v1.0 endianness

2014-12-01 Thread Michael S. Tsirkin
Based on patches by Rusty Russell, Cornelia Huck. Note: more code changes are needed for 1.0 support (due to different header size). So we don't advertize support for 1.0 yet. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by:

[PATCH v8 33/50] vhost: virtio 1.0 endian-ness support

2014-12-01 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 86 +-- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 6a40837..ed71b53 100644 ---

[PATCH v8 35/50] vhost/net: larger header for virtio 1.0

2014-12-01 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Jason Wang jasow...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index

[PATCH v8 02/50] virtio: use u32, not bitmap for features

2014-12-01 Thread Michael S. Tsirkin
It seemed like a good idea to use bitmap for features in struct virtio_device, but it's actually a pain, and seems to become even more painful when we get more than 32 feature bits. Just change it to a u32 for now. Based on patch by Rusty. Suggested-by: David Hildenbrand d...@linux.vnet.ibm.com

[PATCH v8 22/50] virtio_blk: fix race at module removal

2014-12-01 Thread Michael S. Tsirkin
If a device appears while module is being removed, driver will get a callback after we've given up on the major number. In theory this means this major number can get reused by something else, resulting in a conflict. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck

[PATCH v8 34/50] vhost/net: virtio 1.0 byte swap

2014-12-01 Thread Michael S. Tsirkin
I had to add an explicit tag to suppress compiler warning: gcc isn't smart enough to notice that len is always initialized since function is called with size 0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/vhost/net.c | 15

[PATCH v8 08/50] virtio: memory access APIs

2014-12-01 Thread Michael S. Tsirkin
virtio 1.0 makes all memory structures LE, so we need APIs to conditionally do a byteswap on BE architectures. To make it easier to check code statically, add virtio specific types for multi-byte integers in memory. Add low level wrappers that do a byteswap conditionally, these will be useful

Re: [PATCH v7 44/46] virtio_scsi: export to userspace

2014-12-01 Thread Prabhakar Lad
Hi Michael, Thanks for the patch. On Sun, Nov 30, 2014 at 3:12 PM, Michael S. Tsirkin m...@redhat.com wrote: Replace uXX by __uXX and _packed by __attribute((packed)) as seems to be the norm for userspace headers. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini

Re: [Xen-devel] [PATCH v4 04/10] x86: paravirt: Wrap initialization of set_iopl_mask in a macro

2014-12-01 Thread Konrad Rzeszutek Wilk
On Sun, Nov 02, 2014 at 09:32:20AM -0800, Josh Triplett wrote: This will allow making set_iopl_mask optional later. Signed-off-by: Josh Triplett j...@joshtriplett.org Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/include/asm/paravirt_types.h | 1 +

Re: [PATCH v12 09/11] pvqspinlock, x86: Add para-virtualization support

2014-12-01 Thread Konrad Rzeszutek Wilk
On Tue, Nov 25, 2014 at 07:33:58PM -0500, Waiman Long wrote: On 10/27/2014 02:02 PM, Konrad Rzeszutek Wilk wrote: On Mon, Oct 27, 2014 at 01:38:20PM -0400, Waiman Long wrote: My concern is that spin_unlock() can be called in many places, including loadable kernel modules. Can the

Re: [PATCH v13 09/11] pvqspinlock, x86: Add para-virtualization support

2014-12-01 Thread Konrad Rzeszutek Wilk
On Wed, Oct 29, 2014 at 04:19:09PM -0400, Waiman Long wrote: This patch adds para-virtualization support to the queue spinlock code base with minimal impact to the native case. There are some minor code changes in the generic qspinlock.c file which should be usable in other architectures. The

Re: [PATCH RFC v4 net-next 1/5] virtio_net: enable tx interrupt

2014-12-01 Thread Jason Wang
On Mon, Dec 1, 2014 at 6:35 PM, Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 06:17:04PM +0800, Jason Wang wrote: On newer hosts that support delayed tx interrupts, we probably don't have much to gain from orphaning packets early. Note: this might degrade

Re: [PATCH RFC v4 net-next 0/5] virtio_net: enabling tx interrupts

2014-12-01 Thread Jason Wang
On Mon, Dec 1, 2014 at 6:42 PM, Michael S. Tsirkin m...@redhat.com wrote: On Mon, Dec 01, 2014 at 06:17:03PM +0800, Jason Wang wrote: Hello: We used to orphan packets before transmission for virtio-net. This breaks socket accounting and can lead serveral functions won't work, e.g: