mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Michał Cłapiński" <mclapinski@google.com>
Cc: Lukas Wunner <lukas@wunner.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jonathan Cameron <jic23@kernel.org>,
	Alistair Francis <alistair@alistair23.me>
Subject: Re: [PATCH] PCI/DOE: Poll briefly for a response before sleeping
Date: Thu, 15 Oct 2026 15:01:52 -0500	[thread overview]
Message-ID: <20261015200152.GA1793040@bhelgaas> (raw)
In-Reply-To: <CAAi7L5cjsUrLbcJtBg1DXo7frjdBY0m5x5tUeR8+btU70HP7tA@mail.gmail.com>

[+cc Jonathan, Alistair, thread at
https://lore.kernel.org/all/20260917230323.3701743-1-mclapinski@google.com]

On Fri, Sep 18, 2026 at 12:28:21PM -0700, Michał Cłapiński wrote:
> On Fri, Sep 18, 2026 at 7:27 AM Lukas Wunner <lukas@wunner.de> wrote:
> >
> > On Fri, Sep 18, 2026 at 01:03:23AM +0200, Michal Clapinski wrote:
> > > doe_statemachine_work() waits for a response by sleeping
> > > PCI_DOE_POLL_INTERVAL (PCI_DOE_TIMEOUT / 128) between status reads,
> > > which is 7 ms at HZ=1000 and 4 ms at HZ=250. Exchanges are served from
> > > the device's local mailbox logic and typically complete within tens of
> > > microseconds, so nearly all of that sleep is wasted. Every DOE-capable
> > > endpoint pays it once per supported feature during enumeration.
> > >
> > > Poll with usleep_range(20, 50) for the first ~2 ms before falling back
> > > to the jiffies-based wait. On an Intel Emerald Rapids system, time spent
> > > in pci_device_add() for a DOE-capable endpoint drops from 41.8 ms to
> > > 14.0 ms.
> >
> > Polling is just a poor man's replacement for interrupts.  DOE supports
> > interrupt-driven transfers but we're not taking advantage of it so far.
> >
> > Perhaps you could look into adding that?  It would seem more worthwhile
> > than optimizing polling.
> 
> Thanks for the quick response.
> 
> This code runs during PCI device enumeration, before a driver is
> bound, so the core doesn't really have an interrupt to work with:
> MSI/MSI-X vectors belong to the driver, and enabling them in the
> core would collide with its later pci_alloc_irq_vectors(); INTx
> isn't routed yet either, since dev->irq only becomes valid via
> acpi_pci_irq_enable() at pci_enable_device() time.

Do we have to run the DOE setup code during enumeration at all?  Maybe
we can wait until a user that needs DOE functionality comes along?

  reply	other threads:[~2026-10-15 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 23:03 Michal Clapinski
2026-09-18 14:27 ` Lukas Wunner
2026-09-18 19:28   ` Michał Cłapiński
2026-10-15 20:01     ` Bjorn Helgaas [this message]
2026-10-16  4:19       ` Alistair

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=20261015200152.GA1793040@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alistair@alistair23.me \
    --cc=bhelgaas@google.com \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mclapinski@google.com \
    /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®