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

2022-06-30 Thread Jason Wang
On Fri, Jul 1, 2022 at 12:03 PM Jakub Kicinski wrote: > > On Fri, 1 Jul 2022 10:06:55 +0800 Jason Wang wrote: > > We try using cancel_delayed_work_sync() to prevent the work from > > enabling NAPI. This is insufficient since we don't disable the source > > of the refill work scheduling. This

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

2022-06-30 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 source of the refill work scheduling. This means an NAPI poll callback after cancel_delayed_work_sync() can schedule the refill work then can re-enable the NAPI that

Re: [PATCH] rpmsg: virtio: Fix broken rpmsg_probe()

2022-06-30 Thread Jason Wang
On Fri, Jul 1, 2022 at 3:20 AM Michael S. Tsirkin wrote: > > On Thu, Jun 30, 2022 at 11:51:30AM -0600, Mathieu Poirier wrote: > > + virtualization@lists.linux-foundation.org > > + jasow...@redhat.com > > + m...@redhat.com > > > > On Thu, 30 Jun 2022 at 10:20, Arnaud POULIQUEN > > wrote: > > > >

Re: [PATCH v1 1/1] virtio: Restore semantics of vq->broken in virtqueues

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 11:44 PM Michael S. Tsirkin wrote: > > On Thu, Jun 30, 2022 at 01:08:53PM +0300, Alexander Atanasov wrote: > > Hello, > > > > On 30/06/2022 12:46, Michael S. Tsirkin wrote: > > > On Thu, Jun 30, 2022 at 09:36:46AM +, Alexander Atanasov wrote: > > > > virtio: harden

Re: [PATCH] virtio: VIRTIO_HARDEN_NOTIFICATION is broken

2022-06-30 Thread Jason Wang
On Fri, Jul 1, 2022 at 3:16 AM Michael S. Tsirkin wrote: > > This option doesn't really work and breaks too many drivers. > Not yet sure what's the right thing to do, for now > let's make sure randconfig isn't broken by this. > > Fixes: c346dae4f3fb ("virtio: disable notification hardening by

Re: [PATCH v1 1/1] virtio: Restore semantics of vq->broken in virtqueues

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 6:09 PM Alexander Atanasov wrote: > > Hello, > > On 30/06/2022 12:46, Michael S. Tsirkin wrote: > > On Thu, Jun 30, 2022 at 09:36:46AM +, Alexander Atanasov wrote: > >> virtio: harden vring IRQ (8b4ec69d7e09) changed the use > >> of vq->broken. As result

Re: [PATCH] rpmsg: virtio: Fix broken rpmsg_probe()

2022-06-30 Thread Michael S. Tsirkin
On Thu, Jun 30, 2022 at 11:51:30AM -0600, Mathieu Poirier wrote: > + virtualization@lists.linux-foundation.org > + jasow...@redhat.com > + m...@redhat.com > > On Thu, 30 Jun 2022 at 10:20, Arnaud POULIQUEN > wrote: > > > > Hi, > > > > On 6/29/22 19:43, Mathieu Poirier wrote: > > > Hi Anup, > > >

[PATCH] virtio: VIRTIO_HARDEN_NOTIFICATION is broken

2022-06-30 Thread Michael S. Tsirkin
This option doesn't really work and breaks too many drivers. Not yet sure what's the right thing to do, for now let's make sure randconfig isn't broken by this. Fixes: c346dae4f3fb ("virtio: disable notification hardening by default") Cc: "Jason Wang" Signed-off-by: Michael S. Tsirkin ---

Re: [PATCH v1 1/1] virtio: Restore semantics of vq->broken in virtqueues

2022-06-30 Thread Michael S. Tsirkin
On Thu, Jun 30, 2022 at 01:08:53PM +0300, Alexander Atanasov wrote: > Hello, > > On 30/06/2022 12:46, Michael S. Tsirkin wrote: > > On Thu, Jun 30, 2022 at 09:36:46AM +, Alexander Atanasov wrote: > > > virtio: harden vring IRQ (8b4ec69d7e09) changed the use > > > of vq->broken. As result

[PATCH v2 3/3] vdpa_sim_blk: call vringh_complete_iotlb() also in the error path

2022-06-30 Thread Stefano Garzarella
Call vringh_complete_iotlb() even when we encounter a serious error that prevents us from writing the status in the "in" header (e.g. the header length is incorrect, etc.). The guest is misbehaving, so maybe the ring is in a bad state, but let's avoid making things worse. Acked-by: Jason Wang

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

2022-06-30 Thread Stefano Garzarella
Limit the number of requests (4 per queue as for vdpa_sim_net) handled in a batch to prevent the worker from using the CPU for too long. Suggested-by: Eugenio PĂ©rez Signed-off-by: Stefano Garzarella --- v2: - restored previous behaviour, exiting the loop immediately if the request is

[PATCH v2 1/3] vdpa_sim_blk: use dev_dbg() to print errors

2022-06-30 Thread Stefano Garzarella
Use dev_dbg() instead of dev_err()/dev_warn() to avoid flooding the host with prints, when the guest driver is misbehaving. In this way, prints can be dynamically enabled when the vDPA block simulator is used to validate a driver. Suggested-by: Jason Wang Acked-by: Jason Wang Signed-off-by:

[PATCH v2 0/3] vdpa_sim_blk: several fixes for the vDPA block simulator

2022-06-30 Thread Stefano Garzarella
v2: - Patch 2: restored previous behaviour, exiting the loop immediately if the request is malformed [Jason] - Added Jason's A-b In patch 1 and 3 v1: https://lore.kernel.org/virtualization/20220621160859.196646-1-sgarz...@redhat.com/ The first two patches essentially limit the possibility of

RE: [PATCH v3 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-30 Thread Tian, Kevin
> From: Robin Murphy > Sent: Thursday, June 30, 2022 4:22 PM > > On 2022-06-29 20:47, Nicolin Chen wrote: > > On Fri, Jun 24, 2022 at 03:19:43PM -0300, Jason Gunthorpe wrote: > >> On Fri, Jun 24, 2022 at 06:35:49PM +0800, Yong Wu wrote: > >> > > It's not used in VFIO context. "return 0" just

Re: [PATCH v1 1/1] virtio: Restore semantics of vq->broken in virtqueues

2022-06-30 Thread Michael S. Tsirkin
On Thu, Jun 30, 2022 at 09:36:46AM +, Alexander Atanasov wrote: > virtio: harden vring IRQ (8b4ec69d7e09) changed the use > of vq->broken. As result vring_interrupt handles IRQs for > broken drivers as IRQ_NONE and not IRQ_HANDLED and made impossible > to initiallize vqs before the driver is

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

2022-06-30 Thread Michael S. Tsirkin
On Thu, Jun 30, 2022 at 10:01:16AM +0800, Jason Wang wrote: > On Wed, Jun 29, 2022 at 4:52 PM Michael S. Tsirkin wrote: > > > > On Wed, Jun 29, 2022 at 04:34:36PM +0800, Jason Wang wrote: > > > On Wed, Jun 29, 2022 at 3:15 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Wed, Jun 29, 2022

Re: [PATCH v3 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-30 Thread Robin Murphy
On 2022-06-29 20:47, Nicolin Chen wrote: On Fri, Jun 24, 2022 at 03:19:43PM -0300, Jason Gunthorpe wrote: On Fri, Jun 24, 2022 at 06:35:49PM +0800, Yong Wu wrote: It's not used in VFIO context. "return 0" just satisfy the iommu framework to go ahead. and yes, here we only allow the shared

Re: [PATCH v11 05/40] virtio_ring: split vring_virtqueue

2022-06-30 Thread Jason Wang
On Wed, Jun 29, 2022 at 2:57 PM Xuan Zhuo wrote: > > Separate the two inline structures(split and packed) from the structure > vring_virtqueue. > > In this way, we can use these two structures later to pass parameters > and retain temporary variables. > > Signed-off-by: Xuan Zhuo Acked-by:

Re: [PATCH v11 02/40] virtio: struct virtio_config_ops add callbacks for queue_reset

2022-06-30 Thread Jason Wang
On Wed, Jun 29, 2022 at 2:57 PM Xuan Zhuo wrote: > > reset can be divided into the following four steps (example): > 1. transport: notify the device to reset the queue > 2. vring: recycle the buffer submitted > 3. vring: reset/resize the vring (may re-alloc) > 4. transport: mmap vring

Re: [PATCH v11 01/40] virtio: add helper virtqueue_get_vring_max_size()

2022-06-30 Thread Jason Wang
On Wed, Jun 29, 2022 at 2:57 PM Xuan Zhuo wrote: > > Record the maximum queue num supported by the device. > > virtio-net can display the maximum (supported by hardware) ring size in > ethtool -g eth0. > > When the subsequent patch implements vring reset, it can judge whether > the ring size

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

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 2:26 PM Xuan Zhuo wrote: > > On Thu, 30 Jun 2022 14:07:52 +0800, Jason Wang wrote: > > On Thu, Jun 30, 2022 at 10:22 AM Xuan Zhuo > > wrote: > > > > > > On Thu, 30 Jun 2022 10:08:04 +0800, Jason Wang > > > wrote: > > > > We try using cancel_delayed_work_sync() to

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

2022-06-30 Thread Xuan Zhuo
On Thu, 30 Jun 2022 14:07:52 +0800, Jason Wang wrote: > On Thu, Jun 30, 2022 at 10:22 AM Xuan Zhuo wrote: > > > > On Thu, 30 Jun 2022 10:08:04 +0800, Jason Wang wrote: > > > We try using cancel_delayed_work_sync() to prevent the work from > > > enabling NAPI. This is insufficient since we don't

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

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 2:07 PM Jason Wang wrote: > > On Thu, Jun 30, 2022 at 10:51 AM Jakub Kicinski wrote: > > > > On Thu, 30 Jun 2022 10:08:04 +0800 Jason Wang wrote: > > > +static void enable_refill_work(struct virtnet_info *vi) > > > +{ > > > + spin_lock(>refill_lock); > > > +

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

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 10:22 AM Xuan Zhuo wrote: > > On Thu, 30 Jun 2022 10:08:04 +0800, Jason Wang wrote: > > We try using cancel_delayed_work_sync() to prevent the work from > > enabling NAPI. This is insufficient since we don't disable the source > > of the refill work scheduling. This means

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

2022-06-30 Thread Jason Wang
On Thu, Jun 30, 2022 at 10:51 AM Jakub Kicinski wrote: > > On Thu, 30 Jun 2022 10:08:04 +0800 Jason Wang wrote: > > +static void enable_refill_work(struct virtnet_info *vi) > > +{ > > + spin_lock(>refill_lock); > > + vi->refill_work_enabled = true; > > + spin_unlock(>refill_lock); > >