From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [paulmck-rcu:dev.2026.08.26b 52/70] kernel/rcu/srcutree.c:1973:3-9: preceding lock on line 1953
Date: Sun, 06 Sep 2026 06:03:58 +0800 [thread overview]
Message-ID: <202609060521.ZcMw4fGR-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: "Paul E. McKenney" <paulmck@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2026.08.26b
head: 02d3dbb63ea80cac75734d77309015f13d5e73c9
commit: e473ba35dc1c19ba17fb717920ebd8c6f880a825 [52/70] srcutree: Suppress srcu_advance_state() mutex_lock in atomic
:::::: branch date: 2 days ago
:::::: commit date: 13 days ago
config: i386-randconfig-053-20260906 (https://download.01.org/0day-ci/archive/20260906/202609060521.ZcMw4fGR-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202609060521.ZcMw4fGR-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> kernel/rcu/srcutree.c:1973:3-9: preceding lock on line 1953
kernel/rcu/srcutree.c:1982:3-9: preceding lock on line 1953
kernel/rcu/srcutree.c:1991:3-9: preceding lock on line 1953
vim +1973 kernel/rcu/srcutree.c
dad81a2026841b5 Paul E. McKenney 2017-03-25 1940
dad81a2026841b5 Paul E. McKenney 2017-03-25 1941 /*
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1942 * Core SRCU state machine. Push state bits of ->srcu_gp_seq
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1943 * to SRCU_STATE_SCAN2, and invoke srcu_gp_end() when scan has
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1944 * completed in that state. Set is_atomic to indicate that
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1945 * the caller is excluding other calls so that ->srcu_gp_mutex
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1946 * is not needed, and to indicate that blocking is forbidden.
dad81a2026841b5 Paul E. McKenney 2017-03-25 1947 */
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1948 static void srcu_advance_state(struct srcu_struct *ssp, bool is_atomic)
dad81a2026841b5 Paul E. McKenney 2017-03-25 1949 {
dad81a2026841b5 Paul E. McKenney 2017-03-25 1950 int idx;
dad81a2026841b5 Paul E. McKenney 2017-03-25 1951
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1952 if (!is_atomic)
e3a6ab25cfa0fcd Paul E. McKenney 2023-03-17 @1953 mutex_lock(&ssp->srcu_sup->srcu_gp_mutex);
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1954
dad81a2026841b5 Paul E. McKenney 2017-03-25 1955 /*
dad81a2026841b5 Paul E. McKenney 2017-03-25 1956 * Because readers might be delayed for an extended period after
821ca6fa15d8649 Paul E. McKenney 2024-12-19 1957 * fetching ->srcu_ctrp for their index, at any point in time there
dad81a2026841b5 Paul E. McKenney 2017-03-25 1958 * might well be readers using both idx=0 and idx=1. We therefore
dad81a2026841b5 Paul E. McKenney 2017-03-25 1959 * need to wait for readers to clear from both index values before
dad81a2026841b5 Paul E. McKenney 2017-03-25 1960 * invoking a callback.
dad81a2026841b5 Paul E. McKenney 2017-03-25 1961 *
dad81a2026841b5 Paul E. McKenney 2017-03-25 1962 * The load-acquire ensures that we see the accesses performed
dad81a2026841b5 Paul E. McKenney 2017-03-25 1963 * by the prior grace period.
dad81a2026841b5 Paul E. McKenney 2017-03-25 1964 */
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1965 idx = rcu_seq_state(smp_load_acquire(&ssp->srcu_sup->srcu_gp_seq)); /* ^^^ */
dad81a2026841b5 Paul E. McKenney 2017-03-25 1966 if (idx == SRCU_STATE_IDLE) {
175b45ed343a9c5 Paul E. McKenney 2026-03-14 1967 raw_spin_lock_irq_rcu_node(ssp->srcu_sup);
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1968 if (ULONG_CMP_GE(ssp->srcu_sup->srcu_gp_seq, ssp->srcu_sup->srcu_gp_seq_needed)) {
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1969 WARN_ON_ONCE(rcu_seq_state(ssp->srcu_sup->srcu_gp_seq));
175b45ed343a9c5 Paul E. McKenney 2026-03-14 1970 raw_spin_unlock_irq_rcu_node(ssp->srcu_sup);
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1971 if (!is_atomic)
e3a6ab25cfa0fcd Paul E. McKenney 2023-03-17 1972 mutex_unlock(&ssp->srcu_sup->srcu_gp_mutex);
dad81a2026841b5 Paul E. McKenney 2017-03-25 @1973 return;
dad81a2026841b5 Paul E. McKenney 2017-03-25 1974 }
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1975 idx = rcu_seq_state(READ_ONCE(ssp->srcu_sup->srcu_gp_seq));
dad81a2026841b5 Paul E. McKenney 2017-03-25 1976 if (idx == SRCU_STATE_IDLE)
aacb5d91ab1bfbb Paul E. McKenney 2018-10-28 1977 srcu_gp_start(ssp);
175b45ed343a9c5 Paul E. McKenney 2026-03-14 1978 raw_spin_unlock_irq_rcu_node(ssp->srcu_sup);
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1979 if (idx != SRCU_STATE_IDLE) {
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1980 if (!is_atomic)
e3a6ab25cfa0fcd Paul E. McKenney 2023-03-17 1981 mutex_unlock(&ssp->srcu_sup->srcu_gp_mutex);
dad81a2026841b5 Paul E. McKenney 2017-03-25 1982 return; /* Someone else started the grace period. */
dad81a2026841b5 Paul E. McKenney 2017-03-25 1983 }
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1984 }
dad81a2026841b5 Paul E. McKenney 2017-03-25 1985
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1986 if (rcu_seq_state(READ_ONCE(ssp->srcu_sup->srcu_gp_seq)) == SRCU_STATE_SCAN1) {
821ca6fa15d8649 Paul E. McKenney 2024-12-19 1987 idx = !(ssp->srcu_ctrp - &ssp->sda->srcu_ctrs[0]);
aacb5d91ab1bfbb Paul E. McKenney 2018-10-28 1988 if (!try_check_zero(ssp, idx, 1)) {
e473ba35dc1c19b Paul E. McKenney 2026-08-18 1989 if (!is_atomic)
e3a6ab25cfa0fcd Paul E. McKenney 2023-03-17 1990 mutex_unlock(&ssp->srcu_sup->srcu_gp_mutex);
dad81a2026841b5 Paul E. McKenney 2017-03-25 1991 return; /* readers present, retry later. */
da915ad5cf25b5f Paul E. McKenney 2017-04-05 1992 }
aacb5d91ab1bfbb Paul E. McKenney 2018-10-28 1993 srcu_flip(ssp);
175b45ed343a9c5 Paul E. McKenney 2026-03-14 1994 raw_spin_lock_irq_rcu_node(ssp->srcu_sup);
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 1995 rcu_seq_set_state(&ssp->srcu_sup->srcu_gp_seq, SRCU_STATE_SCAN2);
3b46679c623c276 Paul E. McKenney 2023-03-17 1996 ssp->srcu_sup->srcu_n_exp_nodelay = 0;
175b45ed343a9c5 Paul E. McKenney 2026-03-14 1997 raw_spin_unlock_irq_rcu_node(ssp->srcu_sup);
dad81a2026841b5 Paul E. McKenney 2017-03-25 1998 }
dad81a2026841b5 Paul E. McKenney 2017-03-25 1999
03200b5ca3b4d4e Paul E. McKenney 2023-03-17 2000 if (rcu_seq_state(READ_ONCE(ssp->srcu_sup->srcu_gp_seq)) == SRCU_STATE_SCAN2) {
dad81a2026841b5 Paul E. McKenney 2017-03-25 2001
dad81a2026841b5 Paul E. McKenney 2017-03-25 2002 /*
dad81a2026841b5 Paul E. McKenney 2017-03-25 2003 * SRCU read-side critical sections are normally short,
dad81a2026841b5 Paul E. McKenney 2017-03-25 2004 * so check at least twice in quick succession after a flip.
dad81a2026841b5 Paul E. McKenney 2017-03-25 2005 */
821ca6fa15d8649 Paul E. McKenney 2024-12-19 2006 idx = !(ssp->srcu_ctrp - &ssp->sda->srcu_ctrs[0]);
aacb5d91ab1bfbb Paul E. McKenney 2018-10-28 2007 if (!try_check_zero(ssp, idx, 2)) {
e473ba35dc1c19b Paul E. McKenney 2026-08-18 2008 if (!is_atomic)
e3a6ab25cfa0fcd Paul E. McKenney 2023-03-17 2009 mutex_unlock(&ssp->srcu_sup->srcu_gp_mutex);
da915ad5cf25b5f Paul E. McKenney 2017-04-05 2010 return; /* readers present, retry later. */
da915ad5cf25b5f Paul E. McKenney 2017-04-05 2011 }
3b46679c623c276 Paul E. McKenney 2023-03-17 2012 ssp->srcu_sup->srcu_n_exp_nodelay = 0;
aacb5d91ab1bfbb Paul E. McKenney 2018-10-28 2013 srcu_gp_end(ssp); /* Releases ->srcu_gp_mutex. */
dad81a2026841b5 Paul E. McKenney 2017-03-25 2014 }
dad81a2026841b5 Paul E. McKenney 2017-03-25 2015 }
dad81a2026841b5 Paul E. McKenney 2017-03-25 2016
:::::: The code at line 1973 was first introduced by commit
:::::: dad81a2026841b5e2651aab58a7398c13cc05847 srcu: Introduce CLASSIC_SRCU Kconfig option
:::::: TO: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
:::::: CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-09-05 22:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202609060521.ZcMw4fGR-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/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