Re: [PATCH v1] virtio_blk: should not use IRQD_AFFINITY_MANAGED in init_rq

From: Christoph Hellwig
Date: Wed Sep 28 2022 - 05:45:58 EST


On Tue, Sep 27, 2022 at 04:47:20PM -0400, Michael S. Tsirkin wrote:
> > The log :
> > "genirq: Flags mismatch irq 0. 00000080 (virtio418) vs. 00015a00 (timer)"
> > was print because of the irq 0 is used by timer exclusive,and when
> > vp_find_vqs called vp_find_vqs_msix and return false twice,then it will
> > call vp_find_vqs_intx for the last try.
> > Because vp_dev->pci_dev->irq is zero,so it will be request irq 0 with
> > flag IRQF_SHARED.
>
> First this is a bug. We can fix that so it will fail more cleanly.
>
> We should check pci_dev->pin and if 0 do not try to use INT#x
> at all.
> It will still fail, just with a nicer backtrace.

How do we end up with a pci_dev without a valid PIN? Btw, that whole
vp_find_* code looks extremely fucked up to me. The whole point of
pci_alloc_irq_vectors* API is that it keeps drivers from poling into
details of MSI-X v MSI vs INTX.

> - because of auto affinity, we try to reserve an interrupt on all CPUs
> - as there are 512 devices with a single vector per VQ we would
> have no issue as they would be spread between CPUs,
> but allocating on all CPUs fails.
>
>
> I don't think the issue should be fixed at blk level - it is not
> blk specifix - but yes this looks like a problem.
> Christoph, any idea?

I think this goes into the low-level interrupt vector allocator. I think
Thomas is still the expert on it.