History

rcutorture: Fix rcu_fwd_mutex deadlock

The rcu_torture_fwd_cb_hist() function acquires rcu_fwd_mutex, but is invoked from rcutorture_oom_notify() function, which hold this same mutex across this call. This commit fixes the resulting deadlock.

Paul E. McKenney committed 4 years ago

Commit 89440d21 parent 02b51a11 file · +2 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcu/rcutorture.c+2−2
@@ -2180,7 +2180,6 @@ static void rcu_torture_fwd_cb_hist(struct rcu_fwd *rfp) · 2179 unmodified lines
2180 for (i = ARRAY_SIZE(rfp->n_launders_hist) - 1; i > 0; i--)2180 for (i = ARRAY_SIZE(rfp->n_launders_hist) - 1; i > 0; i--)
2181 if (rfp->n_launders_hist[i].n_launders > 0)2181 if (rfp->n_launders_hist[i].n_launders > 0)
2182 break;2182 break;
2183 mutex_lock(&rcu_fwd_mutex); // Serialize histograms.
2184 pr_alert("%s: Callback-invocation histogram %d (duration %lu jiffies):",2183 pr_alert("%s: Callback-invocation histogram %d (duration %lu jiffies):",
2185 __func__, rfp->rcu_fwd_id, jiffies - rfp->rcu_fwd_startat);2184 __func__, rfp->rcu_fwd_id, jiffies - rfp->rcu_fwd_startat);
2186 gps_old = rfp->rcu_launder_gp_seq_start;2185 gps_old = rfp->rcu_launder_gp_seq_start;
@@ -2193,7 +2192,6 @@ static void rcu_torture_fwd_cb_hist(struct rcu_fwd *rfp) · 6 unmodified lines
2193 gps_old = gps;2192 gps_old = gps;
2194 }2193 }
2195 pr_cont("\n");2194 pr_cont("\n");
2196 mutex_unlock(&rcu_fwd_mutex);
2197}2195}
2198 2196
2199/* Callback function for continuous-flood RCU callbacks. */2197/* Callback function for continuous-flood RCU callbacks. */
@@ -2431,7 +2429,9 @@ static void rcu_torture_fwd_prog_cr(struct rcu_fwd *rfp) · 231 unmodified lines
2431 n_launders, n_launders_sa,2429 n_launders, n_launders_sa,
2432 n_max_gps, n_max_cbs, cver, gps);2430 n_max_gps, n_max_cbs, cver, gps);
2433 atomic_long_add(n_max_cbs, &rcu_fwd_max_cbs);2431 atomic_long_add(n_max_cbs, &rcu_fwd_max_cbs);
2432 mutex_lock(&rcu_fwd_mutex); // Serialize histograms.
2434 rcu_torture_fwd_cb_hist(rfp);2433 rcu_torture_fwd_cb_hist(rfp);
2434 mutex_unlock(&rcu_fwd_mutex);
2435 }2435 }
2436 schedule_timeout_uninterruptible(HZ); /* Let CBs drain. */2436 schedule_timeout_uninterruptible(HZ); /* Let CBs drain. */
2437 tick_dep_clear_task(current, TICK_DEP_BIT_RCU);2437 tick_dep_clear_task(current, TICK_DEP_BIT_RCU);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t