From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Guangbo Cui <jckeep.cuiguangbo@gmail.com>
Cc: Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Waiman Long <longman@redhat.com>,
linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 1/2] PCI/aer_inject: Convert inject_lock to raw_spinlock_t
Date: Mon, 27 Oct 2025 09:11:25 +0100 [thread overview]
Message-ID: <20251027081125.n7far5BO@linutronix.de> (raw)
In-Reply-To: <20251026044335.19049-3-jckeep.cuiguangbo@gmail.com>
On 2025-10-26 04:43:34 [+0000], Guangbo Cui wrote:
> The AER injection path may run in forced-threaded interrupt context
> under PREEMPT_RT while holding the lock with IRQs disabled.
not IRQs but interrupts.
> On RT kernels, spinlocks are converted into rt_spinlocks, which may
rt_spinlocks is not a thing. An established term is sleeping spinlock.
> sleep. Sleeping is not permitted in IRQ-off sections, so this may
> trigger lockdep warnings such as "Invalid wait context" in [1].
Why that reference. You should be able to describe your change _here_.
> raw_spin_lock_irqsave(&pci_lock);
> ↓
> rt_spin_lock(&inject_lock); <-- not allowed
It is still a spin_lock() that happens. The problem is that a
raw_spinlock_t must not nest into a spinlock_t. See
Documentation/locking/locktypes.rst
very bottom of that file.
> Switching inject_lock to raw_spinlock_t preserves non-sleeping locking
> semantics and avoids the warning when running with PREEMPT_RT enabled.
>
> The list protected by this lock is bounded and only used for debugging
> purposes, so using a raw spinlock will not cause unbounded latencies.
This is I like.
> [1] https://lore.kernel.org/all/20251009150651.93618-1-jckeep.cuiguangbo@gmail.com/
>
> Acked-by: Waiman Long <longman@redhat.com>
> Signed-off-by: Guangbo Cui <jckeep.cuiguangbo@gmail.com>
> ---
> @@ -445,7 +445,7 @@ static int aer_inject(struct aer_error_inj *einj)
> rperr->source_id &= 0x0000ffff;
> rperr->source_id |= PCI_DEVID(einj->bus, devfn) << 16;
> }
> - spin_unlock_irqrestore(&inject_lock, flags);
> + raw_spin_unlock_irqrestore(&inject_lock, flags);
>
> if (aer_mask_override) {
> pci_write_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK,
This is the last hunk. You miss the module exit part. This won't
compile on its own, as such it can't be applied. It might be chosen for
a backport. A change must always be self-contained.
Sebastian
next prev parent reply other threads:[~2025-10-27 8:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 4:43 [PATCH v3 0/2] PCI/aer_inject: Adjust locking for PREEMPT_RT Guangbo Cui
2025-10-26 4:43 ` [PATCH v3 1/2] PCI/aer_inject: Convert inject_lock to raw_spinlock_t Guangbo Cui
2025-10-27 8:11 ` Sebastian Andrzej Siewior [this message]
2025-10-27 15:11 ` Guangbo Cui
2025-10-26 4:43 ` [PATCH v3 2/2] PCI/aer_inject: Remove unnecessary lock in aer_inject_exit Guangbo Cui
2025-10-27 8:12 ` Sebastian Andrzej Siewior
2025-10-26 23:16 ` [PATCH v3 0/2] PCI/aer_inject: Adjust locking for PREEMPT_RT Waiman Long
2025-10-27 15:10 ` Guangbo Cui
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=20251027081125.n7far5BO@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=bhelgaas@google.com \
--cc=boqun.feng@gmail.com \
--cc=clrkwllms@kernel.org \
--cc=jckeep.cuiguangbo@gmail.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).