From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD8AEA0528; Thu, 9 Jul 2020 15:48:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8EF481E927; Thu, 9 Jul 2020 15:48:51 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 6E60F1E900 for ; Thu, 9 Jul 2020 15:48:48 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200709134847euoutp01d0d45999255157f736e1b0aff42f98e6~gGbPAyg8l1173611736euoutp01n for ; Thu, 9 Jul 2020 13:48:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200709134847euoutp01d0d45999255157f736e1b0aff42f98e6~gGbPAyg8l1173611736euoutp01n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594302527; bh=g1fSwYQHBAyH8yGNrkb2XK5cSpAROgnJI60WqgCWRIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENbwA+r4dAXfJFy7Fcnxwlg+QaHNq6Soo54DDh8+QoV5Z+hUyGY/O41mLsuxM6EEO EW7Hpxx0kRY+Ip34y+YVhas9Ft1OVFBbzHpOjQhdbxW/vo+y/FuOfD1AxXIGC19viP u5RrTelhzHlZwdNO+hX0rIplfPzOl4JXABviJAGU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200709134847eucas1p24ce1c73a1d236021308c00160a5b3a77~gGbOuLRua2824828248eucas1p2i; Thu, 9 Jul 2020 13:48:47 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id FC.9D.05997.F30270F5; Thu, 9 Jul 2020 14:48:47 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200709134847eucas1p2698cc0b2de3751aba984d306beb9d8f1~gGbOQDdiM2967529675eucas1p2V; Thu, 9 Jul 2020 13:48:47 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200709134847eusmtrp117fc7944434155fd3950649767240e23~gGbOPYk6B1312913129eusmtrp1C; Thu, 9 Jul 2020 13:48:47 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-4d-5f07203fa149 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4F.CE.06314.E30270F5; Thu, 9 Jul 2020 14:48:46 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200709134846eusmtip2f1a8bd5caf94a78ed0d576de91549de8~gGbNh5rPK2403024030eusmtip2z; Thu, 9 Jul 2020 13:48:46 +0000 (GMT) From: Lukasz Wojciechowski To: Thomas Monjalon , Nicolas Chautru , Fiona Trahe , Ashish Gupta , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com Date: Thu, 9 Jul 2020 15:48:20 +0200 Message-Id: <20200709134823.9176-2-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200709134823.9176-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRmVeSWpSXmKPExsWy7djP87r2CuzxBjMPKFi8fLiS1eLGKnuL d5+2M1m8uXKe2eJZzzpGi/4tJxgtPj04weLA7vFrwVJWj8V7XjJ5TF54kdnj2M1p7B4H3+1h CmCN4rJJSc3JLEst0rdL4MqYfngyY8FF24oFM5awNTAuMeli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yvrCAJEYHbjBKdN68ygSSYgYbentfEBmILC9hLvNhx FqyBRUBVYtXWq2A2r4CLxJwL31ghNshLrN5wgBnE5hRwldi6fR8jxLYGRonPf/exTmDkW8DI sIpRJLW0ODc9t9hQrzgxt7g0L10vOT93EyMwaLcd+7l5B+OljcGHGAU4GJV4eHf8Z4sXYk0s K67MPcQowcGsJMLrdPZ0nBBvSmJlVWpRfnxRaU5q8SFGU6CrJjJLiSbnAyMqryTe0NTQ3MLS 0NzY3NjMQkmct0PgYIyQQHpiSWp2ampBahFMHxMHp1QDo/7V+bMvuqtrPrlvmXhuswTvH3+7 z/wHd78Ssl71e6Wmqpvkke3lgqL5Pvy5s142PH8/dXbZjrpn3bvORM3Yt8ysfOr16w27GiSl MybOLG8UPhnC9Plb0oJnQYd1e1S6ivafV7ljo+QjOtNLbEpWNc/rZtd5O3Ufyi+2XFuUUKrc /CZWaj1PuBJLcUaioRZzUXEiAHmHkvNwAgAA X-CMS-MailID: 20200709134847eucas1p2698cc0b2de3751aba984d306beb9d8f1 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200709134847eucas1p2698cc0b2de3751aba984d306beb9d8f1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200709134847eucas1p2698cc0b2de3751aba984d306beb9d8f1 References: <20200422214555.11837-1-l.wojciechow@partner.samsung.com> <20200709134823.9176-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 1/4] config: introduce global rte debug flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A new boolean meson build flag is introduced with this patch: rte_debug. To enable this option add -Drte_debug=true to the meson configure command. By enabling this flag the globaly defined macro RTE_DEBUG becomes defined. It should be used for enabling debug code in all dpdk project components. Using this flag allows to make additional checks or tests and provide additional logs even in performance sensitive parts of code. The flag is disabled by default. Additionally for all enabled to be built libraries a RTE_DEBUG_{library name} is defined and assigned a value 1. This standardize names of library specific debug macros. Those can be used also without rte_debug option by using CFLAGS="-D..." build parameter. Code put inside RTE_DEBUG* #ifdef sections should be also put inside if (rte_log_can_log(...)) condition to allow run-time filtering of sanity checks, validations, logs and dumps when using rte_debug option. Libraries will be adjusted to the change in separate patches. Similarly for all enabled to be built drivers a RTE_DEBUG_{driver_class}_{driver_name} is defined and assigned value 1. Suggested-by: Bruce Richardson Signed-off-by: Lukasz Wojciechowski --- config/meson.build | 4 ++++ drivers/baseband/meson.build | 1 + drivers/bus/meson.build | 1 + drivers/common/meson.build | 1 + drivers/compress/meson.build | 1 + drivers/crypto/meson.build | 1 + drivers/event/meson.build | 1 + drivers/mempool/meson.build | 1 + drivers/meson.build | 3 +++ drivers/net/meson.build | 1 + drivers/raw/meson.build | 1 + drivers/vdpa/meson.build | 1 + lib/meson.build | 4 ++++ meson_options.txt | 2 ++ 14 files changed, 23 insertions(+) diff --git a/config/meson.build b/config/meson.build index cff8b33dd..c65c6412a 100644 --- a/config/meson.build +++ b/config/meson.build @@ -179,6 +179,10 @@ endif # add -include rte_config to cflags add_project_arguments('-include', 'rte_config.h', language: 'c') +if get_option('rte_debug') + dpdk_conf.set('RTE_DEBUG', 1) +endif + # enable extra warnings and disable any unwanted warnings warning_flags = [ # -Wall is added by meson by default, so add -Wextra only diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build index 415b6724b..11ff30e5a 100644 --- a/drivers/baseband/meson.build +++ b/drivers/baseband/meson.build @@ -9,3 +9,4 @@ drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec'] config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@' driver_name_fmt = 'rte_pmd_bbdev_@0@' +rte_debug_fmt = 'RTE_DEBUG_BASEBAND_@0@' diff --git a/drivers/bus/meson.build b/drivers/bus/meson.build index 80de2d91d..8ccbce75b 100644 --- a/drivers/bus/meson.build +++ b/drivers/bus/meson.build @@ -5,3 +5,4 @@ drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev', 'vmbus'] std_deps = ['eal'] config_flag_fmt = 'RTE_LIBRTE_@0@_BUS' driver_name_fmt = 'rte_bus_@0@' +rte_debug_fmt = 'RTE_DEBUG_BUS_@0@' diff --git a/drivers/common/meson.build b/drivers/common/meson.build index 5db7e29b1..a72f14905 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -9,3 +9,4 @@ std_deps = ['eal'] drivers = ['cpt', 'dpaax', 'iavf', 'mlx5', 'mvep', 'octeontx', 'octeontx2', 'qat'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' +rte_debug_fmt = 'RTE_DEBUG_COMMON_@0@' diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build index ee883c3f9..b446bd988 100644 --- a/drivers/compress/meson.build +++ b/drivers/compress/meson.build @@ -10,3 +10,4 @@ drivers = ['isal', 'octeontx', 'qat', 'zlib'] std_deps = ['compressdev'] # compressdev pulls in all other needed deps config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_COMPRESS_@0@' diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build index a2423507a..02c2c8752 100644 --- a/drivers/crypto/meson.build +++ b/drivers/crypto/meson.build @@ -28,3 +28,4 @@ drivers = ['aesni_gcm', std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_CRYPTO_@0@' diff --git a/drivers/event/meson.build b/drivers/event/meson.build index ebe76a75c..3e3c221c3 100644 --- a/drivers/event/meson.build +++ b/drivers/event/meson.build @@ -13,3 +13,4 @@ endif std_deps = ['eventdev', 'kvargs'] config_flag_fmt = 'RTE_LIBRTE_@0@_EVENTDEV_PMD' driver_name_fmt = 'rte_pmd_@0@_event' +rte_debug_fmt = 'RTE_DEBUG_EVENT_@0@' diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build index c9609f145..ada93a75a 100644 --- a/drivers/mempool/meson.build +++ b/drivers/mempool/meson.build @@ -9,3 +9,4 @@ drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack'] std_deps = ['mempool'] config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL' driver_name_fmt = 'rte_mempool_@0@' +rte_debug_fmt = 'RTE_DEBUG_MEMPOOL_@0@' diff --git a/drivers/meson.build b/drivers/meson.build index 161cfda04..975e1774b 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -99,6 +99,9 @@ foreach class:dpdk_driver_classes fmt_name = name endif dpdk_conf.set(config_flag_fmt.format(fmt_name.to_upper()),1) + if get_option('rte_debug') + dpdk_conf.set(rte_debug_fmt.format(fmt_name.to_upper()),1) + endif lib_name = driver_name_fmt.format(fmt_name) dpdk_extra_ldflags += pkgconfig_extra_libs diff --git a/drivers/net/meson.build b/drivers/net/meson.build index d56b24051..0b4037b5f 100644 --- a/drivers/net/meson.build +++ b/drivers/net/meson.build @@ -60,3 +60,4 @@ std_deps += ['bus_pci'] # very many PMDs depend on PCI, so make std std_deps += ['bus_vdev'] # same with vdev bus config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_NET_@0@' diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index 2c1e65ec7..703c2b8a8 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -13,3 +13,4 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_rawdev_@0@' +rte_debug_fmt = 'RTE_DEBUG_RAW_@0@' diff --git a/drivers/vdpa/meson.build b/drivers/vdpa/meson.build index 798eb3830..7e86a0c49 100644 --- a/drivers/vdpa/meson.build +++ b/drivers/vdpa/meson.build @@ -11,3 +11,4 @@ std_deps = ['bus_pci', 'kvargs'] std_deps += ['vhost'] config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_VDPA_@0@' diff --git a/lib/meson.build b/lib/meson.build index 3852c0156..a06099a15 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -99,6 +99,10 @@ foreach l:libraries dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) install_headers(headers) + if get_option('rte_debug') + dpdk_conf.set('RTE_DEBUG_' + name.to_upper(), 1) + endif + libname = 'rte_' + name includes += include_directories(dir_name) diff --git a/meson_options.txt b/meson_options.txt index 9bf18ab6b..fc0fedd69 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -32,6 +32,8 @@ option('max_numa_nodes', type: 'integer', value: 4, description: 'maximum number of NUMA nodes supported by EAL') option('enable_trace_fp', type: 'boolean', value: false, description: 'enable fast path trace points.') +option('rte_debug', type: 'boolean', value: false, + description: 'build with additional sanity checks, validations and logs') option('tests', type: 'boolean', value: true, description: 'build unit tests') option('use_hpet', type: 'boolean', value: false, -- 2.17.1