History

srcu: Add data_race() to ->srcu_lock_count and ->srcu_unlock_count arrays

The srcu_data structure's ->srcu_lock_count and ->srcu_unlock_count arrays are read and written locklessly, so this commit adds the data_race() to the diagnostic-print loads from these arrays in order mark them as known and approved data-racy accesses. This data race was reported by KCSAN. Not appropriate for backporting due to failure being unlikely and due to this being used only by rcutorture.

Paul E. McKenney committed 6 years ago

Commit b68c6141 parent 065a6db1 file · +4 −4Browse files

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

Unified · Split

kernel/rcu/srcutree.c+4−4
@@ -1281,8 +1281,8 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf) · 1280 unmodified lines
1281 struct srcu_data *sdp;1281 struct srcu_data *sdp;
1282 1282
1283 sdp = per_cpu_ptr(ssp->sda, cpu);1283 sdp = per_cpu_ptr(ssp->sda, cpu);
1284 u0 = sdp->srcu_unlock_count[!idx];1284 u0 = data_race(sdp->srcu_unlock_count[!idx]);
1285 u1 = sdp->srcu_unlock_count[idx];1285 u1 = data_race(sdp->srcu_unlock_count[idx]);
1286 1286
1287 /*1287 /*
1288 * Make sure that a lock is always counted if the corresponding1288 * Make sure that a lock is always counted if the corresponding
@@ -1290,8 +1290,8 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf) · 1 unmodified line
1290 */1290 */
1291 smp_rmb();1291 smp_rmb();
1292 1292
1293 l0 = sdp->srcu_lock_count[!idx];1293 l0 = data_race(sdp->srcu_lock_count[!idx]);
1294 l1 = sdp->srcu_lock_count[idx];1294 l1 = data_race(sdp->srcu_lock_count[idx]);
1295 1295
1296 c0 = l0 - u0;1296 c0 = l0 - u0;
1297 c1 = l1 - u1;1297 c1 = l1 - u1;

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