[dpdk-dev] [PATCH] checkpatch: enable volatile warning

Dharmik Thakkar Dharmik.Thakkar at arm.com
Mon Aug 16 15:28:30 CEST 2021


Hi,

Apologies for the delayed response!

> On Mar 10, 2021, at 9:10 AM, Stephen Hemminger <stephen at networkplumber.org> wrote:
> 
> On Wed, 10 Mar 2021 12:10:01 +0100
> Thomas Monjalon <thomas at monjalon.net> wrote:
> 
>> 10/03/2021 12:04, Dharmik Thakkar:
>>> Enable volatile considered harmful warning since use of volatile
>>> is suspect.
>>> 
>>> Suggested-by: Stephen Hemminger <stephen at networkplumber.org>
>>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar at arm.com>
>>> Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>  
>> 
>> git grep -w volatile | wc -l
>> 	1796
>> 
>> How much is it suspect?
>> 
>> 
> 
> Many seem to be unsafe.
>   testpmd: uses flags values in unsafe manner
>      it also uses volatile when accessing hardware registers
> 
>   test-alarm is expecting that alarm() is a signal
>       (it is not)
> 
>   test-atomic is ok
>   test-barrier is doing barriers and not using __atomic
> 
>   drivers use volatile to mark hardware registers.
> 
> It is still true volatile is not enough are not weak memory model.

Agree, and this warning should help avoid such unsafe / incorrect use of volatile for future patches.


More information about the dev mailing list