patches for DPDK stable branches
 help / color / mirror / Atom feed
* [23.11 1/2] log: remove per line log helper
@ 2024-12-12 13:23 David Marchand
  2024-12-12 13:23 ` [23.11 2/2] power: fix log message when checking lcore ID David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2024-12-12 13:23 UTC (permalink / raw)
  To: stable, xuemingl

This looks like a rebase/backport issue.
RTE_LOG_LINE is not required in the LTS branch.
Just adapt crypto/dpaa_sec log macro.

Fixes: e56ba1eea617 ("drivers: remove redundant newline from logs")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh               |  8 --------
 drivers/crypto/dpaa_sec/dpaa_sec_log.h |  2 +-
 lib/log/rte_log.h                      | 21 ---------------------
 3 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 10d1bf490b..10b79ca2bc 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -53,14 +53,6 @@ print_usage () {
 check_forbidden_additions() { # <patch>
 	res=0
 
-	# refrain from new calls to RTE_LOG
-	awk -v FOLDERS="lib" \
-		-v EXPRESSIONS="RTE_LOG\\\(" \
-		-v RET_ON_FAIL=1 \
-		-v MESSAGE='Prefer RTE_LOG_LINE' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
-		"$1" || res=1
-
 	# refrain from new additions of rte_panic() and rte_exit()
 	# multiple folders and expressions are separated by spaces
 	awk -v FOLDERS="lib drivers" \
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_log.h b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
index 82ac1fa1c4..d298ac5b57 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_log.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
@@ -29,7 +29,7 @@ extern int dpaa_logtype_sec;
 
 /* DP Logs, toggled out at compile time if level lower than current level */
 #define DPAA_SEC_DP_LOG(level, fmt, args...) \
-	RTE_LOG_DP_LINE(level, PMD, fmt, ## args)
+	RTE_LOG_DP(level, PMD, fmt "\n", ## args)
 
 #define DPAA_SEC_DP_DEBUG(fmt, args...) \
 	DPAA_SEC_DP_LOG(DEBUG, fmt, ## args)
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 584cea541e..f7a8405de9 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -17,7 +17,6 @@
 extern "C" {
 #endif
 
-#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -359,26 +358,6 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
 	 0)
 
-#if defined(RTE_TOOLCHAIN_GCC) && !defined(PEDANTIC)
-#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
-	static_assert(!__builtin_strchr(fmt, '\n'), \
-		"This log format string contains a \\n")
-#else
-#define RTE_LOG_CHECK_NO_NEWLINE(...)
-#endif
-
-#define RTE_LOG_LINE(l, t, ...) do { \
-	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
-	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
-} while (0)
-
-#define RTE_LOG_DP_LINE(l, t, ...) do { \
-	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
-	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
-} while (0)
-
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
-- 
2.47.0


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

* [23.11 2/2] power: fix log message when checking lcore ID
  2024-12-12 13:23 [23.11 1/2] log: remove per line log helper David Marchand
@ 2024-12-12 13:23 ` David Marchand
  2024-12-12 14:08   ` Xueming Li
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2024-12-12 13:23 UTC (permalink / raw)
  To: stable, xuemingl

Caught while inspecting changes backported in 23.11 LTS branch.
The POWER_LOG() macro in the main branch automatically appends a \n
which is not done by RTE_LOG().

Fixes: 1afa4c7c5ea6 ("power: fix mapped lcore ID")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/power/power_amd_pstate_cpufreq.c | 2 +-
 lib/power/power_common.c             | 4 ++--
 lib/power/power_pstate_cpufreq.c     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/power/power_amd_pstate_cpufreq.c b/lib/power/power_amd_pstate_cpufreq.c
index 7b8e77003f..ff63e91183 100644
--- a/lib/power/power_amd_pstate_cpufreq.c
+++ b/lib/power/power_amd_pstate_cpufreq.c
@@ -377,7 +377,7 @@ power_amd_pstate_cpufreq_init(unsigned int lcore_id)
 	}
 
 	if (power_get_lcore_mapped_cpu_id(lcore_id, &pi->lcore_id) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u", lcore_id);
+		RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u\n", lcore_id);
 		return -1;
 	}
 
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 8ffb49ef8f..ee0c264c8d 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -211,8 +211,8 @@ int power_get_lcore_mapped_cpu_id(uint32_t lcore_id, uint32_t *cpu_id)
 
 	lcore_cpus = rte_lcore_cpuset(lcore_id);
 	if (CPU_COUNT(&lcore_cpus) != 1) {
-		RTE_LOG(ERR, POWER, "Power library does not support lcore %u mapping to %u CPUs", lcore_id,
-			CPU_COUNT(&lcore_cpus));
+		RTE_LOG(ERR, POWER, "Power library does not support lcore %u mapping to %u CPUs\n",
+			lcore_id, CPU_COUNT(&lcore_cpus));
 		return -1;
 	}
 
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 890875bd93..fa9ef2aa8a 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -565,7 +565,7 @@ power_pstate_cpufreq_init(unsigned int lcore_id)
 	}
 
 	if (power_get_lcore_mapped_cpu_id(lcore_id, &pi->lcore_id) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u", lcore_id);
+		RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u\n", lcore_id);
 		return -1;
 	}
 
-- 
2.47.0


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

* Re: [23.11 2/2] power: fix log message when checking lcore ID
  2024-12-12 13:23 ` [23.11 2/2] power: fix log message when checking lcore ID David Marchand
@ 2024-12-12 14:08   ` Xueming Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xueming Li @ 2024-12-12 14:08 UTC (permalink / raw)
  To: David Marchand, stable

[-- Attachment #1: Type: text/plain, Size: 2746 bytes --]

Hi David,

Thanks for the fixes, will apply and create a new tag for it.

________________________________
From: David Marchand <david.marchand@redhat.com>
Sent: Thursday, December 12, 2024 9:23 PM
To: stable@dpdk.org <stable@dpdk.org>; Xueming Li <xuemingl@nvidia.com>
Subject: [23.11 2/2] power: fix log message when checking lcore ID

Caught while inspecting changes backported in 23.11 LTS branch.
The POWER_LOG() macro in the main branch automatically appends a \n
which is not done by RTE_LOG().

Fixes: 1afa4c7c5ea6 ("power: fix mapped lcore ID")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/power/power_amd_pstate_cpufreq.c | 2 +-
 lib/power/power_common.c             | 4 ++--
 lib/power/power_pstate_cpufreq.c     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/power/power_amd_pstate_cpufreq.c b/lib/power/power_amd_pstate_cpufreq.c
index 7b8e77003f..ff63e91183 100644
--- a/lib/power/power_amd_pstate_cpufreq.c
+++ b/lib/power/power_amd_pstate_cpufreq.c
@@ -377,7 +377,7 @@ power_amd_pstate_cpufreq_init(unsigned int lcore_id)
         }

         if (power_get_lcore_mapped_cpu_id(lcore_id, &pi->lcore_id) < 0) {
-               RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u", lcore_id);
+               RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u\n", lcore_id);
                 return -1;
         }

diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 8ffb49ef8f..ee0c264c8d 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -211,8 +211,8 @@ int power_get_lcore_mapped_cpu_id(uint32_t lcore_id, uint32_t *cpu_id)

         lcore_cpus = rte_lcore_cpuset(lcore_id);
         if (CPU_COUNT(&lcore_cpus) != 1) {
-               RTE_LOG(ERR, POWER, "Power library does not support lcore %u mapping to %u CPUs", lcore_id,
-                       CPU_COUNT(&lcore_cpus));
+               RTE_LOG(ERR, POWER, "Power library does not support lcore %u mapping to %u CPUs\n",
+                       lcore_id, CPU_COUNT(&lcore_cpus));
                 return -1;
         }

diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 890875bd93..fa9ef2aa8a 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -565,7 +565,7 @@ power_pstate_cpufreq_init(unsigned int lcore_id)
         }

         if (power_get_lcore_mapped_cpu_id(lcore_id, &pi->lcore_id) < 0) {
-               RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u", lcore_id);
+               RTE_LOG(ERR, POWER, "Cannot get CPU ID mapped for lcore %u\n", lcore_id);
                 return -1;
         }

--
2.47.0


[-- Attachment #2: Type: text/html, Size: 5746 bytes --]

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

end of thread, other threads:[~2024-12-12 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12 13:23 [23.11 1/2] log: remove per line log helper David Marchand
2024-12-12 13:23 ` [23.11 2/2] power: fix log message when checking lcore ID David Marchand
2024-12-12 14:08   ` Xueming Li

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).