From: "Li,Rongqing" <lirongqing@baidu.com>
To: Dave Hansen <dave.hansen@intel.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
"H . Peter Anvin" <hpa@zytor.com>,
"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] x86/sgx: Fix SRCU list traversal
Date: Thu, 5 Feb 2026 21:15:40 +0000 [thread overview]
Message-ID: <cd326e6b8aa745688628bfcef94aa9b9@baidu.com> (raw)
In-Reply-To: <1460dd28-7441-4bbf-8b48-ab215c195425@intel.com>
> On 2/4/26 17:53, lirongqing wrote:
> > Replace list_for_each_entry_rcu() with list_for_each_entry_srcu() when
> > traversing the encl->mm_list protected by SRCU. This ensures proper
> > synchronization annotation and avoids potential lockdep warnings about
> > incorrect RCU usage.
>
> Does lockdep trip on this today?
>
> > The list is protected by encl->srcu, not RCU, so the SRCU-specific
> > iterator with srcu_read_lock_held() annotation is required.
>
> From a quick look, list_for_each_entry_rcu() still seems *really* common
> under SRCU. It also looks like list_for_each_entry_srcu() is a relatively recent
> (2020) addition to the kernel.
>
> So, this wasn't a bug when the SGX code went in, but started causing a
> problem at some point? Did lockdep add some RCU warnings or something
> that made this necessary?
>
> The patch seems logical and all. I just feel like I'm missing the bigger picture.
Seem this patch adds the check
commit 28875945ba98d1b47a8a706812b6494d165bb0a0
Author: Joel Fernandes (Google) <joel@joelfernandes.org>
Date: Tue Jul 16 18:12:22 2019 -0400
rcu: Add support for consolidated-RCU reader checking
This commit adds RCU-reader checks to list_for_each_entry_rcu() and
hlist_for_each_entry_rcu(). These checks are optional, and are indicated
by a lockdep expression passed to a new optional argument to these two
macros. If this optional lockdep expression is omitted, these two macros
act as before, checking for an RCU read-side critical section.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
[ paulmck: Update to eliminate return within macro and update comment. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
And there are several similar fixes:
d681107 nvme-multipath: fix suspicious RCU usage warning
5dd18f0 nvme/multipath: Fix RCU list traversal to use SRCU primitive
6d1c699 nvme/host: Fix RCU list traversal to use SRCU primitive
6a0c617 KVM: eventfd: Fix false positive RCU usage warning
df9a30f kvm: mmu: page_track: Fix RCU list API usage
[Li,Rongqing]
next prev parent reply other threads:[~2026-02-05 21:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 1:53 [PATCH] x86/sgx: Fix SRCU list traversal lirongqing
2026-02-05 17:58 ` Dave Hansen
2026-02-05 21:15 ` Li,Rongqing [this message]
2026-02-11 10:38 ` Huang, Kai
2026-02-24 0:30 ` 答复: [外部邮件] " Li,Rongqing(ACG CCN)
2026-02-24 1:14 ` Dave Hansen
2026-02-24 2:51 ` 答复: " Li,Rongqing(ACG CCN)
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=cd326e6b8aa745688628bfcef94aa9b9@baidu.com \
--to=lirongqing@baidu.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=x86@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