DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] checkpatch: enable volatile warning
@ 2021-03-10 11:04 Dharmik Thakkar
  2021-03-10 11:10 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Dharmik Thakkar @ 2021-03-10 11:04 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, nd, Dharmik Thakkar

Enable volatile considered harmful warning since use of volatile
is suspect.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78a408ef9823..92f1984454b0 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -29,7 +29,7 @@ options="$options --max-line-length=$length"
 options="$options --show-types"
 options="$options --ignore=LINUX_VERSION_CODE,ENOSYS,\
 FILE_PATH_CHANGES,MAINTAINERS_STYLE,SPDX_LICENSE_TAG,\
-VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
+PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,PREFER_FALLTHROUGH,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] checkpatch: enable volatile warning
  2021-03-10 11:04 [dpdk-dev] [PATCH] checkpatch: enable volatile warning Dharmik Thakkar
@ 2021-03-10 11:10 ` Thomas Monjalon
  2021-03-10 15:10   ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2021-03-10 11:10 UTC (permalink / raw)
  To: Dharmik Thakkar; +Cc: dev, nd, stephen, ruifeng.wang, david.marchand

10/03/2021 12:04, Dharmik Thakkar:
> Enable volatile considered harmful warning since use of volatile
> is suspect.
> 
> Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

git grep -w volatile | wc -l
	1796

How much is it suspect?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] checkpatch: enable volatile warning
  2021-03-10 11:10 ` Thomas Monjalon
@ 2021-03-10 15:10   ` Stephen Hemminger
  2021-08-16 13:28     ` Dharmik Thakkar
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2021-03-10 15:10 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Dharmik Thakkar, dev, nd, ruifeng.wang, david.marchand

On Wed, 10 Mar 2021 12:10:01 +0100
Thomas Monjalon <thomas@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@networkplumber.org>
> > Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] checkpatch: enable volatile warning
  2021-03-10 15:10   ` Stephen Hemminger
@ 2021-08-16 13:28     ` Dharmik Thakkar
  0 siblings, 0 replies; 4+ messages in thread
From: Dharmik Thakkar @ 2021-08-16 13:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: thomas, dev, nd, Ruifeng Wang, david.marchand

Hi,

Apologies for the delayed response!

> On Mar 10, 2021, at 9:10 AM, Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> On Wed, 10 Mar 2021 12:10:01 +0100
> Thomas Monjalon <thomas@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@networkplumber.org>
>>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>>> Reviewed-by: Ruifeng Wang <ruifeng.wang@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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-16 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 11:04 [dpdk-dev] [PATCH] checkpatch: enable volatile warning Dharmik Thakkar
2021-03-10 11:10 ` Thomas Monjalon
2021-03-10 15:10   ` Stephen Hemminger
2021-08-16 13:28     ` Dharmik Thakkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).