Re: [PATCH v3 0/3] virtio: support requiring restricted access per device

2022-06-28 Thread Stefano Stabellini
On Wed, 22 Jun 2022, Juergen Gross wrote: > Instead of an all or nothing approach add support for requiring > restricted memory access per device. > > Changes in V3: > - new patches 1 + 2 > - basically complete rework of patch 3 > > Juergen Gross (3): > virtio: replace restricted mem access

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:17 PM Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:00 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 11:49:12AM +0800, Jason Wang wrote: > > > > Heh. Yea sure. But things work fine for people. What is the chance > > > > your review found and fixed all

Re: [PATCH v2 -next] vdpa/mlx5: Use eth_zero_addr() to assign zero address

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 12:34:57PM +, Xu Qiang wrote: > Using eth_zero_addr() to assign zero address instead of memset(). > > Reported-by: Hulk Robot > Signed-off-by: Xu Qiang Acked-by: Michael S. Tsirkin > --- > v2: > - fix typo in commit log > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4

Re: [PATCH v6 4/4] vdpa_sim: Implement suspend vdpa op

2022-06-28 Thread Jason Wang
On Fri, Jun 24, 2022 at 12:08 AM Eugenio Pérez wrote: > > Implement suspend operation for vdpa_sim devices, so vhost-vdpa will > offer that backend feature and userspace can effectively suspend the > device. > > This is a must before get virtqueue indexes (base) for live migration, > since the

Re: [PATCH v6 3/4] vhost-vdpa: uAPI to suspend the device

2022-06-28 Thread Jason Wang
On Fri, Jun 24, 2022 at 12:08 AM Eugenio Pérez wrote: > > The ioctl adds support for suspending the device from userspace. > > This is a must before getting virtqueue indexes (base) for live migration, > since the device could modify them after userland gets them. There are > individual ways to

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:25 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:18:55PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 2:17 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 02:10:38PM +0800, Jason Wang wrote: > > > > On Tue, Jun 28, 2022 at 2:07 PM

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 1:58 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 11:54:27AM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 6:01 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 04:12:57PM +0800, Cindy Lu wrote: > > > > On Sun, Jun 26, 2022 at 6:01 PM

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:03:38PM +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 1:58 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 11:54:27AM +0800, Jason Wang wrote: > > > On Mon, Jun 27, 2022 at 6:01 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Jun 27, 2022

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 3:58 PM

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Jun 27, 2022

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:07 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:03:38PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:58 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:54:27AM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 6:01 PM

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:18:55PM +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 2:17 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 02:10:38PM +0800, Jason Wang wrote: > > > On Tue, Jun 28, 2022 at 2:07 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Tue, Jun 28, 2022

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:32:19PM +0800, Jason Wang wrote: > > Question is are there drivers which kick before they are ready > > to handle callbacks? > > Let me try to have a look at all the drivers to answer this. One thing to note is that I consider hardening probe and hardening remove

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 7:53 PM

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:17 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:10:38PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 2:07 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 02:03:38PM +0800, Jason Wang wrote: > > > > On Tue, Jun 28, 2022 at 1:58 PM

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:24 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:17:50PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:00 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:49:12AM +0800, Jason Wang wrote: > > > > > Heh. Yea sure. But things work

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-28 Thread Xuan Zhuo
On Tue, 28 Jun 2022 14:12:13 +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Tue, Jun 28, 2022 at

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Geert Uytterhoeven
Hi Gustavo, Thanks for your patch! On Mon, Jun 27, 2022 at 8:04 PM Gustavo A. R. Silva wrote: > There is a regular need in the kernel to provide a way to declare > having a dynamically sized set of trailing elements in a structure. > Kernel code should always use “flexible array members”[1] for

Re: [PATCH 2/3] vdpa_sim_blk: limit the number of request handled per batch

2022-06-28 Thread Stefano Garzarella
On Tue, Jun 28, 2022 at 6:01 AM Jason Wang wrote: > > On Thu, Jun 23, 2022 at 4:58 PM Stefano Garzarella > wrote: > > > > On Thu, Jun 23, 2022 at 11:50:22AM +0800, Jason Wang wrote: > > >On Wed, Jun 22, 2022 at 12:09 AM Stefano Garzarella > > >wrote: > > >> > > >> Limit the number of requests

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-28 Thread Jason Wang
On Tue, Jun 28, 2022 at 1:00 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 11:49:12AM +0800, Jason Wang wrote: > > > Heh. Yea sure. But things work fine for people. What is the chance > > > your review found and fixed all driver bugs? > > > > I don't/can't audit all bugs but the race

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:10:38PM +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 2:07 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 02:03:38PM +0800, Jason Wang wrote: > > > On Tue, Jun 28, 2022 at 1:58 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Tue, Jun 28, 2022

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 02:17:50PM +0800, Jason Wang wrote: > On Tue, Jun 28, 2022 at 1:00 PM Michael S. Tsirkin wrote: > > > > On Tue, Jun 28, 2022 at 11:49:12AM +0800, Jason Wang wrote: > > > > Heh. Yea sure. But things work fine for people. What is the chance > > > > your review found and

[PATCH] virtio-net: fix the race between refill work and close

2022-06-28 Thread Jason Wang
We try using cancel_delayed_work_sync() to prevent the work from enabling NAPI. This is insufficient since we don't disable the the source the scheduling of the refill work. This means an NAPI after cancel_delayed_work_sync() can schedule the refill work then can re-enable the NAPI that leads to

Re: [PATCH -next] vdpa/mlx5: Use eth_zero_addr() to assign zero address

2022-06-28 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 09:44:18AM +, Xu Qiang wrote: > Using eth_zero_addr() to assign zero address insetad of typo > memset(). > > Reported-by: Hulk Robot > Signed-off-by: Xu Qiang > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >

Re: [PATCH v6 00/22] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2022-06-28 Thread Robin Murphy
On 2022-05-27 00:50, Dmitry Osipenko wrote: Hello, This patchset introduces memory shrinker for the VirtIO-GPU DRM driver and adds memory purging and eviction support to VirtIO-GPU driver. The new dma-buf locking convention is introduced here as well. During OOM, the shrinker will release BOs

Re: [PATCH v6 1/4] vdpa: Add suspend operation

2022-06-28 Thread Stefano Garzarella
On Thu, Jun 23, 2022 at 06:07:35PM +0200, Eugenio Pérez wrote: This operation is optional: It it's not implemented, backend feature bit will not be exposed. Signed-off-by: Eugenio Pérez --- include/linux/vdpa.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/vdpa.h

Re: [PATCH v6 3/4] vhost-vdpa: uAPI to suspend the device

2022-06-28 Thread Stefano Garzarella
On Thu, Jun 23, 2022 at 06:07:37PM +0200, Eugenio Pérez wrote: >The ioctl adds support for suspending the device from userspace. > >This is a must before getting virtqueue indexes (base) for live migration, >since the device could modify them after userland gets them. There are >individual ways to

Re: [PATCH v6] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-28 Thread Waiman Long
On 6/28/22 08:54, Guo Hui wrote: The instructions assigned to the vcpu_is_preempted function parameter in the X86 architecture physical machine are redundant instructions, causing the multi-core performance of Unixbench to drop by about 4% to 5%. The C function is as follows: static bool

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > Though maybe we could just switch off > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > We need to think in a different strategy. I think we will need to switch off the warning in userspace - this is

Re: [PATCH v6 2/4] vhost-vdpa: introduce SUSPEND backend feature bit

2022-06-28 Thread Stefano Garzarella
On Thu, Jun 23, 2022 at 06:07:36PM +0200, Eugenio Pérez wrote: Userland knows if it can suspend the device or not by checking this feature bit. It's only offered if the vdpa driver backend implements the suspend() operation callback, and to offer it or userland to ack it if the backend does not

Re: [PATCH v6 1/4] vdpa: Add suspend operation

2022-06-28 Thread Jason Wang
On Fri, Jun 24, 2022 at 12:07 AM Eugenio Pérez wrote: > > This operation is optional: It it's not implemented, backend feature bit > will not be exposed. A question, do we allow suspending a device without DRIVER_OK? Thanks > > Signed-off-by: Eugenio Pérez > --- > include/linux/vdpa.h | 4

Re: [PATCH v6 2/4] vhost-vdpa: introduce SUSPEND backend feature bit

2022-06-28 Thread Jason Wang
On Fri, Jun 24, 2022 at 12:08 AM Eugenio Pérez wrote: > > Userland knows if it can suspend the device or not by checking this feature > bit. > > It's only offered if the vdpa driver backend implements the suspend() > operation callback, and to offer it or userland to ack it if the backend > does

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 10:54:58AM -0700, Kees Cook wrote: > which must also be assuming it's a header. So probably better to just > drop the driver_data field? I don't see anything using it (that I can > find) besides as a sanity-check that the field exists and is at the end > of the struct.

Re: [PATCH v6 00/22] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2022-06-28 Thread Rob Clark
On Tue, Jun 28, 2022 at 5:51 AM Dmitry Osipenko wrote: > > On 6/28/22 15:31, Robin Murphy wrote: > > ->8- > > [ 68.295951] == > > [ 68.295956] WARNING: possible circular locking dependency detected > > [ 68.295963] 5.19.0-rc3+ #400

Re: [PATCH v7] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-28 Thread Waiman Long
On 6/28/22 12:12, Guo Hui wrote: The instructions assigned to the vcpu_is_preempted function parameter in the X86 architecture physical machine are redundant instructions, causing the multi-core performance of Unixbench to drop by about 4% to 5%. The C function is as follows: static bool

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Mon, Jun 27, 2022 at 09:40:52PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > > [...] > > Fyi, this breaks BPF CI: > > > > https://github.com/kernel-patches/bpf/runs/7078719372?check_suite_focus=true > > > > [...] > >

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Tue, Jun 28, 2022 at 09:27:21AM +0200, Geert Uytterhoeven wrote: > Hi Gustavo, > > Thanks for your patch! > > On Mon, Jun 27, 2022 at 8:04 PM Gustavo A. R. Silva > wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing