mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Michal Clapinski <mclapinski@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, Lukas Wunner <lukas@wunner.de>,
	linux-kernel@vger.kernel.org, David Matlack <dmatlack@google.com>,
	Alistair Francis <alistair@alistair23.me>,
	Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	Gregory Price <gourry@gourry.net>,
	Alexey Kardashevskiy <aik@amd.com>,
	Thomas Gleixner <tglx@kernel.org>
Subject: Re: [PATCH v2 0/2] PCI/DOE: Speed up mailbox polling
Date: Tue, 3 Nov 2026 15:27:14 -0600	[thread overview]
Message-ID: <20261103212714.GA1139635@bhelgaas> (raw)
In-Reply-To: <20261103163101.1696520-1-mclapinski@google.com>

[+cc DOE and MSI/MSI-X folks]

On Tue, Nov 03, 2026 at 04:30:59PM +0000, Michal Clapinski wrote:
> The DOE code waits for mailbox responses by sleeping
> PCI_DOE_POLL_INTERVAL (7 ms at HZ=1000, 4 ms at HZ=250) between status
> reads. Every DOE-capable endpoint goes through several such exchanges
> during enumeration: an abort when the mailbox is created and one
> discovery exchange per supported feature. Each pays at least one
> interval, even though devices typically respond within about a hundred
> microseconds.
> 
> Patch 1 fixes PCI_DOE_POLL_INTERVAL being 0 when HZ < 128, which makes
> the polling loops spin for up to a second instead of sleeping.
> 
> Patch 2 replaces the fixed sleep with an exponential backoff that
> busy-waits briefly while high resolution timers are not yet enabled, as
> is the case during enumeration at boot. Time spent in pci_device_add()
> for an NVIDIA B200 GPU drops from 45.9 ms to 6.4 ms.
> 
> Changes in v2:
> - New patch 1, fixing busy-polling when HZ < 128.
> - Patch 2: share the fast poll with pci_doe_abort() by moving it into
>   pci_doe_wait().
> - Patch 2: replace the fixed ~2 ms fast-polling window with an
>   exponential backoff that busy-waits for its first ~255 us, but only
>   until high resolution timers are enabled.
> 
> Michal Clapinski (2):
>   PCI/DOE: Don't busy-poll the mailbox when HZ < 128
>   PCI/DOE: Poll briefly for a response before sleeping
> 
>  drivers/pci/doe.c | 49 ++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 44 insertions(+), 5 deletions(-)

v1 at https://lore.kernel.org/linux-pci/20261012114213.1757207-1-mclapinski@google.com/

I wish we had a way to use interrupts instead of polling, but it
doesn't seem like we have a way to share MSI/MSI-X vectors between
PCI core code like this and the eventual driver.  Added Thomas in case
he has any brilliant ideas about that.

      parent reply	other threads:[~2026-11-03 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:30 Michal Clapinski
2026-11-03 16:31 ` [PATCH v2 1/2] PCI/DOE: Don't busy-poll the mailbox when HZ < 128 Michal Clapinski
2026-11-03 16:31 ` [PATCH v2 2/2] PCI/DOE: Poll briefly for a response before sleeping Michal Clapinski
2026-11-03 21:27 ` Bjorn Helgaas [this message]

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=20261103212714.GA1139635@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=aik@amd.com \
    --cc=alistair@alistair23.me \
    --cc=bhelgaas@google.com \
    --cc=dmatlack@google.com \
    --cc=gourry@gourry.net \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mclapinski@google.com \
    --cc=tglx@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®