Skip to contentSkip to conversation

blkcg: have bh disable for 32bit UP system reading 64bit stats

PATCH In review Hong Zhiguo 3 participants 3 messages Nov 6, 2013 – Nov 20, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkcg: have bh disable for 32bit UP system reading 64bit stats

From: Hong Zhiguo <[email protected]>

Update of blkg_stat and blkg_rwstat may happen in bh context. While u64_stats_fetch_retry is only preempt_disable on 32bit UP system. This is not enough to avoid preemption by bh and may read strange 64 bit value.

---
 block/blk-cgroup.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
block/blk-cgroup.h +4 -4
index ae6969a..2e34c38 100644
@@ -430,9 +430,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
 	uint64_t v;
 
 	do {
-		start = u64_stats_fetch_begin(&stat->syncp);
+		start = u64_stats_fetch_begin_bh(&stat->syncp);
 		v = stat->cnt;
-	} while (u64_stats_fetch_retry(&stat->syncp, start));
+	} while (u64_stats_fetch_retry_bh(&stat->syncp, start));
 
 	return v;
 }
@@ -498,9 +498,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
 	struct blkg_rwstat tmp;
 
 	do {
-		start = u64_stats_fetch_begin(&rwstat->syncp);
+		start = u64_stats_fetch_begin_bh(&rwstat->syncp);
 		tmp = *rwstat;
-	} while (u64_stats_fetch_retry(&rwstat->syncp, start));
+	} while (u64_stats_fetch_retry_bh(&rwstat->syncp, start));
 
 	return tmp;
 }
Signature · 1 line
1.8.1.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Hong Zhiguo

From: Hong Zhiguo <[email protected]>

Update of blkg_stat and blkg_rwstat may happen in bh context. While u64_stats_fetch_retry is only preempt_disable on 32bit UP system. This is not enough to avoid preemption by bh and may read strange 64 bit value.

Jens, can you please pick this one up? This probably needs to be tagged for stable too.

Thanks!

Signature · 1 line
tejun
maintainer
#2 lore raw
Quoted 8 lines · Tejun Heo
Quoted 7 lines · Hong Zhiguo

From: Hong Zhiguo <[email protected]>

Update of blkg_stat and blkg_rwstat may happen in bh context. While u64_stats_fetch_retry is only preempt_disable on 32bit UP system. This is not enough to avoid preemption by bh and may read strange 64 bit value.

Quoted 6 lines
Quoted 1 line

Jens, can you please pick this one up? This probably needs to be tagged for stable too.

Yeah will do, thanks.

Signature · 1 line
Jens Axboe