[3/3] eal: fix evaluation of log level option

Message ID 20210323101928.2403-4-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series Track log level changes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS

Commit Message

David Marchand March 23, 2021, 10:19 a.m. UTC
  --log-level option is handled early, no need to reevaluate it later in
EAL init.

Before:
$ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
  --log-level=lib.eal:debug \
  --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
  |& grep -i logtype.level

EAL: lib.eal logtype level changed from info to debug
EAL: lib.ethdev logtype level changed from info to debug
EAL: lib.ethdev logtype level changed from debug to info
EAL: lib.ethdev logtype level changed from info to debug
EAL: lib.ethdev logtype level changed from debug to info

After:
$ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
  --log-level=lib.eal:debug \
  --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
  |& grep -i logtype.level

EAL: lib.eal logtype level changed from info to debug
EAL: lib.ethdev logtype level changed from info to debug
EAL: lib.ethdev logtype level changed from debug to info

Fixes: 6c7216eefd63 ("eal: fix log level of early messages")
Fixes: 1c806ae5c3ac ("eal/windows: support command line options parsing")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_eal/freebsd/eal.c | 4 ++++
 lib/librte_eal/linux/eal.c   | 4 ++++
 lib/librte_eal/windows/eal.c | 4 ++++
 3 files changed, 12 insertions(+)
  

Comments

Thomas Monjalon March 23, 2021, 3:54 p.m. UTC | #1
23/03/2021 11:19, David Marchand:
> --log-level option is handled early, no need to reevaluate it later in
> EAL init.
> 
> Before:
> $ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
>   --log-level=lib.eal:debug \
>   --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
>   |& grep -i logtype.level
> 
> EAL: lib.eal logtype level changed from info to debug
> EAL: lib.ethdev logtype level changed from info to debug
> EAL: lib.ethdev logtype level changed from debug to info
> EAL: lib.ethdev logtype level changed from info to debug
> EAL: lib.ethdev logtype level changed from debug to info
> 
> After:
> $ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
>   --log-level=lib.eal:debug \
>   --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
>   |& grep -i logtype.level
> 
> EAL: lib.eal logtype level changed from info to debug
> EAL: lib.ethdev logtype level changed from info to debug
> EAL: lib.ethdev logtype level changed from debug to info
> 
> Fixes: 6c7216eefd63 ("eal: fix log level of early messages")
> Fixes: 1c806ae5c3ac ("eal/windows: support command line options parsing")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  
Lukasz Wojciechowski March 24, 2021, 9:45 a.m. UTC | #2
W dniu 23.03.2021 o 16:54, Thomas Monjalon pisze:
> 23/03/2021 11:19, David Marchand:
>> --log-level option is handled early, no need to reevaluate it later in
>> EAL init.
>>
>> Before:
>> $ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
>>    --log-level=lib.eal:debug \
>>    --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
>>    |& grep -i logtype.level
>>
>> EAL: lib.eal logtype level changed from info to debug
>> EAL: lib.ethdev logtype level changed from info to debug
>> EAL: lib.ethdev logtype level changed from debug to info
>> EAL: lib.ethdev logtype level changed from info to debug
>> EAL: lib.ethdev logtype level changed from debug to info
>>
>> After:
>> $ echo quit | ./build/app/test/dpdk-test --no-huge -m 512 \
>>    --log-level=lib.eal:debug \
>>    --log-level=lib.ethdev:debug --log-level=lib.ethdev:info \
>>    |& grep -i logtype.level
>>
>> EAL: lib.eal logtype level changed from info to debug
>> EAL: lib.ethdev logtype level changed from info to debug
>> EAL: lib.ethdev logtype level changed from debug to info
>>
>> Fixes: 6c7216eefd63 ("eal: fix log level of early messages")
>> Fixes: 1c806ae5c3ac ("eal/windows: support command line options parsing")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>
>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
  

Patch

diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 62320d610f..817961d8d6 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -521,6 +521,10 @@  eal_parse_args(int argc, char **argv)
 			goto out;
 		}
 
+		/* eal_log_level_parse() already handled this option */
+		if (opt == OPT_LOG_LEVEL_NUM)
+			continue;
+
 		ret = eal_parse_common_option(opt, optarg, internal_conf);
 		/* common parser is not happy */
 		if (ret < 0) {
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 9ffb4b3314..8070e0f632 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -704,6 +704,10 @@  eal_parse_args(int argc, char **argv)
 			goto out;
 		}
 
+		/* eal_log_level_parse() already handled this option */
+		if (opt == OPT_LOG_LEVEL_NUM)
+			continue;
+
 		ret = eal_parse_common_option(opt, optarg, internal_conf);
 		/* common parser is not happy */
 		if (ret < 0) {
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 2fc3d6141c..e3b6a6ea61 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -149,6 +149,10 @@  eal_parse_args(int argc, char **argv)
 			return -1;
 		}
 
+		/* eal_log_level_parse() already handled this option */
+		if (opt == OPT_LOG_LEVEL_NUM)
+			continue;
+
 		ret = eal_parse_common_option(opt, optarg, internal_conf);
 		/* common parser is not happy */
 		if (ret < 0) {