[v2,1/2] eal: create runtime dir even when shared data is not used

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson July 2, 2021, 12:55 p.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>
---
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(-)

--
2.30.2
  

Comments

Morten Brørup July 2, 2021, 2:21 p.m. UTC | #1
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, 2 July 2021 14.56
> To: dev@dpdk.org
> 
> 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>
> ---
> 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(-)
> 
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index ba19fc6347..ccb7535619 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -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
> 
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
  
David Marchand July 5, 2021, 2:11 p.m. UTC | #2
On Fri, Jul 2, 2021 at 2:56 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> 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>
> ---
> 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(-)
>
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index ba19fc6347..ccb7535619 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -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
>

Should this change be applied to FreeBSD too?

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Bruce Richardson July 5, 2021, 2:39 p.m. UTC | #3
On Mon, Jul 05, 2021 at 04:11:54PM +0200, David Marchand wrote:
> On Fri, Jul 2, 2021 at 2:56 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > 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>
> > ---
> > 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(-)
> >
> > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> > index ba19fc6347..ccb7535619 100644
> > --- a/lib/eal/linux/eal.c
> > +++ b/lib/eal/linux/eal.c
> > @@ -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
> >
> 
> Should this change be applied to FreeBSD too?
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
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!
  
David Marchand July 7, 2021, 12:35 p.m. UTC | #4
On Mon, Jul 5, 2021 at 4:39 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > 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.
  
Bruce Richardson July 7, 2021, 12:41 p.m. UTC | #5
On Wed, Jul 07, 2021 at 02:35:15PM +0200, David Marchand wrote:
> On Mon, Jul 5, 2021 at 4:39 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > 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.
> 
I'll send a v2 this afternoon.
  
Tyler Retzlaff July 7, 2021, 7:02 p.m. UTC | #6
On Fri, Jul 02, 2021 at 01:55:53PM +0100, Bruce Richardson wrote:
> 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>
> ---
Acked-By: Tyler Retzlaff <roretzla@linux.microsoft.com>

> 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(-)
> 
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index ba19fc6347..ccb7535619 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -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) {

nit: suggest explicit comparison against -1 instead of < 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

diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index ba19fc6347..ccb7535619 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -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) {