> On Feb 2, 2024, at 11:26 PM, Stephen Hemminger <step...@networkplumber.org> 
> wrote:
> 
> Caution: This message originated from an External Source. Use proper caution 
> when opening attachments, clicking links, or responding.
> 
> 
> On Fri, 2 Feb 2024 11:32:29 -0800
> Andrew Boyer <andrew.bo...@amd.com> wrote:
> 
>> From: Neel Patel <neel.pa...@amd.com>
>> 
>> This memory may be changed by the hardware, so the volatile
>> keyword is required for correctness.
>> 
>> Fixes: e86a6fcc7cf3 ("net/ionic: add optimized non-scattered Rx/Tx")
>> cc: sta...@dpdk.org
>> 
>> Signed-off-by: Andrew Boyer <andrew.bo...@amd.com>
>> Signed-off-by: Neel Patel <neel.pa...@amd.com>
> 
> In general barriers are better than volatile.
> Volatile is a compiler not hardware construct really.
> 
> https://www.kernel.org/doc/html/latest/process/volatile-considered-harmful.html

Thanks for looking. The goal here is to prevent inappropriate compiler 
optimization.

>From the link you posted:

> Pointers to data structures in coherent memory which might be modified by I/O 
> devices can, sometimes, legitimately be volatile. A ring buffer used by a 
> network adapter, where that adapter changes pointers to indicate which 
> descriptors have been processed, is an example of this type of situation.


Doesn't that sound like what we are doing?

Thanks,
Andrew

Reply via email to