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

Jens Axboe <axboe-tSWWG44O7X1aa/[email protected]>
Newsgroups gmane.linux.kernel.cgroups,gmane.linux.block,gmane.linux.kernel
Message-ID <178584979848.950360.4692094909873127154.b4-ty@b4>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.