eal: create runtime dir even when shared data is not used

Message ID 20210701093456.43426-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series eal: create runtime dir even when shared data is not used |

Checks

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

Commit Message

Bruce Richardson July 1, 2021, 9:34 a.m. UTC
  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 <bruce.richardson@intel.com>
---
 lib/eal/linux/eal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

Morten Brørup July 1, 2021, 2:43 p.m. UTC | #1
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> Sent: Thursday, 1 July 2021 11.35
> 
> 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 <bruce.richardson@intel.com>
> ---
>  lib/eal/linux/eal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index ba19fc6347..1e05ba3847 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -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;

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

> --
> 2.30.2
>
  
Bruce Richardson July 1, 2021, 2:56 p.m. UTC | #2
On Thu, Jul 01, 2021 at 04:43:48PM +0200, Morten Brørup wrote:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> > Sent: Thursday, 1 July 2021 11.35
> > 
> > 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 <bruce.richardson@intel.com>
> > ---
> >  lib/eal/linux/eal.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> > index ba19fc6347..1e05ba3847 100644
> > --- a/lib/eal/linux/eal.c
> > +++ b/lib/eal/linux/eal.c
> > @@ -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;
> 
> 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)?
> 
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

diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index ba19fc6347..1e05ba3847 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -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;