devtools: suppress checkpatch warning on some kernel macro

Message ID 20230404123647.404-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series devtools: suppress checkpatch warning on some kernel macro |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS

Commit Message

David Marchand April 4, 2023, 12:36 p.m. UTC
  Kernel checkpatch.pl is confused about RTE_BUILD_BUG_ON() and warns as if
our code was calling the kernel macro BUG_ON().

This does not make sense in the DPDK userspace code and the Linux kernel
module hosted in our repository (kernel/linux/kni) won't make it upstream.

Disable this warning.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit April 4, 2023, 1 p.m. UTC | #1
On 4/4/2023 1:36 PM, David Marchand wrote:
> Kernel checkpatch.pl is confused about RTE_BUILD_BUG_ON() and warns as if
> our code was calling the kernel macro BUG_ON().
> 
> This does not make sense in the DPDK userspace code and the Linux kernel
> module hosted in our repository (kernel/linux/kni) won't make it upstream.
> 
> Disable this warning.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Sounds reasonable,
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>


Is there any occurrence in the public CI, as reference?
  
David Marchand April 4, 2023, 1:18 p.m. UTC | #2
On Tue, Apr 4, 2023 at 3:01 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>
> On 4/4/2023 1:36 PM, David Marchand wrote:
> > Kernel checkpatch.pl is confused about RTE_BUILD_BUG_ON() and warns as if
> > our code was calling the kernel macro BUG_ON().
> >
> > This does not make sense in the DPDK userspace code and the Linux kernel
> > module hosted in our repository (kernel/linux/kni) won't make it upstream.
> >
> > Disable this warning.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> Sounds reasonable,
> Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
>
>
> Is there any occurrence in the public CI, as reference?

I caught it when preparing submission of:
https://patchwork.dpdk.org/project/dpdk/patch/20230404124840.1898-2-david.marchand@redhat.com/
dpdk.org checkpath did not catch it, so it is probably lagging a bit.


For reference, in my environment, this looks like:
### [PATCH] malloc: rework heap destroy

WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely
unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible)
instead of BUG() or variants
#23: FILE: lib/eal/common/malloc_heap.c:1389:
+    RTE_BUILD_BUG_ON(offsetof(struct malloc_heap, lock) != 0);

total: 0 errors, 1 warnings, 23 lines checked

0/1 valid patch
  
Thomas Monjalon April 23, 2023, 1:55 p.m. UTC | #3
04/04/2023 15:00, Ferruh Yigit:
> On 4/4/2023 1:36 PM, David Marchand wrote:
> > Kernel checkpatch.pl is confused about RTE_BUILD_BUG_ON() and warns as if
> > our code was calling the kernel macro BUG_ON().
> > 
> > This does not make sense in the DPDK userspace code and the Linux kernel
> > module hosted in our repository (kernel/linux/kni) won't make it upstream.
> > 
> > Disable this warning.
> > 
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> 
> Sounds reasonable,
> Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>

Applied, thanks.
  

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index a07bbc83cb..4eac45036a 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -33,7 +33,7 @@  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,STRLCPY,\
 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,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,AVOID_BUG"
 options="$options $DPDK_CHECKPATCH_OPTIONS"
 
 print_usage () {