[PATCH linux-next v2] vdpa: Fix memory leak in error unwinding path

2021-02-16 Thread Parav Pandit
When device get command fails to find the device or mdev, it skips to free the skb during error unwinding path. Fix it by freeing in error unwind path. While at it, make error unwind path more clear to avoid such errors. Fixes: a12a2f694ce8 ("vdpa: Enable user to query vdpa device info") Signed-of

Re: [PATCH v1] vdpa/mlx5: Restore the hardware used index after change map

2021-02-16 Thread Si-Wei Liu
On 2/10/2021 7:45 AM, Eli Cohen wrote: On Wed, Feb 10, 2021 at 12:59:03AM -0800, Si-Wei Liu wrote: On 2/9/2021 7:53 PM, Jason Wang wrote: On 2021/2/10 上午10:30, Si-Wei Liu wrote: On 2/8/2021 10:37 PM, Jason Wang wrote: On 2021/2/9 下午2:12, Eli Cohen wrote: On Tue, Feb 09, 2021 at 11:20:14A

Re: [PATCH v5 4/8] x86/mm/tlb: Flush remote and local TLBs concurrently

2021-02-16 Thread Nadav Amit
> On Feb 16, 2021, at 4:10 AM, Peter Zijlstra wrote: > > On Tue, Feb 09, 2021 at 02:16:49PM -0800, Nadav Amit wrote: >> @@ -816,8 +821,8 @@ STATIC_NOPV void native_flush_tlb_others(const struct >> cpumask *cpumask, >> * doing a speculative memory access. >> */ >> if (info->freed

Re: [External] Re: vsock virtio: questions about supporting DGRAM type

2021-02-16 Thread Jiang Wang .
On Tue, Feb 16, 2021 at 12:50 AM Stefano Garzarella wrote: > > On Tue, Feb 16, 2021 at 12:23:19AM -0800, Jiang Wang . wrote: > >On Tue, Feb 16, 2021 at 12:09 AM Stefano Garzarella > >wrote: > >> > >> On Mon, Feb 15, 2021 at 08:50:36PM -0800, Jiang Wang . wrote: > >> >On Mon, Feb 15, 2021 at 12:3

Re: [PATCH] virtio_console: remove pointless check for debugfs_create_dir()

2021-02-16 Thread Amit Shah
On Tue, 2021-02-16 at 16:04 +0100, Greg Kroah-Hartman wrote: > It is impossible for debugfs_create_dir() to return NULL, so checking > for it gives people a false sense that they actually are doing something > if an error occurs. As there is no need to ever change kernel logic if > debugfs is work

[PATCH] virtio_console: remove pointless check for debugfs_create_dir()

2021-02-16 Thread Greg Kroah-Hartman
It is impossible for debugfs_create_dir() to return NULL, so checking for it gives people a false sense that they actually are doing something if an error occurs. As there is no need to ever change kernel logic if debugfs is working "properly" or not, there is no need to check the return value of

[PATCH for 5.10 v2 4/5] vdpa_sim: make 'config' generic and usable for any device type

2021-02-16 Thread Stefano Garzarella
commit f37cbbc65178e0a45823d281d290c4c02da9631c upstream. Add new 'config_size' attribute in 'vdpasim_dev_attr' and allocates 'config' dynamically to support any device types. Acked-by: Jason Wang Signed-off-by: Stefano Garzarella Link: https://lore.kernel.org/r/20201215144256.155342-12-sgarz..

[PATCH for 5.10 v2 5/5] vdpa_sim: add get_config callback in vdpasim_dev_attr

2021-02-16 Thread Stefano Garzarella
commit 65b709586e222fa6ffd4166ac7fdb5d5dad113ee upstream. The get_config callback can be used by the device to fill the config structure. The callback will be invoked in vdpasim_get_config() before copying bytes into caller buffer. Move vDPA-net config updates from vdpasim_set_features() in the n

[PATCH for 5.10 v2 1/5] vdpa_sim: remove hard-coded virtq count

2021-02-16 Thread Stefano Garzarella
From: Max Gurtovoy commit 423248d60d2b655321fc49eca1545f95a1bc9d6c upstream. Add a new attribute that will define the number of virt queues to be created for the vdpasim device. Signed-off-by: Max Gurtovoy [sgarzare: replace kmalloc_array() with kcalloc()] Acked-by: Jason Wang Signed-off-by:

[PATCH for 5.10 v2 3/5] vdpa_sim: store parsed MAC address in a buffer

2021-02-16 Thread Stefano Garzarella
commit cf1a3b35382c10ce315c32bd2b3d7789897fbe13 upstream. As preparation for the next patches, we store the MAC address, parsed during the vdpasim_create(), in a buffer that will be used to fill 'config' together with other configurations. Acked-by: Jason Wang Signed-off-by: Stefano Garzarella

[PATCH for 5.10 v2 2/5] vdpa_sim: add struct vdpasim_dev_attr for device attributes

2021-02-16 Thread Stefano Garzarella
commit 6c6e28fe45794054410ad8cd2770af69fbe0338d upstream. vdpasim_dev_attr will contain device specific attributes. We starting moving the number of virtqueues (i.e. nvqs) to vdpasim_dev_attr. vdpasim_create() creates a new vDPA simulator following the device attributes defined in the vdpasim_dev

[PATCH for 5.10 v2 0/5] vdpa_sim: fix param validation in vdpasim_get_config()

2021-02-16 Thread Stefano Garzarella
v1: https://lore.kernel.org/stable/20210211162519.215418-1-sgarz...@redhat.com/ v2: - backport the upstream patch and related patches needed Commit 65b709586e22 ("vdpa_sim: add get_config callback in vdpasim_dev_attr") unintentionally solved an issue in vdpasim_get_config() upstream while refacto

Re: [PATCH for 5.10] vdpa_sim: fix param validation in vdpasim_get_config()

2021-02-16 Thread Stefano Garzarella
On Mon, Feb 15, 2021 at 04:23:54PM +0100, Greg KH wrote: On Mon, Feb 15, 2021 at 04:03:21PM +0100, Stefano Garzarella wrote: On Mon, Feb 15, 2021 at 03:32:19PM +0100, Greg KH wrote: > On Thu, Feb 11, 2021 at 05:25:19PM +0100, Stefano Garzarella wrote: > > Commit 65b709586e222fa6ffd4166ac7fdb5d5d

Re: [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks.

2021-02-16 Thread Thomas Zimmermann
Am 16.02.21 um 14:27 schrieb Thomas Zimmermann: Hi this is a shadow-buffered plane. Did you consider using the new helpers for shadow-buffered planes? They will map the user BO for you and provide the mapping in the plane state. From there, you should implement your own plane state on top

Re: [PATCH 10/10] drm/qxl: add lock asserts to qxl_bo_kmap_locked + qxl_bo_kunmap_locked

2021-02-16 Thread Thomas Zimmermann
Hi Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Try avoid re-introducing locking bugs. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann IMHO this should eventually be done in the rsp TTM functions. But so far, I'd expect this to break some drivers. Best regards Thomas --- dri

Re: [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks.

2021-02-16 Thread Thomas Zimmermann
Hi this is a shadow-buffered plane. Did you consider using the new helpers for shadow-buffered planes? They will map the user BO for you and provide the mapping in the plane state. From there, you should implement your own plane state on top of struct drm_shadow_plane_state, and also move al

Re: [PATCH 08/10] drm/qxl: fix monitors object kmap

2021-02-16 Thread Thomas Zimmermann
Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Use the correct kmap variant. We don't hold a reservation here, so we can't use the _locked variant. We can drop the pin because qxl_bo_kmap will do that for us. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/q

Re: [PATCH] vdpa/mlx5: Extract correct pointer from driver data

2021-02-16 Thread Leon Romanovsky
On Tue, Feb 16, 2021 at 02:45:40PM +0200, Eli Cohen wrote: > On Tue, Feb 16, 2021 at 09:37:34AM +0200, Leon Romanovsky wrote: > > On Tue, Feb 16, 2021 at 08:42:26AM +0200, Eli Cohen wrote: > > > On Tue, Feb 16, 2021 at 08:35:51AM +0200, Leon Romanovsky wrote: > > > > On Tue, Feb 16, 2021 at 07:50:2

Re: [PATCH 06/10] drm/qxl: add qxl_bo_kmap/qxl_bo_kunmap

2021-02-16 Thread Thomas Zimmermann
Hi Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Add kmap/kunmap variants which reserve (and pin) the bo. They can be used in case the caller doesn't hold a reservation for the bo. Again, these functions should rather be called vmap/vunamp. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/

Re: [PATCH 07/10] drm/qxl: fix prime kmap

2021-02-16 Thread Thomas Zimmermann
Hi Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Use the correct kmap variant. We don't have a reservation here, so we can't use the _locked version. I'd merge this change into patch 6. So the new functions come with a caller. Best regards Thomas Signed-off-by: Gerd Hoffmann --- drivers/

Re: [PATCH 05/10] drm/qxl: rename qxl_bo_kmap -> qxl_bo_kmap_locked

2021-02-16 Thread Thomas Zimmermann
Hi Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Make clear that these functions should be called with reserved bo's only. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- drivers/gpu/drm/qxl/qxl_display.c | 14 +++--- drivers/gpu/d

Re: [PATCH 01/10] drm/qxl: properly handle device init failures

2021-02-16 Thread Thomas Zimmermann
Am 16.02.21 um 12:37 schrieb Gerd Hoffmann: Specifically do not try release resources which where not allocated in the first place. I still think this should eventually be resolved by using managed code. But for now Acked-by: Thomas Zimmermann Cc: Tong Zhang Tested-by: Tong Zhang Sig

Re: [PATCH v5 4/8] x86/mm/tlb: Flush remote and local TLBs concurrently

2021-02-16 Thread Peter Zijlstra
On Tue, Feb 09, 2021 at 02:16:49PM -0800, Nadav Amit wrote: > @@ -816,8 +821,8 @@ STATIC_NOPV void native_flush_tlb_others(const struct > cpumask *cpumask, >* doing a speculative memory access. >*/ > if (info->freed_tables) { > - smp_call_function_many(cpumask, fl

[PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks.

2021-02-16 Thread Gerd Hoffmann
We don't have to map in atomic_update callback then, making locking a bit less complicated. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/q

[PATCH 03/10] drm/qxl: use ttm bo priorities

2021-02-16 Thread Gerd Hoffmann
Allow to set priorities for buffer objects. Use priority 1 for surface and cursor command releases. Use priority 0 for drawing command releases. That way the short-living drawing commands are first in line when it comes to eviction, making it *much* less likely that ttm_bo_mem_force_space() pick

[PATCH 06/10] drm/qxl: add qxl_bo_kmap/qxl_bo_kunmap

2021-02-16 Thread Gerd Hoffmann
Add kmap/kunmap variants which reserve (and pin) the bo. They can be used in case the caller doesn't hold a reservation for the bo. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.h | 2 ++ drivers/gpu/drm/qxl/qxl_object.c | 36 2 files changed,

[PATCH 08/10] drm/qxl: fix monitors object kmap

2021-02-16 Thread Gerd Hoffmann
Use the correct kmap variant. We don't hold a reservation here, so we can't use the _locked variant. We can drop the pin because qxl_bo_kmap will do that for us. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) dif

[PATCH 05/10] drm/qxl: rename qxl_bo_kmap -> qxl_bo_kmap_locked

2021-02-16 Thread Gerd Hoffmann
Make clear that these functions should be called with reserved bo's only. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- drivers/gpu/drm/qxl/qxl_display.c | 14 +++--- drivers/gpu/drm/qxl/qxl_draw.c| 8 drivers/gpu/drm/q

[PATCH 10/10] drm/qxl: add lock asserts to qxl_bo_kmap_locked + qxl_bo_kunmap_locked

2021-02-16 Thread Gerd Hoffmann
Try avoid re-introducing locking bugs. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 22748b9566af..90d5e5b7f927 100644 --- a/drivers/gpu/drm/qxl/q

[PATCH 07/10] drm/qxl: fix prime kmap

2021-02-16 Thread Gerd Hoffmann
Use the correct kmap variant. We don't have a reservation here, so we can't use the _locked version. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_prime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_prime.c b/drivers/gpu/drm/qxl/qxl

[PATCH 01/10] drm/qxl: properly handle device init failures

2021-02-16 Thread Gerd Hoffmann
Specifically do not try release resources which where not allocated in the first place. Cc: Tong Zhang Tested-by: Tong Zhang Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ drivers/gpu/drm/qxl/qxl_kms.c | 4 2 files changed, 7 insertions(+) diff --git a/dr

[PATCH 04/10] drm/qxl: fix lockdep issue in qxl_alloc_release_reserved

2021-02-16 Thread Gerd Hoffmann
Call qxl_bo_unpin (which does a reservation) without holding the release_mutex lock. Fixes lockdep (correctly) warning on a possible deadlock. Fixes: 65ffea3c6e73 ("drm/qxl: unpin release objects") Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_release.c | 13 ++--- 1 file cha

[PATCH 02/10] drm/qxl: more fence wait rework

2021-02-16 Thread Gerd Hoffmann
Move qxl_io_notify_oom() call into wait condition. That way the driver will call it again if one call wasn't enough. Also allows to remove the extra dma_fence_is_signaled() check and the goto. Fixes: 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait") Signed-off-by: Gerd Hoffmann --- drivers/gpu/

[PATCH v2] virtio/s390: implement virtio-ccw revision 2 correctly

2021-02-16 Thread Cornelia Huck
CCW_CMD_READ_STATUS was introduced with revision 2 of virtio-ccw, and drivers should only rely on it being implemented when they negotiated at least that revision with the device. However, virtio_ccw_get_status() issued READ_STATUS for any device operating at least at revision 1. If the device acc

Re: [PATCH] virtio/s390: implement virtio-ccw revision 2 correctly

2021-02-16 Thread Halil Pasic
On Tue, 16 Feb 2021 11:39:07 +0100 Cornelia Huck wrote: > > > > Reviewed-by: Halil Pasic > > Thanks! > > I'll do a v2 with a tweaked commit message and cc:stable. Sounds good! ___ Virtualization mailing list Virtualization@lists.linux-foundation

Re: [PATCH] virtio/s390: implement virtio-ccw revision 2 correctly

2021-02-16 Thread Cornelia Huck
On Mon, 15 Feb 2021 19:51:44 +0100 Halil Pasic wrote: > On Mon, 15 Feb 2021 12:47:02 +0100 > Cornelia Huck wrote: > > > On Fri, 12 Feb 2021 18:04:11 +0100 > > Cornelia Huck wrote: > > > > > CCW_CMD_READ_STATUS was introduced with revision 2 of virtio-ccw, > > > and drivers should only rely

[RFC PATCH 10/10] vhost/vdpa: return configuration bytes read and written to user space

2021-02-16 Thread Stefano Garzarella
vdpa_get_config() and vdpa_set_config() now return the amount of bytes read and written, so let's return them to the user space. We also modify vhost_vdpa_config_validate() to return 0 (bytes read or written) instead of an error, when the buffer length is 0. Signed-off-by: Stefano Garzarella ---

[RFC PATCH 09/10] vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate()

2021-02-16 Thread Stefano Garzarella
Let's use the new 'get_config_size()' callback available instead of using the 'virtio_id' to get the size of the device config space. Signed-off-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vdpa.c b/dri

[RFC PATCH 08/10] vhost/vdpa: allow user space to pass buffers bigger than config space

2021-02-16 Thread Stefano Garzarella
vdpa_get_config() and vdpa_set_config() now are able to read/write only the bytes available in the device configuration space, also if the buffer provided is bigger than that. Let's use this feature to allow the user space application to pass any buffer. We limit the size of the internal bounce bu

[RFC PATCH 06/10] virtio_vdpa: use vdpa_set_config()

2021-02-16 Thread Stefano Garzarella
Instead of calling the 'set_config' callback directly, we call the new vdpa_set_config() helper which also checks the parameters. Signed-off-by: Stefano Garzarella --- drivers/virtio/virtio_vdpa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_vdpa.c

[RFC PATCH 07/10] vhost/vdpa: use vdpa_set_config()

2021-02-16 Thread Stefano Garzarella
Instead of calling the 'set_config' callback directly, we call the new vdpa_set_config() helper which also checks the parameters. Signed-off-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/

[RFC PATCH 04/10] vdpa: remove param checks in the get/set_config callbacks

2021-02-16 Thread Stefano Garzarella
vdpa_get_config() and vdpa_set_config() now check parameters before calling callbacks, so we can remove these redundant checks. Signed-off-by: Stefano Garzarella --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +-- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 -- 2 files changed, 1 insertion(+), 8 deleti

[RFC PATCH 05/10] vdpa: remove WARN_ON() in the get/set_config callbacks

2021-02-16 Thread Stefano Garzarella
vdpa_get_config() and vdpa_set_config() now check parameters before calling callbacks, so we can remove these warnings. Signed-off-by: Stefano Garzarella --- Maybe we can skip this patch and leave the WARN_ONs in place. What do you recommend? --- drivers/vdpa/ifcvf/ifcvf_base.c | 3 +-- drivers/

[RFC PATCH 03/10] vdpa: add vdpa_set_config() helper

2021-02-16 Thread Stefano Garzarella
Let's add a function similar to vpda_get_config() to check the 'offset' and 'len' parameters, call the set_config() device callback, and return the amount of bytes written. Signed-off-by: Stefano Garzarella --- include/linux/vdpa.h | 2 ++ drivers/vdpa/vdpa.c | 16 2 files cha

[RFC PATCH 01/10] vdpa: add get_config_size callback in vdpa_config_ops

2021-02-16 Thread Stefano Garzarella
This new callback is used to get the size of the configuration space of vDPA devices. Signed-off-by: Stefano Garzarella --- include/linux/vdpa.h | 4 drivers/vdpa/ifcvf/ifcvf_main.c | 6 ++ drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 ++ drivers/vdpa/vdpa_sim/vdpa_sim.c |

[RFC PATCH 02/10] vdpa: check vdpa_get_config() parameters and return bytes read

2021-02-16 Thread Stefano Garzarella
Now we have the 'get_config_size()' callback available, so we can check that 'offset' and 'len' parameters are valid. When these exceed boundaries, we limit the reading to the available configuration space in the device, and we return the amount of bytes read. We also move vdpa_get_config() imple

[RFC PATCH 00/10] vdpa: get/set_config() rework

2021-02-16 Thread Stefano Garzarella
Following the discussion with Michael and Jason [1], I reworked a bit get/set_config() in vdpa. I changed vdpa_get_config() to check the boundaries and added vdpa_set_config(). When 'offset' or 'len' parameters exceed boundaries, we limit the reading to the available configuration space in the dev

Re: [External] Re: vsock virtio: questions about supporting DGRAM type

2021-02-16 Thread Stefano Garzarella
On Tue, Feb 16, 2021 at 12:23:19AM -0800, Jiang Wang . wrote: On Tue, Feb 16, 2021 at 12:09 AM Stefano Garzarella wrote: On Mon, Feb 15, 2021 at 08:50:36PM -0800, Jiang Wang . wrote: >On Mon, Feb 15, 2021 at 12:31 AM Stefano Garzarella wrote: >> >> On Sat, Feb 13, 2021 at 03:26:18PM -0800, J

Re: [External] Re: vsock virtio: questions about supporting DGRAM type

2021-02-16 Thread Jiang Wang .
On Tue, Feb 16, 2021 at 12:09 AM Stefano Garzarella wrote: > > On Mon, Feb 15, 2021 at 08:50:36PM -0800, Jiang Wang . wrote: > >On Mon, Feb 15, 2021 at 12:31 AM Stefano Garzarella > >wrote: > >> > >> On Sat, Feb 13, 2021 at 03:26:18PM -0800, Jiang Wang . wrote: > >> >On Fri, Feb 12, 2021 at 1:02

Re: [External] Re: vsock virtio: questions about supporting DGRAM type

2021-02-16 Thread Stefano Garzarella
On Mon, Feb 15, 2021 at 08:50:36PM -0800, Jiang Wang . wrote: On Mon, Feb 15, 2021 at 12:31 AM Stefano Garzarella wrote: On Sat, Feb 13, 2021 at 03:26:18PM -0800, Jiang Wang . wrote: >On Fri, Feb 12, 2021 at 1:02 AM Stefano Garzarella wrote: >> >> Hi Jiang, >> >> CCing Arseny who is working o