Re: [PATCH net-next v5 2/2] page_pool: Track DMA-mapped pages and unmap them when destroying the pool

Yunsheng Lin
2025-04-02T11:15:59Z

On 2025/4/1 19:56, Alexander Lobakin wrote:

...

>> There are two reading of dma_sync in this patch, the first reading is not
>> under rcu read lock and doing the reading without READ_ONCE(), the second
>> reading is under rcu read lock and do the reading with READ_ONCE().
>>
>> The first one seems an optimization to avoid taking the rcu read lock,
>> why might need READ_ONCE() to make KCSAN happy if we do care about making
>> KCSAN happy.
>>
>> The second one does not seems to need the atomicity by using the READ_ONCE()
>> as it is always under RCU read lock(implicit or explicit one), and there is
>> a rcu sync after the clearing of that bit.
>
> IOW, are you saying this change is not needed at all?

It is not needed unless KCSAN is not happy about this and we really want to make
KCSAN happy about it as my understanding.