* [PATCH] block/blk-cgroup-rwstat: use data_race() for online test
@ 2026-08-02 15:04 Tao Cui
2026-08-03 5:29 ` Yu Kuai
0 siblings, 1 reply; 2+ messages in thread
From: Tao Cui @ 2026-08-02 15:04 UTC (permalink / raw)
To: axboe
Cc: tj, josef, yukuai, cgroups, linux-block, linux-kernel, cui.tao,
Tao Cui
From: Tao Cui <cuitao@kylinos.cn>
blkg_rwstat_recursive_sum() reads pos_blkg->online without the queue
lock that its doc comment requires, since blkcg_print_blkgs() stopped
holding it in 56cc24f59c14. Concurrent blkg_create/destroy flips
->online, tripping KCSAN. The race is harmless (RCU-protected, stale
online only causes minor stat noise). Use data_race() to annotate
the intentional lockless read.
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
block/blk-cgroup-rwstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-cgroup-rwstat.c b/block/blk-cgroup-rwstat.c
index aae910713814..71f74052ae03 100644
--- a/block/blk-cgroup-rwstat.c
+++ b/block/blk-cgroup-rwstat.c
@@ -107,7 +107,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol,
blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) {
struct blkg_rwstat *rwstat;
- if (!pos_blkg->online)
+ if (!data_race(pos_blkg->online))
continue;
if (pol) {
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block/blk-cgroup-rwstat: use data_race() for online test
2026-08-02 15:04 [PATCH] block/blk-cgroup-rwstat: use data_race() for online test Tao Cui
@ 2026-08-03 5:29 ` Yu Kuai
0 siblings, 0 replies; 2+ messages in thread
From: Yu Kuai @ 2026-08-03 5:29 UTC (permalink / raw)
To: Tao Cui, axboe, yu kuai
Cc: tj, josef, yukuai, cgroups, linux-block, linux-kernel, Tao Cui
在 2026/8/2 23:04, Tao Cui 写道:
> From: Tao Cui<cuitao@kylinos.cn>
>
> blkg_rwstat_recursive_sum() reads pos_blkg->online without the queue
> lock that its doc comment requires, since blkcg_print_blkgs() stopped
> holding it in 56cc24f59c14. Concurrent blkg_create/destroy flips
> ->online, tripping KCSAN. The race is harmless (RCU-protected, stale
> online only causes minor stat noise). Use data_race() to annotate
> the intentional lockless read.
>
> Signed-off-by: Tao Cui<cuitao@kylinos.cn>
> ---
> block/blk-cgroup-rwstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Yu Kuai <yukuai@fygo.io>
--
Thanks,
Kuai
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-03 5:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-02 15:04 [PATCH] block/blk-cgroup-rwstat: use data_race() for online test Tao Cui
2026-08-03 5:29 ` Yu Kuai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox