Bug 955 - [20.11] build failure in qos_sched example app
Summary: [20.11] build failure in qos_sched example app
Status: IN_PROGRESS
Alias: None
Product: DPDK
Classification: Unclassified
Component: examples (show other bugs)
Version: 20.11
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: dev
URL:
Depends on:
Blocks:
 
Reported: 2022-03-08 09:15 CET by Ali Alnubani
Modified: 2022-03-08 11:22 CET (History)
1 user (show)



Attachments

Description Ali Alnubani 2022-03-08 09:15:34 CET
"""
$ meson --werror -Dexamples=all build && ninja -C build
[..]
examples/qos_sched/args.c: In function 'app_parse_args':
examples/qos_sched/args.c:413:28: error: implicit declaration of function 'RTE_BIT64'; did you mean 'RTE_BE64'? [-Werror=implicit-function-declaration]
  413 |   if (app_used_core_mask & RTE_BIT64(app_main_core)) {
      |                            ^~~~~~~~~
      |                            RTE_BE64
examples/qos_sched/args.c:413:28: error: nested extern declaration of 'RTE_BIT64' [-Werror=nested-externs]
cc1: all warnings being treated as errors
"""

Also reproduces with clang:
"""
$ meson --werror --buildtype=debugoptimized -Dexamples=all build && ninja -C build
[..]
examples/qos_sched/args.c:413:28: error: implicit declaration of function 'RTE_BIT64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                if (app_used_core_mask & RTE_BIT64(app_main_core)) {
                                         ^
examples/qos_sched/args.c:419:24: error: implicit declaration of function 'RTE_BIT64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        app_used_core_mask |= RTE_BIT64(app_main_core);
                              ^
2 errors generated.
"""

OS: Ubuntu 20.04.4
gcc: 9.3.0
clang: 10.0.0
Comment 1 Ali Alnubani 2022-03-08 09:18:16 CET
Reproduces on version: eb0f31af87b
Comment 2 Kevin Traynor 2022-03-08 09:32:46 CET
This is caused by backport of:

commit 9c9fad3dfa042ae4b7a045cb1731f8701f8210e6
Author: Megha Ajmera <megha.ajmera@intel.com>
Date:   Wed Feb 23 17:36:30 2022 +0000

    examples/qos_sched: fix core mask overflow
    
    Masking of core mask was incorrect. Instead of using 1U for shifting, it
    should be using 1LU as the result is assigned to uint64.
    
    CID 375859: Potentially overflowing expression "1U << app_main_core" with
    type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit
    arithmetic, and then used in a context that expects an expression of
    type "uint64_t" (64 bits, unsigned).
    
    Coverity issue: 375859
    Fixes: de3cfa2c9823 ("sched: initial import")
    Cc: stable@dpdk.org


It needs rte_bitops include added, see
https://github.com/kevintraynor/dpdk-stable/commit/d33bb6bd28406944b31ad53ba90199ca5f2f114f
Comment 3 Kevin Traynor 2022-03-08 11:22:03 CET
Sent patch here:
http://inbox.dpdk.org/stable/20220308102109.161501-1-ktraynor@redhat.com/T/#u

Note You need to log in before you can comment on or make changes to this bug.