Skip to content

Commit f32367d

Browse files
paulmckrcuNeeraj Upadhyay (AMD)
authored andcommitted
rcutorture: Drop redundant "insoftirq" parameters
Given that the rcutorture_one_extend_check() function now uses in_serving_softirq() and in_hardirq(), it is no longer necessary to pass insoftirq flags down the function-call stack. This commit therefore removes those flags, and, while in the area, does a bit of whitespace cleanup. Signed-off-by: Paul E. McKenney <[email protected]> Tested-by: kernel test robot <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent cacba0b commit f32367d

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

kernel/rcu/rcutorture.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ static void rcu_torture_reader_do_mbchk(long myid, struct rcu_torture *rtp,
19751975

19761976
// Verify the specified RCUTORTURE_RDR* state.
19771977
#define ROEC_ARGS "%s %s: Current %#x To add %#x To remove %#x preempt_count() %#x\n", __func__, s, curstate, new, old, preempt_count()
1978-
static void rcutorture_one_extend_check(char *s, int curstate, int new, int old, bool insoftirq)
1978+
static void rcutorture_one_extend_check(char *s, int curstate, int new, int old)
19791979
{
19801980
int mask;
19811981

@@ -2038,8 +2038,7 @@ static void rcutorture_one_extend_check(char *s, int curstate, int new, int old,
20382038
* beginning or end of the critical section and if there was actually a
20392039
* change, do a ->read_delay().
20402040
*/
2041-
static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
2042-
struct torture_random_state *trsp,
2041+
static void rcutorture_one_extend(int *readstate, int newstate, struct torture_random_state *trsp,
20432042
struct rt_read_seg *rtrsp)
20442043
{
20452044
bool first;
@@ -2054,7 +2053,7 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
20542053
first = idxold1 == 0;
20552054
WARN_ON_ONCE(idxold2 < 0);
20562055
WARN_ON_ONCE(idxold2 & ~(RCUTORTURE_RDR_ALLBITS | RCUTORTURE_RDR_UPDOWN));
2057-
rcutorture_one_extend_check("before change", idxold1, statesnew, statesold, insoftirq);
2056+
rcutorture_one_extend_check("before change", idxold1, statesnew, statesold);
20582057
rtrsp->rt_readstate = newstate;
20592058

20602059
/* First, put new protection in place to avoid critical-section gap. */
@@ -2074,8 +2073,7 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
20742073
idxnew2 = (cur_ops->readlock() << RCUTORTURE_RDR_SHIFT_2) & RCUTORTURE_RDR_MASK_2;
20752074

20762075
// Complain unless both the old and the new protection is in place.
2077-
rcutorture_one_extend_check("during change",
2078-
idxold1 | statesnew, statesnew, statesold, insoftirq);
2076+
rcutorture_one_extend_check("during change", idxold1 | statesnew, statesnew, statesold);
20792077

20802078
// Sample CPU under both sets of protections to reduce confusion.
20812079
if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU)) {
@@ -2150,7 +2148,7 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
21502148
WARN_ON_ONCE(*readstate < 0);
21512149
if (WARN_ON_ONCE(*readstate & ~RCUTORTURE_RDR_ALLBITS))
21522150
pr_info("Unexpected readstate value of %#x\n", *readstate);
2153-
rcutorture_one_extend_check("after change", *readstate, statesnew, statesold, insoftirq);
2151+
rcutorture_one_extend_check("after change", *readstate, statesnew, statesold);
21542152
}
21552153

21562154
/* Return the biggest extendables mask given current RCU and boot parameters. */
@@ -2217,8 +2215,7 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp)
22172215
* critical section.
22182216
*/
22192217
static struct rt_read_seg *
2220-
rcutorture_loop_extend(int *readstate, bool insoftirq, struct torture_random_state *trsp,
2221-
struct rt_read_seg *rtrsp)
2218+
rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp, struct rt_read_seg *rtrsp)
22222219
{
22232220
int i;
22242221
int j;
@@ -2233,7 +2230,7 @@ rcutorture_loop_extend(int *readstate, bool insoftirq, struct torture_random_sta
22332230
for (j = 0; j < i; j++) {
22342231
mask = rcutorture_extend_mask(*readstate, trsp);
22352232
WARN_ON_ONCE(mask & RCUTORTURE_RDR_UPDOWN);
2236-
rcutorture_one_extend(readstate, mask, insoftirq, trsp, &rtrsp[j]);
2233+
rcutorture_one_extend(readstate, mask, trsp, &rtrsp[j]);
22372234
}
22382235
return &rtrsp[j];
22392236
}
@@ -2279,7 +2276,7 @@ static bool rcu_torture_one_read_start(struct rcu_torture_one_read_state *rtorsp
22792276
(rtorsp->readstate & RCUTORTURE_RDR_UPDOWN));
22802277
if (rtorsp->p == NULL) {
22812278
/* Wait for rcu_torture_writer to get underway */
2282-
rcutorture_one_extend(&rtorsp->readstate, 0, myid < 0, trsp, rtorsp->rtrsp);
2279+
rcutorture_one_extend(&rtorsp->readstate, 0, trsp, rtorsp->rtrsp);
22832280
return false;
22842281
}
22852282
if (rtorsp->p->rtort_mbtest == 0)
@@ -2293,7 +2290,7 @@ static bool rcu_torture_one_read_start(struct rcu_torture_one_read_state *rtorsp
22932290
* critical sections and check for errors.
22942291
*/
22952292
static void rcu_torture_one_read_end(struct rcu_torture_one_read_state *rtorsp,
2296-
struct torture_random_state *trsp, long myid)
2293+
struct torture_random_state *trsp)
22972294
{
22982295
int i;
22992296
unsigned long completed;
@@ -2340,7 +2337,7 @@ static void rcu_torture_one_read_end(struct rcu_torture_one_read_state *rtorsp,
23402337
}
23412338
if (cur_ops->reader_blocked)
23422339
preempted = cur_ops->reader_blocked();
2343-
rcutorture_one_extend(&rtorsp->readstate, 0, myid < 0, trsp, rtorsp->rtrsp);
2340+
rcutorture_one_extend(&rtorsp->readstate, 0, trsp, rtorsp->rtrsp);
23442341
WARN_ON_ONCE(rtorsp->readstate);
23452342
// This next splat is expected behavior if leakpointer, especially
23462343
// for CONFIG_RCU_STRICT_GRACE_PERIOD=y kernels.
@@ -2370,13 +2367,13 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
23702367
init_rcu_torture_one_read_state(&rtors, trsp);
23712368
newstate = rcutorture_extend_mask(rtors.readstate, trsp);
23722369
WARN_ON_ONCE(newstate & RCUTORTURE_RDR_UPDOWN);
2373-
rcutorture_one_extend(&rtors.readstate, newstate, myid < 0, trsp, rtors.rtrsp++);
2370+
rcutorture_one_extend(&rtors.readstate, newstate, trsp, rtors.rtrsp++);
23742371
if (!rcu_torture_one_read_start(&rtors, trsp, myid)) {
2375-
rcutorture_one_extend(&rtors.readstate, 0, myid < 0, trsp, rtors.rtrsp);
2372+
rcutorture_one_extend(&rtors.readstate, 0, trsp, rtors.rtrsp);
23762373
return false;
23772374
}
2378-
rtors.rtrsp = rcutorture_loop_extend(&rtors.readstate, myid < 0, trsp, rtors.rtrsp);
2379-
rcu_torture_one_read_end(&rtors, trsp, myid);
2375+
rtors.rtrsp = rcutorture_loop_extend(&rtors.readstate, trsp, rtors.rtrsp);
2376+
rcu_torture_one_read_end(&rtors, trsp);
23802377
return true;
23812378
}
23822379

@@ -2469,7 +2466,7 @@ static enum hrtimer_restart rcu_torture_updown_hrt(struct hrtimer *hrtp)
24692466
struct rcu_torture_one_read_state_updown *rtorsup;
24702467

24712468
rtorsup = container_of(hrtp, struct rcu_torture_one_read_state_updown, rtorsu_hrt);
2472-
rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
2469+
rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs);
24732470
WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
24742471
WRITE_ONCE(rtorsup->rtorsu_nups, rtorsup->rtorsu_nups + 1);
24752472
WRITE_ONCE(rtorsup->rtorsu_nmigrates,
@@ -2519,7 +2516,7 @@ static void rcu_torture_updown_cleanup(void)
25192516
if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
25202517
continue;
25212518
if (hrtimer_cancel(&rtorsup->rtorsu_hrt) || WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
2522-
rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
2519+
rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs);
25232520
WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
25242521
WRITE_ONCE(rtorsup->rtorsu_nups, rtorsup->rtorsu_nups + 1);
25252522
smp_store_release(&rtorsup->rtorsu_inuse, false);

0 commit comments

Comments
 (0)