Re: [PATCH v3] block/blk-iocost: annotate ioc_pd_stat reads with data_race()

From: Jens Axboe

Date: Tue Aug 04 2026 - 10:12:34 EST



On Tue, 04 Aug 2026 13:41:20 +0800, Tao Cui wrote:
> ioc_pd_stat() reads ioc->enabled, ioc->vtime_base_rate, and
> iocg->last_stat without holding ioc->lock, which trips KCSAN since
> ioc_adjust_base_vrate() and iocg_flush_stat_upward() write those
> fields under ioc->lock.
>
> Commit 35198e323001 fixed the same issue in ioc_qos_prfill() and
> ioc_cost_model_prfill() by adding spin_lock_irq(&ioc->lock). However,
> those functions read configuration parameters (qos/model) that need
> synchronized reads. In contrast, ioc_pd_stat() only reads stat
> values (vrate, usage) where stale reads are harmless, so data_race()
> is more appropriate — it silences the KCSAN warning without adding
> lock contention during high-frequency stat reads.
>
> [...]

Applied, thanks!

[1/1] block/blk-iocost: annotate ioc_pd_stat reads with data_race()
commit: 4d73bf0ca4fbe7f252154ce98d6693c6c198164c

Best regards,
--
Jens Axboe