Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-14 Thread Thomas Gleixner
On Tue, Sep 14 2021 at 13:03, Peter Zijlstra wrote: > On Mon, Sep 13, 2021 at 11:36:24PM +0200, Thomas Gleixner wrote: > Here you rely on the UNLOCK+LOCK pattern because we have two adjacent > critical sections (or rather, the same twice), which provides RCtso > ordering, which is sufficient to

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-14 Thread Peter Zijlstra
On Mon, Sep 13, 2021 at 11:36:24PM +0200, Thomas Gleixner wrote: > That's the real problem and for that your barrier is at the wrong place > because you want to make sure that those stores are visible before the > store to intx_soft_enabled becomes visible, i.e. this should be: > > > /*

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-14 Thread Boqun Feng
On Mon, Sep 13, 2021 at 11:36:24PM +0200, Thomas Gleixner wrote: [...] > As the device startup is not really happening often it's sensible to do > the following > > disable_irq(); > vp_dev->intx_soft_enabled = true; > enable_irq(); > > because: > > disable_irq()

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Jason Wang
在 2021/9/14 上午5:36, Thomas Gleixner 写道: Jason, On Mon, Sep 13 2021 at 13:53, Jason Wang wrote: This patch tries to make sure the virtio interrupt handler for INTX won't be called after a reset and before virtio_device_ready(). We can't use IRQF_NO_AUTOEN since we're using shared interrupt

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Thomas Gleixner
On Mon, Sep 13 2021 at 18:01, Michael S. Tsirkin wrote: > On Mon, Sep 13, 2021 at 11:36:24PM +0200, Thomas Gleixner wrote: >> >From the interrupt perspective the sequence: >> >> disable_irq(); >> vp_dev->intx_soft_enabled = true; >> enable_irq(); >> >> is perfectly fine

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Michael S. Tsirkin
On Mon, Sep 13, 2021 at 11:36:24PM +0200, Thomas Gleixner wrote: > >From the interrupt perspective the sequence: > > disable_irq(); > vp_dev->intx_soft_enabled = true; > enable_irq(); > > is perfectly fine as well. Any interrupt arriving during the disabled > section will

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Thomas Gleixner
Jason, On Mon, Sep 13 2021 at 13:53, Jason Wang wrote: > This patch tries to make sure the virtio interrupt handler for INTX > won't be called after a reset and before virtio_device_ready(). We > can't use IRQF_NO_AUTOEN since we're using shared interrupt > (IRQF_SHARED). So this patch tracks the

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Jason Wang
On Mon, Sep 13, 2021 at 3:02 PM Michael S. Tsirkin wrote: > > On Mon, Sep 13, 2021 at 02:45:38PM +0800, Jason Wang wrote: > > On Mon, Sep 13, 2021 at 2:41 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Sep 13, 2021 at 02:36:54PM +0800, Jason Wang wrote: > > > > On Mon, Sep 13, 2021 at 2:33 PM

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Michael S. Tsirkin
On Mon, Sep 13, 2021 at 02:45:38PM +0800, Jason Wang wrote: > On Mon, Sep 13, 2021 at 2:41 PM Michael S. Tsirkin wrote: > > > > On Mon, Sep 13, 2021 at 02:36:54PM +0800, Jason Wang wrote: > > > On Mon, Sep 13, 2021 at 2:33 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Sep 13, 2021

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Jason Wang
On Mon, Sep 13, 2021 at 2:41 PM Michael S. Tsirkin wrote: > > On Mon, Sep 13, 2021 at 02:36:54PM +0800, Jason Wang wrote: > > On Mon, Sep 13, 2021 at 2:33 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Sep 13, 2021 at 01:53:51PM +0800, Jason Wang wrote: > > > > This patch tries to make sure

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Michael S. Tsirkin
On Mon, Sep 13, 2021 at 02:36:54PM +0800, Jason Wang wrote: > On Mon, Sep 13, 2021 at 2:33 PM Michael S. Tsirkin wrote: > > > > On Mon, Sep 13, 2021 at 01:53:51PM +0800, Jason Wang wrote: > > > This patch tries to make sure the virtio interrupt handler for INTX > > > won't be called after a reset

Re: [PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-13 Thread Jason Wang
On Mon, Sep 13, 2021 at 2:33 PM Michael S. Tsirkin wrote: > > On Mon, Sep 13, 2021 at 01:53:51PM +0800, Jason Wang wrote: > > This patch tries to make sure the virtio interrupt handler for INTX > > won't be called after a reset and before virtio_device_ready(). We > > can't use IRQF_NO_AUTOEN

[PATCH 7/9] virtio-pci: harden INTX interrupts

2021-09-12 Thread Jason Wang
This patch tries to make sure the virtio interrupt handler for INTX won't be called after a reset and before virtio_device_ready(). We can't use IRQF_NO_AUTOEN since we're using shared interrupt (IRQF_SHARED). So this patch tracks the INTX enabling status in a new intx_soft_enabled variable and