Re: [PATCH v2] usb: ohci: Prevent missed ohci interrupts

From: Gerd Hoffmann
Date: Mon Apr 29 2024 - 02:49:26 EST


Hi,

> > > + /* repeat until all enabled interrupts are handled */
> > > + if (ohci->rh_state != OHCI_RH_HALTED) {
> > > + ints = ohci_readl(ohci, &regs->intrstatus);
> > > + if (ints & ohci_readl(ohci, &regs->intrenable))
> >
> > Doesn't the driver know which interrupts are enabled?
> > So it should be able to avoid doing two (likely) slow io reads?
> > (PCIe reads are pretty much guaranteed to be high latency.)
>
> No, the driver does not cache intrenable.

Does the driver ever change intrenable after initialization?

PCIe reads are expensive, especially in virtual machines where this
goes vmexit to qemu, so doing that for a piece of information the
driver should have (or is able to calculate) should indeed better
be avoided.

take care,
Gerd