[PATCH V2 0/5] rework on the IRQ hardening of virtio

Jason Wang posted 5 patches 4 years, 2 months ago
There is a newer version of this series
drivers/virtio/virtio.c            | 20 ++++++++++++++++----
drivers/virtio/virtio_pci_common.c | 14 ++++++++++++++
drivers/virtio/virtio_pci_common.h |  2 ++
drivers/virtio/virtio_pci_legacy.c |  1 +
drivers/virtio/virtio_pci_modern.c |  2 ++
drivers/virtio/virtio_ring.c       |  9 ++++++++-
include/linux/virtio.h             |  2 ++
include/linux/virtio_config.h      | 24 ++++++++++++++++++++++++
8 files changed, 69 insertions(+), 5 deletions(-)
[PATCH V2 0/5] rework on the IRQ hardening of virtio
Posted by Jason Wang 4 years, 2 months ago
Hi All:

This is a rework on the IRQ hardening for virtio which is done
previously by the following commits are reverted:

9e35276a5344 ("virtio_pci: harden MSI-X interrupts")
080cd7c3ac87 ("virtio-pci: harden INTX interrupts")

The reason is that it depends on the IRQF_NO_AUTOEN which may conflict
with the assumption of the affinity managed IRQ that is used by some
virtio drivers. And what's more, it is only done for virtio-pci but
not other transports.

In this rework, I try to implement a general virtio solution which
borrows the idea of the INTX hardening by introducing a boolean for
virtqueue callback enabling and toggle it in virtio_device_ready()
and virtio_reset_device(). Then vring_interrupt() can simply check and
return early if the driver is not ready.

Please review.

Changes since v1:

- Use transport specific irq synchronization method when possible
- Drop the module parameter and enable the hardening unconditonally
- Tweak the barrier/ordering facilities used in the code
- Reanme irq_soft_enabled to driver_ready
- Avoid unnecssary IRQ synchornization (e.g during boot)

Jason Wang (4):
  virtio: use virtio_reset_device() when possible
  virtio: introduce config op to synchronize vring callbacks
  virtio-pci: implement synchronize_vqs()
  virtio: harden vring IRQ

Stefano Garzarella (1):
  virtio: use virtio_device_ready() in virtio_device_restore()

 drivers/virtio/virtio.c            | 20 ++++++++++++++++----
 drivers/virtio/virtio_pci_common.c | 14 ++++++++++++++
 drivers/virtio/virtio_pci_common.h |  2 ++
 drivers/virtio/virtio_pci_legacy.c |  1 +
 drivers/virtio/virtio_pci_modern.c |  2 ++
 drivers/virtio/virtio_ring.c       |  9 ++++++++-
 include/linux/virtio.h             |  2 ++
 include/linux/virtio_config.h      | 24 ++++++++++++++++++++++++
 8 files changed, 69 insertions(+), 5 deletions(-)

-- 
2.25.1
Re: [PATCH V2 0/5] rework on the IRQ hardening of virtio
Posted by Michael S. Tsirkin 4 years, 2 months ago
On Wed, Apr 06, 2022 at 04:35:33PM +0800, Jason Wang wrote:
> Hi All:
> 
> This is a rework on the IRQ hardening for virtio which is done
> previously by the following commits are reverted:
> 
> 9e35276a5344 ("virtio_pci: harden MSI-X interrupts")
> 080cd7c3ac87 ("virtio-pci: harden INTX interrupts")
> 
> The reason is that it depends on the IRQF_NO_AUTOEN which may conflict
> with the assumption of the affinity managed IRQ that is used by some
> virtio drivers. And what's more, it is only done for virtio-pci but
> not other transports.
> 
> In this rework, I try to implement a general virtio solution which
> borrows the idea of the INTX hardening by introducing a boolean for
> virtqueue callback enabling and toggle it in virtio_device_ready()
> and virtio_reset_device(). Then vring_interrupt() can simply check and
> return early if the driver is not ready.


All of a sudden all patches are having a wrong mime type.

It is application/octet-stream; should be text/plain

Pls fix and repost, thanks!

> Please review.
> 
> Changes since v1:
> 
> - Use transport specific irq synchronization method when possible
> - Drop the module parameter and enable the hardening unconditonally
> - Tweak the barrier/ordering facilities used in the code
> - Reanme irq_soft_enabled to driver_ready
> - Avoid unnecssary IRQ synchornization (e.g during boot)
> 
> Jason Wang (4):
>   virtio: use virtio_reset_device() when possible
>   virtio: introduce config op to synchronize vring callbacks
>   virtio-pci: implement synchronize_vqs()
>   virtio: harden vring IRQ
> 
> Stefano Garzarella (1):
>   virtio: use virtio_device_ready() in virtio_device_restore()
> 
>  drivers/virtio/virtio.c            | 20 ++++++++++++++++----
>  drivers/virtio/virtio_pci_common.c | 14 ++++++++++++++
>  drivers/virtio/virtio_pci_common.h |  2 ++
>  drivers/virtio/virtio_pci_legacy.c |  1 +
>  drivers/virtio/virtio_pci_modern.c |  2 ++
>  drivers/virtio/virtio_ring.c       |  9 ++++++++-
>  include/linux/virtio.h             |  2 ++
>  include/linux/virtio_config.h      | 24 ++++++++++++++++++++++++
>  8 files changed, 69 insertions(+), 5 deletions(-)
> 
> -- 
> 2.25.1
Re: [PATCH V2 0/5] rework on the IRQ hardening of virtio
Posted by Jason Wang 4 years, 2 months ago
在 2022/4/6 下午7:36, Michael S. Tsirkin 写道:
> On Wed, Apr 06, 2022 at 04:35:33PM +0800, Jason Wang wrote:
>> Hi All:
>>
>> This is a rework on the IRQ hardening for virtio which is done
>> previously by the following commits are reverted:
>>
>> 9e35276a5344 ("virtio_pci: harden MSI-X interrupts")
>> 080cd7c3ac87 ("virtio-pci: harden INTX interrupts")
>>
>> The reason is that it depends on the IRQF_NO_AUTOEN which may conflict
>> with the assumption of the affinity managed IRQ that is used by some
>> virtio drivers. And what's more, it is only done for virtio-pci but
>> not other transports.
>>
>> In this rework, I try to implement a general virtio solution which
>> borrows the idea of the INTX hardening by introducing a boolean for
>> virtqueue callback enabling and toggle it in virtio_device_ready()
>> and virtio_reset_device(). Then vring_interrupt() can simply check and
>> return early if the driver is not ready.
>
> All of a sudden all patches are having a wrong mime type.
>
> It is application/octet-stream; should be text/plain
>
> Pls fix and repost, thanks!


So the patches are generated via git-format-patch and git-send-email in 
one run.

I can see many upstream patches were converted to 
application/octet-stream if From: tag is different from the sender.

Maxime told me they've also noticed the issue and it looks like a issue 
of mimecast.

Thanks


>
>> Please review.
>>
>> Changes since v1:
>>
>> - Use transport specific irq synchronization method when possible
>> - Drop the module parameter and enable the hardening unconditonally
>> - Tweak the barrier/ordering facilities used in the code
>> - Reanme irq_soft_enabled to driver_ready
>> - Avoid unnecssary IRQ synchornization (e.g during boot)
>>
>> Jason Wang (4):
>>    virtio: use virtio_reset_device() when possible
>>    virtio: introduce config op to synchronize vring callbacks
>>    virtio-pci: implement synchronize_vqs()
>>    virtio: harden vring IRQ
>>
>> Stefano Garzarella (1):
>>    virtio: use virtio_device_ready() in virtio_device_restore()
>>
>>   drivers/virtio/virtio.c            | 20 ++++++++++++++++----
>>   drivers/virtio/virtio_pci_common.c | 14 ++++++++++++++
>>   drivers/virtio/virtio_pci_common.h |  2 ++
>>   drivers/virtio/virtio_pci_legacy.c |  1 +
>>   drivers/virtio/virtio_pci_modern.c |  2 ++
>>   drivers/virtio/virtio_ring.c       |  9 ++++++++-
>>   include/linux/virtio.h             |  2 ++
>>   include/linux/virtio_config.h      | 24 ++++++++++++++++++++++++
>>   8 files changed, 69 insertions(+), 5 deletions(-)
>>
>> -- 
>> 2.25.1