Skip to contentSkip to conversation

eal: add log to print dpdk version at start

PATCH NAK Aman Singh 5 participants 8 messages Sep 1, 2021 – Sep 6, 2021

lore
Share & tools
lore

Aman Singh

author
#0 lore raw

PATCH 1/1 eal: add log to print dpdk version at start

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +1 -1
index 6cee5ae369..a14a205f4d 100644
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/windows/eal.c +1 -0
index 3d8c520412..5e6d5d8930 100644
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
 	 */
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
 	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 17 lines · Aman Singh
Quoted 1 line

From the logs it is difficult to get the DPDK version

that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +0 -0
index 6cee5ae369..a14a205f4d 100644

lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 961

Quoted 5 lines
lib/eal/freebsd/eal.c +1 -1
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());

I'd say that it should be logged as the very first message.

I'd consider INFO or even NOTICE level for the message. INFO if we don't want to see it by default. NOTICE if we want. I'd vote for the notice.

May be a bit out of topic, but I'm a bit surprised that there is no common entry point for all OS and it is required to make it in 3 places.

Quoted 29 lines
lib/eal/freebsd/eal.c +0 -0
 	return fctret;
 }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/windows/eal.c +1 -0
index 3d8c520412..5e6d5d8930 100644
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
 	 */
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
 	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
#2 lore raw
In reply to Aman Singh
Quoted 5 lines · Aman Singh

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

Quoted 7 lines
---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Note: EAL already has the "-v" flag which prints the version number at startup.

#3 lore raw
Quoted 6 lines · Bruce Richardson
Quoted 5 lines · Aman Singh

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

Quoted 9 lines
Quoted 7 lines
---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Note: EAL already has the "-v" flag which prints the version number at startup.

More common usage is when -v (--version) is provided app prints the version and exits.

No strong opinion but it is possible to have the version output always as debug, and convert '-v' to log and exit.

#4 lore raw
In reply to Aman Singh
Quoted 43 lines · On Wed, 1 Sep 2021 11:48:21 +0530 Aman Singh <[email protected]> wrote:

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +1 -1
index 6cee5ae369..a14a205f4d 100644
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/windows/eal.c +0 -0
index 3d8c520412..5e6d5d8930 100644

lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 425

Quoted 7 lines
lib/eal/windows/eal.c +1 -0
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
 	 */
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
 	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 

NAK
DPDK is already too chatty at startup.

If your application needs it then do-it-yourself.

#5 lore raw
Quoted 41 lines · Stephen Hemminger
Quoted 38 lines · On Wed, 1 Sep 2021 11:48:21 +0530 Aman Singh <[email protected]> wrote:

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +1 -1
index 6cee5ae369..a14a205f4d 100644
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
Quoted 16 lines

lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 425

Quoted 12 lines
lib/eal/windows/eal.c +1 -0
index 3d8c520412..5e6d5d8930 100644
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
 	 */
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
 	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 

NAK
DPDK is already too chatty at startup.

Is it better if the log is 'debug', so it won't be visible by default? This can be useful to support customers, sometimes when there are multiple binaries around, it is hard to say version of them.
As Bruce reminded, '-v' eal option provides this feature, which is better than nothing, but it is not as useful if you are looking to an old log without actual binary.

Quoted 2 lines

If your application needs it then do-it-yourself.

Application may have its own versioning, which can be unrelated to the DPDK version numbers, this can be useful to get just DPDK version.

#6 lore raw
Quoted 65 lines · Ferruh Yigit
Quoted 41 lines · Stephen Hemminger
Quoted 38 lines · On Wed, 1 Sep 2021 11:48:21 +0530 Aman Singh <[email protected]> wrote:

From the logs it is difficult to get the DPDK version that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 lib/eal/windows/eal.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +1 -1
index 6cee5ae369..a14a205f4d 100644
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 
Quoted 16 lines

lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 425

Quoted 12 lines
lib/eal/windows/eal.c +1 -0
index 3d8c520412..5e6d5d8930 100644
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
 	 */
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
 	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
 	return fctret;
 }
 

NAK
DPDK is already too chatty at startup.

Is it better if the log is 'debug', so it won't be visible by default? This can be useful to support customers, sometimes when there are multiple binaries around, it is hard to say version of them.
As Bruce reminded, '-v' eal option provides this feature, which is better than nothing, but it is not as useful if you are looking to an old log without actual binary.

Quoted 5 lines
Quoted 2 lines

If your application needs it then do-it-yourself.

Application may have its own versioning, which can be unrelated to the DPDK version numbers, this can be useful to get just DPDK version.

I'd also point out that if you have a currently running DPDK binary and want to know the DPDK version number, just connect to the telemetry socket and it will tell you e.g.

   $ echo "quit" | sudo ./usertools/dpdk-telemetry.py
   Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
   {"version": "DPDK 21.11.0-rc0", "pid": 134894, "max_output_len": 16384}
   -->

$

/Bruce

#7 lore raw
Quoted 78 lines · Bruce Richardson
Quoted 64 lines · Ferruh Yigit
Quoted 41 lines · Stephen Hemminger
Quoted 38 lines · On Wed, 1 Sep 2021 11:48:21 +0530 Aman Singh <[email protected]> wrote:

From the logs it is difficult to get the DPDK version
that was used. So added a debug log to print the same. The log has been added in eal_init so it gets printed at startup for any application.

---
  lib/eal/freebsd/eal.c | 2 +-
  lib/eal/linux/eal.c   | 2 +-
  lib/eal/windows/eal.c | 1 +
  3 files changed, 3 insertions(+), 2 deletions(-)
lib/eal/freebsd/eal.c +1 -1
index 6cee5ae369..a14a205f4d 100644
@@ -958,7 +958,7 @@ rte_eal_init(int argc, char **argv)
  	}
 
  	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
  	return fctret;
  }
 
lib/eal/linux/eal.c +1 -1
index 3577eaeaa4..a50960cc78 100644
@@ -1332,7 +1332,7 @@ rte_eal_init(int argc, char **argv)
  	}
 
  	eal_mcfg_complete();
-
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
  	return fctret;
  }
 
Quoted 15 lines

lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 425

Quoted 12 lines
lib/eal/windows/eal.c +1 -0
index 3d8c520412..5e6d5d8930 100644
@@ -419,6 +419,7 @@ rte_eal_init(int argc, char **argv)
  	 */
  	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
  	rte_eal_mp_wait_lcore();
+	rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_EAL, "DPDK version: %s\n", rte_version());
  	return fctret;
  }
 

NAK
DPDK is already too chatty at startup.

Is it better if the log is 'debug', so it won't be visible by default? This can be useful to support customers, sometimes when there are multiple binaries around, it is hard to say version of them.
As Bruce reminded, '-v' eal option provides this feature, which is better than nothing, but it is not as useful if you are looking to an old log without actual binary.

Quoted 4 lines
Quoted 2 lines

If your application needs it then do-it-yourself.

Application may have its own versioning, which can be unrelated to the DPDK version numbers, this can be useful to get just DPDK version.

I'd also point out that if you have a currently running DPDK binary and want to know the DPDK version number, just connect to the telemetry socket and it will tell you e.g.

    $ echo "quit" | sudo ./usertools/dpdk-telemetry.py
    Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
    {"version": "DPDK 21.11.0-rc0", "pid": 134894, "max_output_len": 16384}
    -->
Quoted 4 lines
    $

/Bruce

Considering the EAL "-v" option which does the same job as this patch. Planning to drop this change for now.

Thanks
Aman