DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used
@ 2021-07-01  9:34 Bruce Richardson
  2021-07-01 14:43 ` Morten Brørup
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-01  9:34 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, 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 <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;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used
  2021-07-01  9:34 [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used Bruce Richardson
@ 2021-07-01 14:43 ` Morten Brørup
  2021-07-01 14:56   ` Bruce Richardson
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
  2021-07-07 12:52 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
  2 siblings, 1 reply; 17+ messages in thread
From: Morten Brørup @ 2021-07-01 14:43 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: anatoly.burakov

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used
  2021-07-01 14:43 ` Morten Brørup
@ 2021-07-01 14:56   ` Bruce Richardson
  0 siblings, 0 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-01 14:56 UTC (permalink / raw)
  To: Morten Brørup; +Cc: dev, anatoly.burakov

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-01  9:34 [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used Bruce Richardson
  2021-07-01 14:43 ` Morten Brørup
@ 2021-07-02 12:55 ` Bruce Richardson
  2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
                     ` (3 more replies)
  2021-07-07 12:52 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
  2 siblings, 4 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-02 12:55 UTC (permalink / raw)
  To: dev; +Cc: mb, 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 <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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
@ 2021-07-02 12:55   ` Bruce Richardson
  2021-07-02 14:22     ` Morten Brørup
  2021-07-05 14:11     ` David Marchand
  2021-07-02 14:21   ` [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used Morten Brørup
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-02 12:55 UTC (permalink / raw)
  To: dev; +Cc: mb, Bruce Richardson, Ciara Power

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 <bruce.richardson@intel.com>
---
 lib/telemetry/telemetry.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 6baba57ec2..8665db8d03 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
  2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
@ 2021-07-02 14:21   ` Morten Brørup
  2021-07-05 14:11   ` David Marchand
  2021-07-07 19:02   ` Tyler Retzlaff
  3 siblings, 0 replies; 17+ messages in thread
From: Morten Brørup @ 2021-07-02 14:21 UTC (permalink / raw)
  To: Bruce Richardson, dev

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
  2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
@ 2021-07-02 14:22     ` Morten Brørup
  2021-07-05 10:16       ` Power, Ciara
  2021-07-05 14:11     ` David Marchand
  1 sibling, 1 reply; 17+ messages in thread
From: Morten Brørup @ 2021-07-02 14:22 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: Ciara Power

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, 2 July 2021 14.56
> 
> 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 <bruce.richardson@intel.com>
> ---
>  lib/telemetry/telemetry.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
> index 6baba57ec2..8665db8d03 100644
> --- a/lib/telemetry/telemetry.c
> +++ b/lib/telemetry/telemetry.c
> @@ -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
> 
Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
  2021-07-02 14:22     ` Morten Brørup
@ 2021-07-05 10:16       ` Power, Ciara
  0 siblings, 0 replies; 17+ messages in thread
From: Power, Ciara @ 2021-07-05 10:16 UTC (permalink / raw)
  To: Morten Brørup, Richardson,  Bruce, dev

>-----Original Message-----
>From: Morten Brørup <mb@smartsharesystems.com>
>Sent: Friday 2 July 2021 15:23
>To: Richardson, Bruce <bruce.richardson@intel.com>; dev@dpdk.org
>Cc: Power, Ciara <ciara.power@intel.com>
>Subject: RE: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on
>socket bind failure
>
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
>> Sent: Friday, 2 July 2021 14.56
>>
>> 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 <bruce.richardson@intel.com>
>> ---
>>  lib/telemetry/telemetry.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
<snip>
>>
>Acked-by: Morten Brørup <mb@smartsharesystems.com>

Acked-by: Ciara Power <ciara.power@intel.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure
  2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
  2021-07-02 14:22     ` Morten Brørup
@ 2021-07-05 14:11     ` David Marchand
  1 sibling, 0 replies; 17+ messages in thread
From: David Marchand @ 2021-07-05 14:11 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Morten Brørup, Ciara Power

On Fri, Jul 2, 2021 at 2:56 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> 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 <bruce.richardson@intel.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
  2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
  2021-07-02 14:21   ` [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used Morten Brørup
@ 2021-07-05 14:11   ` David Marchand
  2021-07-05 14:39     ` Bruce Richardson
  2021-07-07 19:02   ` Tyler Retzlaff
  3 siblings, 1 reply; 17+ messages in thread
From: David Marchand @ 2021-07-05 14:11 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Morten Brørup

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>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-05 14:11   ` David Marchand
@ 2021-07-05 14:39     ` Bruce Richardson
  2021-07-07 12:35       ` David Marchand
  0 siblings, 1 reply; 17+ messages in thread
From: Bruce Richardson @ 2021-07-05 14:39 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Morten Brørup

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!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-05 14:39     ` Bruce Richardson
@ 2021-07-07 12:35       ` David Marchand
  2021-07-07 12:41         ` Bruce Richardson
  0 siblings, 1 reply; 17+ messages in thread
From: David Marchand @ 2021-07-07 12:35 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Morten Brørup

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.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-07 12:35       ` David Marchand
@ 2021-07-07 12:41         ` Bruce Richardson
  0 siblings, 0 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-07 12:41 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Morten Brørup

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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] eal: create runtime dir even when shared data is not used
  2021-07-01  9:34 [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used Bruce Richardson
  2021-07-01 14:43 ` Morten Brørup
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
@ 2021-07-07 12:52 ` Bruce Richardson
  2021-07-07 12:52   ` [dpdk-dev] [PATCH v3 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
  2021-07-07 15:00   ` [dpdk-dev] [PATCH v3 1/2] eal: create runtime dir even when shared data is not used David Marchand
  2 siblings, 2 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-07 12:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Morten Brørup, David Marchand

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>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
V3: added freebsd EAL changes.
---
 lib/eal/freebsd/eal.c | 14 ++++++++------
 lib/eal/linux/eal.c   | 14 ++++++++------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index f4d1676754..6cee5ae369 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -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) {
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index ba19fc6347..3577eaeaa4 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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] telemetry: add extra log message on socket bind failure
  2021-07-07 12:52 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
@ 2021-07-07 12:52   ` Bruce Richardson
  2021-07-07 15:00   ` [dpdk-dev] [PATCH v3 1/2] eal: create runtime dir even when shared data is not used David Marchand
  1 sibling, 0 replies; 17+ messages in thread
From: Bruce Richardson @ 2021-07-07 12:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, David Marchand, Morten Brørup, Ciara Power

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 <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Ciara Power <ciara.power@intel.com>
---
 lib/telemetry/telemetry.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 6baba57ec2..8665db8d03 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] eal: create runtime dir even when shared data is not used
  2021-07-07 12:52 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
  2021-07-07 12:52   ` [dpdk-dev] [PATCH v3 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
@ 2021-07-07 15:00   ` David Marchand
  1 sibling, 0 replies; 17+ messages in thread
From: David Marchand @ 2021-07-07 15:00 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Morten Brørup

On Wed, Jul 7, 2021 at 2:53 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>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> ---
> V3: added freebsd EAL changes.

Series applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used
  2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
                     ` (2 preceding siblings ...)
  2021-07-05 14:11   ` David Marchand
@ 2021-07-07 19:02   ` Tyler Retzlaff
  3 siblings, 0 replies; 17+ messages in thread
From: Tyler Retzlaff @ 2021-07-07 19:02 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, mb

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-07-07 19:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01  9:34 [dpdk-dev] [PATCH] eal: create runtime dir even when shared data is not used Bruce Richardson
2021-07-01 14:43 ` Morten Brørup
2021-07-01 14:56   ` Bruce Richardson
2021-07-02 12:55 ` [dpdk-dev] [PATCH v2 1/2] " Bruce Richardson
2021-07-02 12:55   ` [dpdk-dev] [PATCH v2 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
2021-07-02 14:22     ` Morten Brørup
2021-07-05 10:16       ` Power, Ciara
2021-07-05 14:11     ` David Marchand
2021-07-02 14:21   ` [dpdk-dev] [PATCH v2 1/2] eal: create runtime dir even when shared data is not used Morten Brørup
2021-07-05 14:11   ` David Marchand
2021-07-05 14:39     ` Bruce Richardson
2021-07-07 12:35       ` David Marchand
2021-07-07 12:41         ` Bruce Richardson
2021-07-07 19:02   ` Tyler Retzlaff
2021-07-07 12:52 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2021-07-07 12:52   ` [dpdk-dev] [PATCH v3 2/2] telemetry: add extra log message on socket bind failure Bruce Richardson
2021-07-07 15:00   ` [dpdk-dev] [PATCH v3 1/2] eal: create runtime dir even when shared data is not used David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).