linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: William McVicker <willmcvicker@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	kernel-team@android.com, Sajid Dalvi <sdalvi@google.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] PCI/PM: Switch D3Hot delay to also use usleep_range
Date: Wed, 7 Sep 2022 16:26:49 -0500	[thread overview]
Message-ID: <20220907212649.GA152425@bhelgaas> (raw)
In-Reply-To: <Yxfgp9DgYc3XU602@google.com>

On Wed, Sep 07, 2022 at 12:07:03AM +0000, William McVicker wrote:
> On 09/02/2022, Bjorn Helgaas wrote:

> >    static void pci_dev_d3_sleep(struct pci_dev *dev)
> >    {
> >         unsigned int delay_ms = max(dev->d3hot_delay, pci_pm_d3hot_delay);
> >         unsigned int upper;
> > 
> >         if (delay_ms) {
> >                 /* 20% upper bound, 1ms minimum */
> >                 upper = max(DIV_ROUND_CLOSEST(delay_ms, 5), 1U)
> >                 usleep_range(delay_ms * USEC_PER_MSEC,
> >                              (delay_ms + upper) * USEC_PER_MSEC);
> >         }
> >    }
> > 
> > Since the Intel quirk is for 120ms, a 20% upper bound would make the
> > range 120-144ms.  Would that be a problem?  Those chips are ancient;
> > the list is untouched since it was added in 2006.  The point of
> > usleep_range() is to allow the scheduler to coalesce the wakeup with
> > other events, so it seems unlikely we'd ever wait the whole 144ms.  I
> > vote for optimizing the readability over sleep/resume time for
> > already-broken chips.
> 
> I'm totally fine with this, but I don't really know what the impact
> would be to those old Intel chips.

Worst-case, a few more ms to wakeup.  Since we're starting with a huge
120ms *per device* delay, I think that's acceptable.  Let's do this.

Bjorn

      reply	other threads:[~2022-09-07 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 23:08 [PATCH v3] PCI/PM: Switch D3Hot delay to also use usleep_range Will McVicker
2022-08-18  0:27 ` Matthias Kaehlcke
2022-08-29 18:08 ` William McVicker
2022-09-02 22:13 ` Bjorn Helgaas
2022-09-07  0:07   ` William McVicker
2022-09-07 21:26     ` 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=20220907212649.GA152425@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=sdalvi@google.com \
    --cc=willmcvicker@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;
as well as URLs for NNTP newsgroup(s).