Re: [PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-06 Thread Christoph Hellwig
On Tue, Dec 06, 2016 at 05:41:05PM +0200, Michael S. Tsirkin wrote: > __CHECK_ENDIAN__ isn't on by default presumably because > it triggers too many sparse warnings for correct code. > But virtio is now clean of these warnings, and > we want to keep it this way - enable this for > sparse builds. >

Re: [PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-06 Thread Johannes Berg
On Tue, 2016-12-06 at 17:41 +0200, Michael S. Tsirkin wrote: > It seems that there should be a better way to do it, > but this works too. In some cases there might be: > --- a/drivers/s390/virtio/Makefile > +++ b/drivers/s390/virtio/Makefile > @@ -6,6 +6,8 @@ >  # it under the terms of the GNU

Re: Oops with CONFIG_VMAP_STCK and bond device + virtio-net

2016-12-06 Thread Cong Wang
On Mon, Dec 5, 2016 at 3:53 PM, Laura Abbott wrote: > This looks like an issue with CONFIG_VMAP_STACK since bond_enslave uses > struct sockaddr from the stack and virtnet_set_mac_address calls > sg_init_one which triggers BUG_ON(!virt_addr_valid(buf)); > > I know there have

Re: [PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:41, Michael S. Tsirkin wrote: __CHECK_ENDIAN__ isn't on by default presumably because it triggers too many sparse warnings for correct code. But virtio is now clean of these warnings, and we want to keep it this way - enable this for sparse builds. Signed-off-by: Michael S.

Re: [PATCH 09/10] vsock/virtio: fix src/dst cid format

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:41, Michael S. Tsirkin wrote: These fields are 64 bit, using le32_to_cpu and friends on these will not do the right thing. Fix this up. Cc: sta...@vger.kernel.org Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport_common.c | 14

Re: [PATCH 08/10] vsock/virtio: mark an internal function static

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:41, Michael S. Tsirkin wrote: virtio_transport_alloc_pkt is only used locally, make it static. Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH 07/10] vsock/virtio: add a missing __le annotation

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: guest cid is read from config space, therefore it's in little endian format and is treated as such, annotate it accordingly. Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport.c | 2 +- 1 file changed, 1

Re: [PATCH 06/10] vhost: add missing __user annotations

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: Several vhost functions were missing __user annotations on pointers, causing sparse warnings. Fix this up. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 10 +- 1 file changed, 5 insertions(+), 5

Re: [PATCH 05/10] vhost: make interval tree static inline

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: vhost_umem_interval_tree is only used locally within vhost.c, mark it static. As some functions generated go unused, this triggers warnings unless we also mark it inline. Signed-off-by: Michael S. Tsirkin ---

Re: [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: virtio_gpu_queue_ctrl_buffer_locked is called with ctrlq.qlock taken, it releases and acquires this lock. This causes a sparse warning. Add appropriate annotations for sparse context checking. Signed-off-by: Michael S. Tsirkin

Re: [PATCH 03/10] drm/virtio: fix lock context imbalance

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: When virtio_gpu_free_vbufs exits due to list empty, it does not drop the free_vbufs lock that it took. list empty is not expected to happen anyway, but it can't hurt to fix this and drop the lock. Signed-off-by: Michael S. Tsirkin

Re: [PATCH 02/10] drm/virtio: fix endianness in primary_plane_update

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: virtio_gpu_cmd_transfer_to_host_2d expects x and y parameters in LE, but virtio_gpu_primary_plane_update passes in the CPU format instead. Signed-off-by: Michael S. Tsirkin --- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++--

Re: [PATCH 01/10] virtio_console: drop unused config fields

2016-12-06 Thread Jason Wang
On 2016年12月06日 23:40, Michael S. Tsirkin wrote: struct ports_device includes a config field including the whole virtio_console_config, but only max_nr_ports in there is ever updated or used. The rest is unused and in fact does not even mirror the device config. Drop everything except

[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory

2016-12-06 Thread Wendy Liang
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already

[RFC LINUX PATCH 2/2] rpmsg: DMA map sgs passed to virtio

2016-12-06 Thread Wendy Liang
From: "Edgar E. Iglesias" As rpmsg uses dma_alloc_coherent() to allocate memory to shared with the remote. Virtio ring requires the shared buffers to be passed as sg struct. As the memory has already been mapped, and we cannot convert the virtual address got from

[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory

2016-12-06 Thread Wendy Liang
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already

[RFC LINUX PATCH 1/2] virtio_ring: Do not call dma_map_page if sg is already mapped.

2016-12-06 Thread Wendy Liang
If sg is already dma mapped, do not call dma_map_page() in vring_map_one_sg(). In case of rpmsg, rpmsg uses dma_alloc_coherent() to allocate memory to share with the remote. There is no pages setup in dma_alloc_coherent(). In this case, we cannot convert the virtual address back to the physical

Re: [PATCH] virtio-net: Fix DMA-from-the-stack in virtnet_set_mac_address()

2016-12-06 Thread David Miller
From: Andy Lutomirski Date: Mon, 5 Dec 2016 18:10:58 -0800 > With CONFIG_VMAP_STACK=y, virtnet_set_mac_address() can be passed a > pointer to the stack and it will OOPS. Copy the address to the heap > to prevent the crash. > > Cc: Michael S. Tsirkin > Cc:

[PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-06 Thread Michael S. Tsirkin
__CHECK_ENDIAN__ isn't on by default presumably because it triggers too many sparse warnings for correct code. But virtio is now clean of these warnings, and we want to keep it this way - enable this for sparse builds. Signed-off-by: Michael S. Tsirkin --- It seems that there

[PATCH 09/10] vsock/virtio: fix src/dst cid format

2016-12-06 Thread Michael S. Tsirkin
These fields are 64 bit, using le32_to_cpu and friends on these will not do the right thing. Fix this up. Cc: sta...@vger.kernel.org Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport_common.c | 14 +++--- 1 file changed, 7 insertions(+), 7

[PATCH 08/10] vsock/virtio: mark an internal function static

2016-12-06 Thread Michael S. Tsirkin
virtio_transport_alloc_pkt is only used locally, make it static. Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport_common.c

[PATCH 07/10] vsock/virtio: add a missing __le annotation

2016-12-06 Thread Michael S. Tsirkin
guest cid is read from config space, therefore it's in little endian format and is treated as such, annotate it accordingly. Signed-off-by: Michael S. Tsirkin --- net/vmw_vsock/virtio_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 06/10] vhost: add missing __user annotations

2016-12-06 Thread Michael S. Tsirkin
Several vhost functions were missing __user annotations on pointers, causing sparse warnings. Fix this up. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/vhost.c

[PATCH 05/10] vhost: make interval tree static inline

2016-12-06 Thread Michael S. Tsirkin
vhost_umem_interval_tree is only used locally within vhost.c, mark it static. As some functions generated go unused, this triggers warnings unless we also mark it inline. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked

2016-12-06 Thread Michael S. Tsirkin
virtio_gpu_queue_ctrl_buffer_locked is called with ctrlq.qlock taken, it releases and acquires this lock. This causes a sparse warning. Add appropriate annotations for sparse context checking. Signed-off-by: Michael S. Tsirkin --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 ++ 1

[PATCH 03/10] drm/virtio: fix lock context imbalance

2016-12-06 Thread Michael S. Tsirkin
When virtio_gpu_free_vbufs exits due to list empty, it does not drop the free_vbufs lock that it took. list empty is not expected to happen anyway, but it can't hurt to fix this and drop the lock. Signed-off-by: Michael S. Tsirkin --- drivers/gpu/drm/virtio/virtgpu_vq.c | 4

[PATCH 00/10] virtio: sparse fixes

2016-12-06 Thread Michael S. Tsirkin
I run latest sparse from git on virtio drivers (turns out the version I had was rather outdated). This patchset fixes a couple of bugs this uncovered, and adds some annotations to make it sparse-clean. In particular, endian-ness is often tricky, so this patchset enabled endian-ness checks for

[PATCH 02/10] drm/virtio: fix endianness in primary_plane_update

2016-12-06 Thread Michael S. Tsirkin
virtio_gpu_cmd_transfer_to_host_2d expects x and y parameters in LE, but virtio_gpu_primary_plane_update passes in the CPU format instead. Signed-off-by: Michael S. Tsirkin --- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 01/10] virtio_console: drop unused config fields

2016-12-06 Thread Michael S. Tsirkin
struct ports_device includes a config field including the whole virtio_console_config, but only max_nr_ports in there is ever updated or used. The rest is unused and in fact does not even mirror the device config. Drop everything except max_nr_ports, saving some memory. Signed-off-by: Michael S.

[PATCH v9 4/6] powerpc/pv-qspinlock: powerpc support pv-qspinlock

2016-12-06 Thread Pan Xinhui
The default pv-qspinlock uses qspinlock(native version of pv-qspinlock). pv_lock initialization should be done in bootstage with irq disabled. And if we run as a guest with powerKVM/pHyp shared_processor mode, restore pv_lock_ops callbacks to pv-qspinlock(pv version) which makes full use of

[PATCH v9 6/6] powerpc/pv-qspinlock: Optimise native unlock path

2016-12-06 Thread Pan Xinhui
Avoid a function call under native version of qspinlock. On powerNV, bafore applying this patch, every unlock is expensive. This small optimizes enhance the performance. We use static_key with jump_lable which removes unnecessary loads of lppaca and its stuff. Signed-off-by: Pan Xinhui

[PATCH v9 3/6] powerpc: lib/locks.c: Add cpu yield/wake helper function

2016-12-06 Thread Pan Xinhui
Add two corresponding helper functions to support pv-qspinlock. For normal use, __spin_yield_cpu will confer current vcpu slices to the target vcpu(say, a lock holder). If target vcpu is not specified or it is in running state, such conferging to lpar happens or not depends. Because hcall itself

[PATCH v9 2/6] powerpc: platforms/Kconfig: Add qspinlock build config

2016-12-06 Thread Pan Xinhui
pSeries/powerNV will use qspinlock from now on. Signed-off-by: Pan Xinhui --- arch/powerpc/platforms/Kconfig | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index fbdae83..3559bbf 100644

[PATCH v9 5/6] powerpc: pSeries: Add pv-qspinlock build config/make

2016-12-06 Thread Pan Xinhui
pSeries run as a guest and might need pv-qspinlock. Signed-off-by: Pan Xinhui --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/platforms/pseries/Kconfig | 8 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/Makefile

[PATCH v9 0/6] Implement qspinlock/pv-qspinlock on ppc

2016-12-06 Thread Pan Xinhui
Hi All, this is the fairlock patchset. You can apply them and build successfully. patches are based on linux-next qspinlock can avoid waiter starved issue. It has about the same speed in single-thread and it can be much faster in high contention situations especially when the spinlock is

[PATCH v9 1/6] powerpc/qspinlock: powerpc support qspinlock

2016-12-06 Thread Pan Xinhui
This patch add basic code to enable qspinlock on powerpc. qspinlock is one kind of fairlock implementation. And seen some performance improvement under some scenarios. queued_spin_unlock() release the lock by just one write of NULL to the ::locked field which sits at different places in the two

RE: [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-06 Thread Gonglei (Arei)
Hi Herbert, Would you please review and/or ack the virtio_crypto_algs.c? It is the realization of specified algs based on Linux Crypto Framework. Thanks! Regards, -Gonglei > -Original Message- > From: Gonglei (Arei) > Sent: Thursday, December 01, 2016 8:39 PM > To:

Re: [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-06 Thread David Hildenbrand
Am 30.11.2016 um 09:43 schrieb Liang Li: This patch set contains two parts of changes to the virtio-balloon. One is the change for speeding up the inflating & deflating process, the main idea of this optimization is to use bitmap to send the page information to host instead of the PFNs, to