eal: create runtime dir even when shared data is not used
PATCH 1/1 eal: create runtime dir even when shared data is not used
When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
--- lib/eal/linux/eal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
lib/eal/linux/eal.c +2 -3
@@ -838,9 +838,8 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 && internal_conf->no_shconf ==0 ) {RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); ret =-1 ; goto out;
Signature · 1 line
2.30.2
Quoted 35 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, 1 July 2021 11.35When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the
unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of
DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.Signed-off-by Bruce Richardson <[email protected]>--- lib/eal/linux/eal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)lib/eal/linux/eal.c +1
-3@@ -838,9 +838,8 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { +/* create runtime data directory. In no_shconf mode, skip any errors */
lib/eal/linux/eal.c +1
-0+ if (eal_create_runtime_dir() < 0 && internal_conf->no_shconf ==0) {
lib/eal/linux/eal.c eal_parse_args(int argc, char **argv) · line 845
Quoted 3 lines
lib/eal/linux/eal.c +0
-0RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); ret =-1 ; goto out;
When internal_conf->no_shconf == 1 and eal_create_runtime_dir() fails, DPDK will run without telemetry. Shouldn't it then be logged that telemetry is unavailable (and why it is unavailable)?
Quoted 3 lines
--
2.30.2
Quoted 28 lines · Morten Brørup
Quoted 28 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, 1 July 2021 11.35When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the
unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of
DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.Signed-off-by Bruce Richardson <[email protected]>--- lib/eal/linux/eal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)lib/eal/linux/eal.c +0
-0@@ -838,9 +838,8 @@ eal_parse_args(int argc, char **argv) } }
Quoted 13 lines
lib/eal/linux/eal.c eal_parse_args(int argc, char **argv) · line 845
Quoted 10 lines
lib/eal/linux/eal.c +1
-3-/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { +/* create runtime data directory. In no_shconf mode, skip any errors */
lib/eal/linux/eal.c +1
-0+ if (eal_create_runtime_dir() < 0 && internal_conf->no_shconf ==0) {
lib/eal/linux/eal.c +0
-0RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); ret =-1 ; goto out;When
internal_conf->no_shconf== 1 andeal_create_runtime_dir()fails, DPDK will run without telemetry. Shouldn't it then be logged that telemetry is unavailable (and why it is unavailable)?
There will be an error printed from the telemetry library about the socket creation failing. However, it probably could do with being improved. I'll see about creating a separate patch for that, since EAL should not be required to know about what other libs may need a runtime dir or not.
/Bruce
PATCH v2 1/2 eal: create runtime dir even when shared data is not used
In reply to Bruce RichardsonWhen multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
---
V2: add a warning for the no-shconf case, rather than skipping it silently.
lib/eal/linux/eal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
lib/eal/linux/eal.c +8 -6
@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }if (eal_adjust_config (internal_conf) !=0 ) {
--
2.30.2
PATCH v2 2/2 telemetry: add extra log message on socket bind failure
If the library fails to create the needed socket, add an additional check to report if the error is due to a missing DPDK runtime dir.
--- lib/telemetry/telemetry.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/telemetry/telemetry.c +5 -0
@@ -7,6 +7,7 @@#include <pthread.h> #include <sys/socket.h> #include <sys/un.h> +#include <sys/stat.h> #include <dlfcn.h> #endif /* !RTE_EXEC_ENV_WINDOWS */
@@ -422,7 +423,11 @@ create_socket(char *path)strlcpy (sun.sun_path, path,sizeof (sun.sun_path));unlink (sun.sun_path);if (bind (sock, (void *) &sun,sizeof (sun)) <0 ) { +struct stat st; +TMTY_LOG (ERR ,"Error binding socket: %s\n" ,strerror (errno)); +if (stat (socket_dir, &st) <0 || !S_ISDIR (st.st_mode)) +TMTY_LOG (ERR ,"Cannot access DPDK runtime directory: %s\n" , socket_dir); sun.sun_path[0 ] =0 ; goto error; }
--
2.30.2
Re: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
Quoted 38 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, 2 July 2021 14.56If the library fails to create the needed socket, add an additional check to report if the error is due to a missing DPDK runtime dir.
Signed-off-by Bruce Richardson <[email protected]>--- lib/telemetry/telemetry.c | 5 +++++ 1 file changed, 5 insertions(+)lib/telemetry/telemetry.c +5
-0@@ -7,6 +7,7 @@#include <pthread.h> #include <sys/socket.h> #include <sys/un.h> +#include <sys/stat.h> #include <dlfcn.h> #endif /* !RTE_EXEC_ENV_WINDOWS */ @@ -422,7 +423,11 @@ create_socket(char *path)strlcpy (sun.sun_path, path,sizeof (sun.sun_path));unlink (sun.sun_path);if (bind (sock, (void *) &sun,sizeof (sun)) <0 ) { +struct stat st; +TMTY_LOG (ERR ,"Error binding socket: %s\n" ,strerror (errno)); +if (stat (socket_dir, &st) <0 || !S_ISDIR (st.st_mode)) + TMTY_LOG(ERR, "Cannot access DPDK runtime directory: %s\n", socket_dir); sun.sun_path[0] = 0;lib/telemetry/telemetry.c +0
-1goto error; } --
Quoted 2 lines
2.30.2
Power, Ciara
Acked-byRe: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
Quoted 19 lines
-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Friday 2 July 2021 15:23
To: Richardson, Bruce <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failureQuoted 11 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, 2 July 2021 14.56If the library fails to create the needed socket, add an additional check to report if the error is due to a missing DPDK runtime dir.
Signed-off-by Bruce Richardson <[email protected]>--- lib/telemetry/telemetry.c | 5 +++++ 1 file changed, 5 insertions(+)
<snip>
Quoted 2 lines
Quoted 1 line
Acked-by Morten Brørup <[email protected]>
Re: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
In reply to Bruce RichardsonQuoted 5 lines · Bruce Richardson
If the library fails to create the needed socket, add an additional check to report if the error is due to a missing DPDK runtime dir.
Signed-off-by Bruce Richardson <[email protected]>
Signature · 1 line
David Marchand
Quoted 53 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, 2 July 2021 14.56
To: [email protected]When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the
unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of
DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.Signed-off-by Bruce Richardson <[email protected]>---
V2: add a warning for the no-shconf case, rather than skipping it silently.lib/eal/linux/eal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)lib/eal/linux/eal.c +1
-6@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */
lib/eal/linux/eal.c +3
-0+if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { + RTE_LOG(ERR, EAL, "Cannot create runtimedirectory\n");
lib/eal/linux/eal.c +4
-0+ ret =-1 ; + goto out; + }else + RTE_LOG(WARNING, EAL, "No DPDK runtime directorycreated\n");
lib/eal/linux/eal.c +0
-1}if (eal_adjust_config (internal_conf) !=0 ) { --
Quoted 2 lines
2.30.2
Quoted 44 lines · Bruce Richardson
When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
Signed-off-by Bruce Richardson <[email protected]>---
V2: add a warning for the no-shconf case, rather than skipping it silently.lib/eal/linux/eal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)lib/eal/linux/eal.c +8
-7@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }if (eal_adjust_config (internal_conf) !=0 ) { --
Quoted 2 lines
2.30.2
Should this change be applied to FreeBSD too?
Signature · 1 line
David Marchand
Quoted 44 lines · David Marchand
Quoted 42 lines · Bruce Richardson
When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
Signed-off-by Bruce Richardson <[email protected]>---
V2: add a warning for the no-shconf case, rather than skipping it silently.lib/eal/linux/eal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)lib/eal/linux/eal.c +8
-6@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }
Quoted 9 lines
Quoted 4 lines
lib/eal/linux/eal.c +0
-1if (eal_adjust_config (internal_conf) !=0 ) { --2.30.2
Should this change be applied to FreeBSD too?
Reviewed-by David Marchand <[email protected]>
Yes it should. :-( For some reason I assumed that this would not be relevant for FreeBSD, but I obviously should have double-checked the code!
Quoted 4 lines · Bruce Richardson
Quoted 2 lines
Should this change be applied to FreeBSD too?
Yes it should. :-( For some reason I assumed that this would not be relevant for FreeBSD, but I obviously should have double-checked the code!
Ok, how do you want to handle it?
Should I go with this revision and you send a followup patch for FreeBSD after rc1?
Or can you send a v2 this afternoon?
This series does not seem that risky, so we could wait for rc2 too.
Signature · 1 line
David Marchand
Quoted 7 lines · David Marchand
Quoted 4 lines · Bruce Richardson
Quoted 2 lines
Should this change be applied to FreeBSD too?
Yes it should. :-( For some reason I assumed that this would not be relevant for FreeBSD, but I obviously should have double-checked the code!
Quoted 8 lines
Ok, how do you want to handle it?
Should I go with this revision and you send a followup patch for FreeBSD after rc1?
Or can you send a v2 this afternoon?This series does not seem that risky, so we could wait for rc2 too.
I'll send a v2 this afternoon.
Quoted 10 lines · Bruce Richardson
When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>---
Quoted 11 lines
V2: add a warning for the no-shconf case, rather than skipping it silently.
lib/eal/linux/eal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)lib/eal/linux/eal.c +0
-0@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) }
lib/eal/linux/eal.c eal_parse_args(int argc, char **argv) · line 842
Quoted 10 lines
lib/eal/linux/eal.c +2
-6} -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) {
nit: suggest explicit comparison against -1 instead of < 0
Quoted 11 lines
lib/eal/linux/eal.c +6
-1+if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }if (eal_adjust_config (internal_conf) !=0 ) { --2.30.2
PATCH v3 1/2 eal: create runtime dir even when shared data is not used
In reply to Bruce RichardsonWhen multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
---
V3: added freebsd EAL changes.
--- lib/eal/freebsd/eal.c | 14 ++++++++------ lib/eal/linux/eal.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-)
lib/eal/freebsd/eal.c +8 -6
@@ -575,12 +575,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }if (eal_adjust_config (internal_conf) !=0 ) {
lib/eal/linux/eal.c +8 -6
@@ -838,12 +838,14 @@ eal_parse_args(int argc, char **argv) } } -/* create runtime data directory */ -if (internal_conf->no_shconf ==0 && -eal_create_runtime_dir () <0 ) { -RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); - ret =-1 ; - goto out; +/* create runtime data directory. In no_shconf mode, skip any errors */ +if (eal_create_runtime_dir () <0 ) { +if (internal_conf->no_shconf ==0 ) { +RTE_LOG (ERR ,EAL ,"Cannot create runtime directory\n" ); + ret =-1 ; + goto out; + }else +RTE_LOG (WARNING ,EAL ,"No DPDK runtime directory created\n" ); }if (eal_adjust_config (internal_conf) !=0 ) {
Signature · 1 line
2.30.2
PATCH v3 2/2 telemetry: add extra log message on socket bind failure
If the library fails to create the needed socket, add an additional check to report if the error is due to a missing DPDK runtime dir.
--- lib/telemetry/telemetry.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/telemetry/telemetry.c +5 -0
@@ -7,6 +7,7 @@#include <pthread.h> #include <sys/socket.h> #include <sys/un.h> +#include <sys/stat.h> #include <dlfcn.h> #endif /* !RTE_EXEC_ENV_WINDOWS */
@@ -422,7 +423,11 @@ create_socket(char *path)strlcpy (sun.sun_path, path,sizeof (sun.sun_path));unlink (sun.sun_path);if (bind (sock, (void *) &sun,sizeof (sun)) <0 ) { +struct stat st; +TMTY_LOG (ERR ,"Error binding socket: %s\n" ,strerror (errno)); +if (stat (socket_dir, &st) <0 || !S_ISDIR (st.st_mode)) +TMTY_LOG (ERR ,"Cannot access DPDK runtime directory: %s\n" , socket_dir); sun.sun_path[0 ] =0 ; goto error; }
Signature · 1 line
2.30.2
Quoted 11 lines · Bruce Richardson
When multi-process is not wanted and DPDK is run with the "no-shconf" flag, the telemetry library still needs a runtime directory to place the unix socket for telemetry connections. Therefore, rather than not creating the directory when this flag is set, we can change the code to attempt the creation anyway, but not error out if it fails. If it succeeds, then telemetry will be available, but if it fails, the rest of DPDK will run without telemetry. This ensures that the "in-memory" flag will allow DPDK to run even if the whole filesystem is read-only, for example.
Quoted 5 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Morten Brørup <[email protected]>Reviewed-by David Marchand <[email protected]>---
V3: added freebsd EAL changes.
Series applied, thanks.
Signature · 1 line
David Marchand