On Wed, May 11, 2022 at 10:02 PM Halil Pasic <pasic at linux.ibm.com> wrote:> > On Wed, 11 May 2022 10:22:59 +0800 > Jason Wang <jasowang at redhat.com> wrote: > > > > CPU0 > > > ---- > > > lock(&vcdev->irq_lock); > > > <Interrupt> > > > lock(&vcdev->irq_lock); > > > > > > *** DEADLOCK *** > > > > It looks to me we need to use write_lock_irq()/write_unlock_irq() to > > do the synchronization. > > > > And we probably need to keep the > > read_lock_irqsave()/read_lock_irqrestore() logic since I can see the > > virtio_ccw_int_handler() to be called from process context (e.g from > > the io_subchannel_quiesce()). > > > > Sounds correct.As Cornelia and Vineeth pointed out, all the paths the vring_interrupt is called with irq disabled. So I will use spin_lock()/spin_unlock() in the next version. Thanks> > Regards, > Halil >
On Thu, 12 May 2022 11:31:08 +0800 Jason Wang <jasowang at redhat.com> wrote:> > > It looks to me we need to use write_lock_irq()/write_unlock_irq() to > > > do the synchronization. > > > > > > And we probably need to keep the > > > read_lock_irqsave()/read_lock_irqrestore() logic since I can see the > > > virtio_ccw_int_handler() to be called from process context (e.g from > > > the io_subchannel_quiesce()). > > > > > > > Sounds correct. > > As Cornelia and Vineeth pointed out, all the paths the vring_interrupt > is called with irq disabled. > > So I will use spin_lock()/spin_unlock() in the next version.Can we do some sort of an assertion that if the kernel is built with the corresponding debug features will make sure this assumption holds (and warn if it does not)? That assertion would also document the fact. If an assertion is not possible, I think we should at least place a strategic comment that documents our assumption. Regards, Halil> > Thanks