* [PATCH] blkcg: have bh disable for 32bit UP system reading 64bit stats
@ 2013-11-06 11:14 Hong Zhiguo
2013-11-20 17:24 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Hong Zhiguo @ 2013-11-06 11:14 UTC (permalink / raw)
To: tj; +Cc: vgoyal, cgroups, axboe, linux-kernel, Hong Zhiguo
From: Hong Zhiguo <zhiguohong@tencent.com>
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.
Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
---
block/blk-cgroup.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index ae6969a..2e34c38 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -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;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] blkcg: have bh disable for 32bit UP system reading 64bit stats
2013-11-06 11:14 [PATCH] blkcg: have bh disable for 32bit UP system reading 64bit stats Hong Zhiguo
@ 2013-11-20 17:24 ` Tejun Heo
2013-11-20 17:31 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2013-11-20 17:24 UTC (permalink / raw)
To: Hong Zhiguo; +Cc: vgoyal, cgroups, axboe, linux-kernel, Hong Zhiguo
On Wed, Nov 06, 2013 at 07:14:44PM +0800, Hong Zhiguo wrote:
> From: Hong Zhiguo <zhiguohong@tencent.com>
>
> 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.
>
> Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
Acked-by: Tejun Heo <tj@kernel.org>
Jens, can you please pick this one up? This probably needs to be
tagged for stable too.
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] blkcg: have bh disable for 32bit UP system reading 64bit stats
2013-11-20 17:24 ` Tejun Heo
@ 2013-11-20 17:31 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2013-11-20 17:31 UTC (permalink / raw)
To: Tejun Heo, Hong Zhiguo; +Cc: vgoyal, cgroups, linux-kernel, Hong Zhiguo
On 11/20/2013 10:24 AM, Tejun Heo wrote:
> On Wed, Nov 06, 2013 at 07:14:44PM +0800, Hong Zhiguo wrote:
>> From: Hong Zhiguo <zhiguohong@tencent.com>
>>
>> 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.
>>
>> Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
>
> Acked-by: Tejun Heo <tj@kernel.org>
>
> Jens, can you please pick this one up? This probably needs to be
> tagged for stable too.
Yeah will do, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-20 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-06 11:14 [PATCH] blkcg: have bh disable for 32bit UP system reading 64bit stats Hong Zhiguo
2013-11-20 17:24 ` Tejun Heo
2013-11-20 17:31 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).