Re: [PATCH v4 4/6] hw_random: fix unregister race.

2014-11-24 Thread Amos Kong
On Wed, Nov 12, 2014 at 02:33:00PM +1030, Rusty Russell wrote: > Amos Kong writes: > > From: Rusty Russell > > > > The previous patch added one potential problem: we can still be > > reading from a hwrng when it's unregistered. Add a wait for zero > > in the hwrng_unregister path. > > > > v4: ad

Re: [PATCH v3 26/41] vhost: virtio 1.0 endian-ness support

2014-11-24 Thread Michael S. Tsirkin
On Mon, Nov 24, 2014 at 03:28:26PM +0100, Cedric Le Goater wrote: > Hi Michael, > > Do you have a tree from where I could pull these patches ? > > Thanks, > > C. Yes - vhost-next that linux-next includes. -- MST ___ Virtualization mailing list Virt

Re: [PATCH v3 04/41] virtio: memory access APIs

2014-11-24 Thread Michael S. Tsirkin
On Mon, Nov 24, 2014 at 01:58:43PM +0100, Geert Uytterhoeven wrote: > On Mon, Nov 24, 2014 at 1:15 PM, Michael S. Tsirkin wrote: > > On Mon, Nov 24, 2014 at 01:03:24PM +0100, Geert Uytterhoeven wrote: > >> On Mon, Nov 24, 2014 at 12:52 PM, Michael S. Tsirkin > >> wrote: > >> > virtio 1.0 makes a

Re: [PATCH v3 04/41] virtio: memory access APIs

2014-11-24 Thread Geert Uytterhoeven
On Mon, Nov 24, 2014 at 1:15 PM, Michael S. Tsirkin wrote: > On Mon, Nov 24, 2014 at 01:03:24PM +0100, Geert Uytterhoeven wrote: >> On Mon, Nov 24, 2014 at 12:52 PM, Michael S. Tsirkin wrote: >> > virtio 1.0 makes all memory structures LE, so >> > we need APIs to conditionally do a byteswap on BE

Re: [PATCH v3 04/41] virtio: memory access APIs

2014-11-24 Thread Michael S. Tsirkin
On Mon, Nov 24, 2014 at 01:03:24PM +0100, Geert Uytterhoeven wrote: > On Mon, Nov 24, 2014 at 12:52 PM, Michael S. Tsirkin 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 stati

Re: [PATCH v3 04/41] virtio: memory access APIs

2014-11-24 Thread Geert Uytterhoeven
On Mon, Nov 24, 2014 at 12:52 PM, Michael S. Tsirkin 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 memory. > > Add

[PATCH v3 31/41] vhost/net: suppress compiler warning

2014-11-24 Thread Michael S. Tsirkin
len is always initialized since function is called with size > 0. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 --- a/drivers/vhost/net.c +++ b/

[PATCH v3 29/41] vhost/net: larger header for virtio 1.0

2014-11-24 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- 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 cae22f9..1ac58d0 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1027,7 +1027,8 @@ static int vhost_net_se

[PATCH v3 39/41] virtio_scsi: export to userspace

2014-11-24 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 --- include/uapi/linux/virtio_scsi.h | 74 include/uapi/linux/Kbuild| 1 + 2 files changed, 38 insertions(+

[PATCH v3 30/41] vhost/net: enable virtio 1.0

2014-11-24 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- 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 1ac58d0..984242e 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@ MODULE_PARM_DESC(experiment

[PATCH v3 40/41] vhost/scsi: partial virtio 1.0 support

2014-11-24 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 --- drivers/vhost/scsi.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/d

[PATCH v3 37/41] virtio_scsi: v1.0 support

2014-11-24 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 --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi/virtio_scsi.c | 51 --

[PATCH v3 28/41] vhost/net: virtio 1.0 byte swap

2014-11-24 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index dce5c58..cae22f9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -416,7 +416,7 @@ static void ha

[PATCH v3 27/41] vhost: make features 64 bit

2014-11-24 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index b9032e8..1f321fd 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h

[PATCH v3 25/41] vhost/net: force len for TX to host endian

2014-11-24 Thread Michael S. Tsirkin
We use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 8dae2f7..dce5c58 100644 --- a/drivers/vhost/

[PATCH v3 26/41] vhost: virtio 1.0 endian-ness support

2014-11-24 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c90f437..4d379ed 100644 --- a/drivers/vhost/vhost.c +++ b/drive

[PATCH v3 24/41] vhost: add memory access wrappers

2014-11-24 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..b9032e8 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@

[PATCH v3 23/41] virtio_net: enable v1.0 support

2014-11-24 Thread Michael S. Tsirkin
Now that we have completed 1.0 support, enable it in our driver. Signed-off-by: Michael S. Tsirkin --- 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 a0e64cf..c6a72d3 100644 --- a/drivers/net/virtio_net.c +++

[PATCH v3 21/41] virtio_net: stricter short buffer length checks

2014-11-24 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 --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_ne

[PATCH v3 22/41] virtio_net: bigger header when VERSION_1 is set

2014-11-24 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 --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 098f443..a0

[PATCH v3 18/41] virtio_blk: fix race at module removal

2014-11-24 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 --- drivers/block/virtio_blk.c | 2 +- 1 fi

[PATCH v3 20/41] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr

2014-11-24 Thread Michael S. Tsirkin
virtio 1.0 doesn't use virtio_net_hdr anymore, and in fact, it's not really useful since virtio_net_hdr_mrg_rxbuf includes that as the first field anyway. Let's drop it, precalculate header len and store within vi instead. This way we can also remove struct skb_vnet_hdr. Signed-off-by: Michael S

[PATCH v3 19/41] virtio_net: pass vi around

2014-11-24 Thread Michael S. Tsirkin
Too many places poke at [rs]q->vq->vdev->priv just to get the the vi structure. Let's just pass the pointer around: seems cleaner, and might even be faster. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 38 -- 1 file changed, 20 insertions(

[PATCH v3 17/41] virtio_blk: make serial attribute static

2014-11-24 Thread Michael S. Tsirkin
It's never declared so no need to make it extern. Signed-off-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index f601f16..055f3df 100644 --- a/drivers/block/virti

[PATCH v3 09/41] virtio: simplify feature bit handling

2014-11-24 Thread Michael S. Tsirkin
Now that we use u64 for bits, we can simply & them together. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index a3df817..0f44cff 100644 --- a/drivers/

[PATCH v3 12/41] virtio_blk: v1.0 support

2014-11-24 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. Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck Signed-off-by: Michael S. Tsirkin --- include/

[PATCH v3 08/41] virtio: set FEATURES_OK

2014-11-24 Thread Michael S. Tsirkin
set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin --- include/uapi/linux/virtio_config.h | 2 ++ drivers/virtio/virtio.c| 29 ++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/uapi/linux/virtio_config.h b/in

[PATCH v3 11/41] virtio_net: v1.0 endianness

2014-11-24 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 Signed-off-by: Cornelia Huck Signed-off-by: Michael S. Tsirkin --- include/uapi/linux/vir

[PATCH v3 10/41] virtio: add legacy feature table support

2014-11-24 Thread Michael S. Tsirkin
virtio blk has some legacy feature bits that modern drivers must not negotiate, but are needed for old legacy hosts (e.g. that dn't support virtio scsi). Allow a separate legacy feature table for such cases. Signed-off-by: Michael S. Tsirkin --- include/linux/virtio.h | 4 drivers/virtio/

[PATCH v3 07/41] virtio: allow transports to get avail/used addresses

2014-11-24 Thread Michael S. Tsirkin
From: Cornelia Huck 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 way to access the location

[PATCH v3 04/41] virtio: memory access APIs

2014-11-24 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 e.g

[PATCH v3 02/41] virtio: add support for 64 bit features.

2014-11-24 Thread Michael S. Tsirkin
From: Rusty Russell Change the u32 to a u64, and make sure to use 1ULL everywhere! Cc: Brian Swetland Cc: Christian Borntraeger [Thomas Huth: fix up virtio-ccw get_features] Signed-off-by: Rusty Russell Signed-off-by: Cornelia Huck Acked-by: Pawel Moll Acked-by: Ohad Ben-Cohen Signed-off-

[PATCH v3 06/41] virtio_config: endian conversion for v1.0

2014-11-24 Thread Michael S. Tsirkin
We (ab)use virtio conversion functions for device-specific config space accesses. Reviewed-by: David Hildenbrand Signed-off-by: Rusty Russell Signed-off-by: Cornelia Huck Signed-off-by: Michael S. Tsirkin --- include/linux/virtio_config.h | 9 ++--- 1 file changed, 6 insertions(+), 3 dele

[PATCH v3 01/41] virtio: use u32, not bitmap for struct virtio_device's features

2014-11-24 Thread Michael S. Tsirkin
From: Rusty Russell It seemed like a good idea, but it's actually a pain when we get more than 32 feature bits. Just change it to a u32 for now. Cc: Brian Swetland Cc: Christian Borntraeger Signed-off-by: Rusty Russell Signed-off-by: Cornelia Huck Acked-by: Pawel Moll Acked-by: Ohad Ben-Co

[PATCH v3 05/41] virtio_ring: switch to new memory access APIs

2014-11-24 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 --- drivers/virtio/virtio_ring.c | 89 ++-- 1 file cha

[PATCH v3 03/41] virtio: add virtio 1.0 feature bit

2014-11-24 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. After all drivers are converted, we will be able to move VERSION_1 to core and drop it from all driver