[PATCH v3 1/3] spinlock: remove volatile qualifier

David Marchand david.marchand at redhat.com
Tue May 19 17:02:50 CEST 2026


On Tue, 19 May 2026 at 12:37, Thomas Monjalon <thomas at monjalon.net> wrote:
>
> When compiling with C++20 standard requirement (default in GCC 16),
> the increment and decrement of volatile variables are rejected:
>
> rte_spinlock.h:241:14: error:
>         '++' expression of 'volatile'-qualified type is deprecated
> rte_spinlock.h:252:21: error:
>         '--' expression of 'volatile'-qualified type is deprecated
> rte_spinlock.h:278:14: error:
>         '++' expression of 'volatile'-qualified type is deprecated
>
> The count field of rte_spinlock_recursive_t
> does not need the volatile qualifier
> because it is only accessed by the thread holding the lock,
> which already provides the necessary memory ordering.
>
> The user field can be accessed outside of the lock,
> so it must handled as a C11 atomic variable.
> The name is also changed from user to owner.
> It will break if an application is accessing this field directly,
> which should never happen.
>
> Fixes: af75078fece3 ("first public release")
> Cc: stable at dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>

Series applied, thanks.


-- 
David Marchand



More information about the stable mailing list