All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: David Laight <David.Laight@aculab.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] usb: ohci: Prevent missed ohci interrupts
Date: Mon, 29 Apr 2024 06:34:00 -0700	[thread overview]
Message-ID: <eafc8fb6-cecc-48c8-a053-cd00f094e781@roeck-us.net> (raw)
In-Reply-To: <ef23ykui3axiwfkr4wi24abbuklvejx5r5wqem5cr4lq36x7py@kkxvsi3ibtbi>

On 4/28/24 23:49, Gerd Hoffmann wrote:
>    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?
> 

$ git grep -e intrenable -e intrdisable drivers/usb/host/*ohci*c | grep ohci_writel
drivers/usb/host/ohci-hcd.c:	ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable);
drivers/usb/host/ohci-hcd.c:		ohci_writel (ohci, OHCI_INTR_OC, &ohci->regs->intrenable);
drivers/usb/host/ohci-hcd.c:	ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
drivers/usb/host/ohci-hcd.c:	ohci_writel (ohci, mask, &ohci->regs->intrenable);
drivers/usb/host/ohci-hcd.c:			ohci_writel (ohci, OHCI_INTR_UE, &regs->intrdisable);
drivers/usb/host/ohci-hcd.c:		ohci_writel(ohci, OHCI_INTR_RHSC, &regs->intrdisable);
drivers/usb/host/ohci-hcd.c:		ohci_writel (ohci, OHCI_INTR_SF, &regs->intrdisable);
drivers/usb/host/ohci-hcd.c:		ohci_writel (ohci, OHCI_INTR_MIE, &regs->intrenable);
drivers/usb/host/ohci-hcd.c:	ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
drivers/usb/host/ohci-hcd.c:	ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
drivers/usb/host/ohci-hcd.c:		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
drivers/usb/host/ohci-hub.c:	ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrdisable);
drivers/usb/host/ohci-hub.c:	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
drivers/usb/host/ohci-hub.c:		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
drivers/usb/host/ohci-hub.c:			ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable);
drivers/usb/host/ohci-hub.c:	ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
drivers/usb/host/ohci-q.c:	ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);

> 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.
> 

I would agree, but I really think that should be a separate patch
if implemented.

Guenter


  reply	other threads:[~2024-04-29 13:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 19:59 [PATCH v2] usb: ohci: Prevent missed ohci interrupts Guenter Roeck
2024-04-24 22:30 ` Alan Stern
2024-04-24 22:49   ` Greg Kroah-Hartman
2024-04-24 22:59     ` Guenter Roeck
2024-04-24 22:50   ` Guenter Roeck
2024-04-27 21:00 ` David Laight
2024-04-27 22:18   ` Guenter Roeck
2024-04-29  6:49     ` Gerd Hoffmann
2024-04-29 13:34       ` Guenter Roeck [this message]
2024-04-29 14:01         ` David Laight
2024-04-29 15:23           ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eafc8fb6-cecc-48c8-a053-cd00f094e781@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=David.Laight@aculab.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.