From: "Li,Rongqing(ACG CCN)" <lirongqing@baidu.com>
To: Dave Hansen <dave.hansen@intel.com>,
"Huang, Kai" <kai.huang@intel.com>,
"jarkko@kernel.org" <jarkko@kernel.org>,
"x86@kernel.org" <x86@kernel.org>, "bp@alien8.de" <bp@alien8.de>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"tglx@kernel.org" <tglx@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: 答复: [外部邮件] Re: [PATCH] x86/sgx: Fix SRCU list traversal
Date: Tue, 24 Feb 2026 02:51:49 +0000 [thread overview]
Message-ID: <ccf8c68db6d14de99bd8404ea9bd3ac2@baidu.com> (raw)
In-Reply-To: <a79e6300-4188-4670-b801-0f64bcffb673@intel.com>
> >>> The list is protected by encl->srcu, not RCU, so the SRCU-specific
> >>> iterator with srcu_read_lock_held() annotation is required.
> >>>
> >>> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> >> Acked-by: Kai Huang <kai.huang@intel.com>
> > Thanks for reviewing , and ping
>
> It's a light NAK from me with the current changelog.
>
> I want a wee bit more background and some reasoning _somewhere_ about
> why this wasn't a bug when the code went in originally but arguably became a
> buglet at some point.
The buggy commit is 1728ab54b4be ("x86/sgx: Add a page reclaimer") in v5.11, it should use list_for_each_entry_srcu()which is introduced in v5.10, so I rewrite the commit message as below, is it ok?
x86/sgx: Use list_for_each_entry_srcu() for mm_list traversal
In commit 1728ab54b4be ("x86/sgx: Add a page reclaimer") (v5.11),
list_for_each_entry_rcu() was used to traverse the enclave's mm_list.
However, this is incorrect because the list is protected by a Sleepable
RCU (SRCU) lock (encl->srcu).
Since commit 28875945ba98 ("rcu: Add support for consolidated-RCU reader
checking") (v5.4), RCU lockdep checking has become stricter. When
CONFIG_PROVE_RCU is enabled, using the standard list_for_each_entry_rcu()
while only holding an SRCU lock triggers "suspicious RCU usage" false
positive warnings, as it does not recognize SRCU read-side critical
sections.
Fix this by switching to list_for_each_entry_srcu(), which was
introduced specifically for this purpose in commit ae2212a7216
("rculist: Introduce list/hlist_for_each_entry_srcu() macros") (v5.10).
This correctly associates the traversal with the SRCU lock and
eliminates the lockdep warnings.
Fixes: 1728ab54b4be ("x86/sgx: Add a page reclaimer")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
prev parent reply other threads:[~2026-02-24 2:53 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
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) [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=ccf8c68db6d14de99bd8404ea9bd3ac2@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=kai.huang@intel.com \
--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