mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Clapinski <mclapinski@google.com>
To: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Cc: Lukas Wunner <lukas@wunner.de>,
	linux-kernel@vger.kernel.org,
	 David Matlack <dmatlack@google.com>,
	Michal Clapinski <mclapinski@google.com>
Subject: [PATCH v2 1/2] PCI/DOE: Don't busy-poll the mailbox when HZ < 128
Date: Tue,  3 Nov 2026 16:31:00 +0000	[thread overview]
Message-ID: <20261103163101.1696520-2-mclapinski@google.com> (raw)
In-Reply-To: <20261103163101.1696520-1-mclapinski@google.com>

PCI_DOE_POLL_INTERVAL is defined as PCI_DOE_TIMEOUT / 128, which is 0
when HZ is below 128, e.g. with CONFIG_HZ_100. pci_doe_wait() then calls
wait_event_timeout() with a timeout of 0, which returns immediately
without sleeping. As a result, doe_statemachine_work() and
pci_doe_abort() read the DOE Status register in a tight loop for up to
PCI_DOE_TIMEOUT (1 second) instead of sleeping between reads.

Make the poll interval at least one jiffy.

Fixes: 9d24322e887b ("PCI/DOE: Add DOE mailbox support functions")
Signed-off-by: Michal Clapinski <mclapinski@google.com>
---
 drivers/pci/doe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
index 6b5d9ba8e969..6d258f751318 100644
--- a/drivers/pci/doe.c
+++ b/drivers/pci/doe.c
@@ -26,7 +26,7 @@
 
 /* Timeout of 1 second from 6.30.2 Operation, PCI Spec r6.0 */
 #define PCI_DOE_TIMEOUT HZ
-#define PCI_DOE_POLL_INTERVAL	(PCI_DOE_TIMEOUT / 128)
+#define PCI_DOE_POLL_INTERVAL	max(PCI_DOE_TIMEOUT / 128, 1)
 
 #define PCI_DOE_FLAG_CANCEL	0
 #define PCI_DOE_FLAG_DEAD	1
-- 
2.56.0.385.gac671c819a-goog


  reply	other threads:[~2026-11-03 16:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:30 [PATCH v2 0/2] PCI/DOE: Speed up mailbox polling Michal Clapinski
2026-11-03 16:31 ` Michal Clapinski [this message]
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 ` [PATCH v2 0/2] PCI/DOE: Speed up mailbox polling Bjorn Helgaas

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=20261103163101.1696520-2-mclapinski@google.com \
    --to=mclapinski@google.com \
    --cc=bhelgaas@google.com \
    --cc=dmatlack@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    /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®