[PATCH 04/13] net/ionic: fix missing volatile type for cqe pointers

Boyer, Andrew Andrew.Boyer at amd.com
Mon Feb 5 14:33:11 CET 2024



> On Feb 2, 2024, at 11:26 PM, Stephen Hemminger <stephen at 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.boyer at amd.com> wrote:
> 
>> From: Neel Patel <neel.patel at 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: stable at dpdk.org
>> 
>> Signed-off-by: Andrew Boyer <andrew.boyer at amd.com>
>> Signed-off-by: Neel Patel <neel.patel at 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



More information about the stable mailing list