DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll
@ 2019-07-24 17:20 Stephen Hemminger
  2020-07-14  5:41 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stephen Hemminger @ 2019-07-24 17:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The existing definition of rte_epoll_wait retries if interrupted
by a signal. This behavior makes it hard to use rte_epoll_wait
for applications that want to use signals do do things like
exit polling loop and shutdown.

Since changing existing semantic might break applications, add
a new rte_epoll_wait_interruptible() function that does the
same thing as rte_epoll_wait but will return -1 and errno of EINTR
if it receives a signal.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 .../common/include/rte_eal_interrupts.h       | 23 +++++++++
 lib/librte_eal/freebsd/eal/eal_interrupts.c   | 12 +++++
 lib/librte_eal/linux/eal/eal_interrupts.c     | 47 ++++++++++++-------
 lib/librte_eal/rte_eal_version.map            |  1 +
 4 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_eal_interrupts.h b/lib/librte_eal/common/include/rte_eal_interrupts.h
index b370c0d26458..ac1c830f37a1 100644
--- a/lib/librte_eal/common/include/rte_eal_interrupts.h
+++ b/lib/librte_eal/common/include/rte_eal_interrupts.h
@@ -87,6 +87,7 @@ struct rte_intr_handle {
 
 /**
  * It waits for events on the epoll instance.
+ * Retries if signal received.
  *
  * @param epfd
  *   Epoll instance fd on which the caller wait for events.
@@ -105,6 +106,28 @@ int
 rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	       int maxevents, int timeout);
 
+/**
+ * It waits for events on the epoll instance.
+ * Does not retry if signal received.
+ *
+ * @param epfd
+ *   Epoll instance fd on which the caller wait for events.
+ * @param events
+ *   Memory area contains the events that will be available for the caller.
+ * @param maxevents
+ *   Up to maxevents are returned, must greater than zero.
+ * @param timeout
+ *   Specifying a timeout of -1 causes a block indefinitely.
+ *   Specifying a timeout equal to zero cause to return immediately.
+ * @return
+ *   - On success, returns the number of available event.
+ *   - On failure, a negative value.
+ */
+__rte_experimental
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout);
+
 /**
  * It performs control operations on epoll instance referred by the epfd.
  * It requests that the operation op be performed for the target fd.
diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c b/lib/librte_eal/freebsd/eal/eal_interrupts.c
index f6831b7902c5..d3f8fd78a1ee 100644
--- a/lib/librte_eal/freebsd/eal/eal_interrupts.c
+++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c
@@ -649,6 +649,18 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	return -ENOTSUP;
 }
 
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+			     int maxevents, int timeout)
+{
+	RTE_SET_USED(epfd);
+	RTE_SET_USED(events);
+	RTE_SET_USED(maxevents);
+	RTE_SET_USED(timeout);
+
+	return -ENOTSUP;
+}
+
 int
 rte_epoll_ctl(int epfd, int op, int fd, struct rte_epoll_event *event)
 {
diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c
index 1955324d3045..b6ae12a282e7 100644
--- a/lib/librte_eal/linux/eal/eal_interrupts.c
+++ b/lib/librte_eal/linux/eal/eal_interrupts.c
@@ -1239,9 +1239,9 @@ rte_intr_tls_epfd(void)
 	return RTE_PER_LCORE(_epfd);
 }
 
-int
-rte_epoll_wait(int epfd, struct rte_epoll_event *events,
-	       int maxevents, int timeout)
+static int
+eal_epoll_wait(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout, bool interruptible)
 {
 	struct epoll_event evs[maxevents];
 	int rc;
@@ -1255,29 +1255,40 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	if (epfd == RTE_EPOLL_PER_THREAD)
 		epfd = rte_intr_tls_epfd();
 
-	while (1) {
-		rc = epoll_wait(epfd, evs, maxevents, timeout);
-		if (likely(rc > 0)) {
-			/* epoll_wait has at least one fd ready to read */
-			rc = eal_epoll_process_event(evs, rc, events);
-			break;
-		} else if (rc < 0) {
-			if (errno == EINTR)
-				continue;
+retry:
+	rc = epoll_wait(epfd, evs, maxevents, timeout);
+	if (likely(rc > 0)) {
+		/* epoll_wait has at least one fd ready to read */
+		rc = eal_epoll_process_event(evs, rc, events);
+	} else if (rc < 0) {
+		if (errno == EINTR) {
+			if (!interruptible)
+				goto retry;
+		} else {
 			/* epoll_wait fail */
-			RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
+			RTE_LOG(ERR, EAL,
+				"epoll_wait returns with fail %s\n",
 				strerror(errno));
-			rc = -1;
-			break;
-		} else {
-			/* rc == 0, epoll_wait timed out */
-			break;
 		}
 	}
 
 	return rc;
 }
 
+int
+rte_epoll_wait(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout)
+{
+	return eal_epoll_wait(epfd, events, maxevents, timeout, false);
+}
+
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+			     int maxevents, int timeout)
+{
+	return eal_epoll_wait(epfd, events, maxevents, timeout, true);
+}
+
 static inline void
 eal_epoll_data_safe_free(struct rte_epoll_event *ev)
 {
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 234487787994..e1aeb99ba9c8 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -331,6 +331,7 @@ EXPERIMENTAL {
 	rte_dev_hotplug_handle_enable;
 	rte_dev_iterator_init;
 	rte_dev_iterator_next;
+	rte_epoll_wait_interruptible;
 	rte_extmem_attach;
 	rte_extmem_detach;
 	rte_extmem_register;
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll
  2019-07-24 17:20 [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll Stephen Hemminger
@ 2020-07-14  5:41 ` Stephen Hemminger
  2020-07-15 15:39   ` Harman Kalra
  2020-07-14 19:50 ` Honnappa Nagarahalli
  2020-09-03 23:28 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
  2 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2020-07-14  5:41 UTC (permalink / raw)
  To: dev

On Wed, 24 Jul 2019 10:20:37 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> The existing definition of rte_epoll_wait retries if interrupted
> by a signal. This behavior makes it hard to use rte_epoll_wait
> for applications that want to use signals do do things like
> exit polling loop and shutdown.
> 
> Since changing existing semantic might break applications, add
> a new rte_epoll_wait_interruptible() function that does the
> same thing as rte_epoll_wait but will return -1 and errno of EINTR
> if it receives a signal.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

This patch has been sitting unreviewed, uncommented, and unmerged for
two releases. It seems only patches from HW vendors get the attention.

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

* Re: [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll
  2019-07-24 17:20 [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll Stephen Hemminger
  2020-07-14  5:41 ` Stephen Hemminger
@ 2020-07-14 19:50 ` Honnappa Nagarahalli
  2020-09-03 23:28 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
  2 siblings, 0 replies; 8+ messages in thread
From: Honnappa Nagarahalli @ 2020-07-14 19:50 UTC (permalink / raw)
  To: Stephen Hemminger, dev; +Cc: nd, Honnappa Nagarahalli, nd

Hi Stephen,
	Looks good overall, few nits inline.

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Wednesday, July 24, 2019 12:21 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH] eal/interrupts: add function to allow
> interruptible epoll
> 
> The existing definition of rte_epoll_wait retries if interrupted by a signal.
> This behavior makes it hard to use rte_epoll_wait for applications that want
> to use signals do do things like exit polling loop and shutdown.
nit                        ^^ to

> 
> Since changing existing semantic might break applications, add a new
> rte_epoll_wait_interruptible() function that does the same thing as
> rte_epoll_wait but will return -1 and errno of EINTR if it receives a signal.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  .../common/include/rte_eal_interrupts.h       | 23 +++++++++
>  lib/librte_eal/freebsd/eal/eal_interrupts.c   | 12 +++++
>  lib/librte_eal/linux/eal/eal_interrupts.c     | 47 ++++++++++++-------
>  lib/librte_eal/rte_eal_version.map            |  1 +
Can you rebase with the master? It will help me apply this cleanly.

>  4 files changed, 65 insertions(+), 18 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_eal_interrupts.h
> b/lib/librte_eal/common/include/rte_eal_interrupts.h
> index b370c0d26458..ac1c830f37a1 100644
> --- a/lib/librte_eal/common/include/rte_eal_interrupts.h
> +++ b/lib/librte_eal/common/include/rte_eal_interrupts.h
> @@ -87,6 +87,7 @@ struct rte_intr_handle {
> 
>  /**
>   * It waits for events on the epoll instance.
> + * Retries if signal received.
>   *
>   * @param epfd
>   *   Epoll instance fd on which the caller wait for events.
> @@ -105,6 +106,28 @@ int
>  rte_epoll_wait(int epfd, struct rte_epoll_event *events,
>  	       int maxevents, int timeout);
> 
> +/**
> + * It waits for events on the epoll instance.
> + * Does not retry if signal received.
> + *
> + * @param epfd
> + *   Epoll instance fd on which the caller wait for events.
> + * @param events
> + *   Memory area contains the events that will be available for the caller.
> + * @param maxevents
> + *   Up to maxevents are returned, must greater than zero.
> + * @param timeout
It would be good to mention the units here, but might add complexities depending on the functionality supported by the underlying OS.

> + *   Specifying a timeout of -1 causes a block indefinitely.
> + *   Specifying a timeout equal to zero cause to return immediately.
> + * @return
> + *   - On success, returns the number of available event.
> + *   - On failure, a negative value.
> + */
> +__rte_experimental
> +int
> +rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
> +	       int maxevents, int timeout);
> +
>  /**
>   * It performs control operations on epoll instance referred by the epfd.
>   * It requests that the operation op be performed for the target fd.
> diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c
> b/lib/librte_eal/freebsd/eal/eal_interrupts.c
> index f6831b7902c5..d3f8fd78a1ee 100644
> --- a/lib/librte_eal/freebsd/eal/eal_interrupts.c
> +++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c
> @@ -649,6 +649,18 @@ rte_epoll_wait(int epfd, struct rte_epoll_event
> *events,
>  	return -ENOTSUP;
>  }
> 
> +int
> +rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
> +			     int maxevents, int timeout)
> +{
> +	RTE_SET_USED(epfd);
> +	RTE_SET_USED(events);
> +	RTE_SET_USED(maxevents);
> +	RTE_SET_USED(timeout);
> +
> +	return -ENOTSUP;
> +}
> +
>  int
>  rte_epoll_ctl(int epfd, int op, int fd, struct rte_epoll_event *event)  { diff --
> git a/lib/librte_eal/linux/eal/eal_interrupts.c
> b/lib/librte_eal/linux/eal/eal_interrupts.c
> index 1955324d3045..b6ae12a282e7 100644
> --- a/lib/librte_eal/linux/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linux/eal/eal_interrupts.c
> @@ -1239,9 +1239,9 @@ rte_intr_tls_epfd(void)
>  	return RTE_PER_LCORE(_epfd);
>  }
> 
> -int
> -rte_epoll_wait(int epfd, struct rte_epoll_event *events,
> -	       int maxevents, int timeout)
> +static int
> +eal_epoll_wait(int epfd, struct rte_epoll_event *events,
> +	       int maxevents, int timeout, bool interruptible)
>  {
>  	struct epoll_event evs[maxevents];
>  	int rc;
> @@ -1255,29 +1255,40 @@ rte_epoll_wait(int epfd, struct rte_epoll_event
> *events,
>  	if (epfd == RTE_EPOLL_PER_THREAD)
>  		epfd = rte_intr_tls_epfd();
> 
> -	while (1) {
> -		rc = epoll_wait(epfd, evs, maxevents, timeout);
> -		if (likely(rc > 0)) {
> -			/* epoll_wait has at least one fd ready to read */
> -			rc = eal_epoll_process_event(evs, rc, events);
> -			break;
> -		} else if (rc < 0) {
> -			if (errno == EINTR)
> -				continue;
> +retry:
I guess it is a personal choice. I personally prefer using goto for error handling.

> +	rc = epoll_wait(epfd, evs, maxevents, timeout);
> +	if (likely(rc > 0)) {
> +		/* epoll_wait has at least one fd ready to read */
> +		rc = eal_epoll_process_event(evs, rc, events);
> +	} else if (rc < 0) {
> +		if (errno == EINTR) {
> +			if (!interruptible)
> +				goto retry;
> +		} else {
>  			/* epoll_wait fail */
> -			RTE_LOG(ERR, EAL, "epoll_wait returns with
> fail %s\n",
> +			RTE_LOG(ERR, EAL,
> +				"epoll_wait returns with fail %s\n",
>  				strerror(errno));
> -			rc = -1;
> -			break;
> -		} else {
> -			/* rc == 0, epoll_wait timed out */
> -			break;
>  		}
>  	}
> 
>  	return rc;
>  }
> 
> +int
> +rte_epoll_wait(int epfd, struct rte_epoll_event *events,
> +	       int maxevents, int timeout)
> +{
> +	return eal_epoll_wait(epfd, events, maxevents, timeout, false); }
> +
> +int
> +rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
> +			     int maxevents, int timeout)
> +{
> +	return eal_epoll_wait(epfd, events, maxevents, timeout, true); }
> +
>  static inline void
>  eal_epoll_data_safe_free(struct rte_epoll_event *ev)  { diff --git
> a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index 234487787994..e1aeb99ba9c8 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -331,6 +331,7 @@ EXPERIMENTAL {
>  	rte_dev_hotplug_handle_enable;
>  	rte_dev_iterator_init;
>  	rte_dev_iterator_next;
> +	rte_epoll_wait_interruptible;
>  	rte_extmem_attach;
>  	rte_extmem_detach;
>  	rte_extmem_register;
> --
> 2.20.1


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

* Re: [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll
  2020-07-14  5:41 ` Stephen Hemminger
@ 2020-07-15 15:39   ` Harman Kalra
  0 siblings, 0 replies; 8+ messages in thread
From: Harman Kalra @ 2020-07-15 15:39 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Mon, Jul 13, 2020 at 10:41:33PM -0700, Stephen Hemminger wrote:
> On Wed, 24 Jul 2019 10:20:37 -0700
> Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> > The existing definition of rte_epoll_wait retries if interrupted
> > by a signal. This behavior makes it hard to use rte_epoll_wait
> > for applications that want to use signals do do things like
> > exit polling loop and shutdown.
> > 
> > Since changing existing semantic might break applications, add
> > a new rte_epoll_wait_interruptible() function that does the
> > same thing as rte_epoll_wait but will return -1 and errno of EINTR
> > if it receives a signal.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Reviewed-by: Harman Kalra <hkalra@marvell.com>

Hi Stephen,

  I have reviewed and tested the patch, looks good to me.
  Can you please rebase the patch to latest tree.

Thanks
Harman


> 
> This patch has been sitting unreviewed, uncommented, and unmerged for
> two releases. It seems only patches from HW vendors get the attention.

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

* [dpdk-dev] [PATCH v2] eal/interrupts: add function to allow interruptible epoll
  2019-07-24 17:20 [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll Stephen Hemminger
  2020-07-14  5:41 ` Stephen Hemminger
  2020-07-14 19:50 ` Honnappa Nagarahalli
@ 2020-09-03 23:28 ` Stephen Hemminger
  2020-09-14  8:56   ` David Marchand
  2020-10-19 10:15   ` Thomas Monjalon
  2 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2020-09-03 23:28 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Harman Kalra

The existing definition of rte_epoll_wait retries if interrupted
by a signal. This behavior makes it hard to use rte_epoll_wait
for applications that want to use signals do do things like
exit polling loop and shutdown.

Since changing existing semantic might break applications, add
a new rte_epoll_wait_interruptible() function that does the
same thing as rte_epoll_wait but will return -1 and errno of EINTR
if it receives a signal.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Harman Kalra <hkalra@marvell.com>
---
v2 -- rebase onto current code organization
      simplify logic to make it clear how common the code is

      Note: the documentation of the new version is intentionally the
      the same as the original one.

 lib/librte_eal/freebsd/eal_interrupts.c     | 12 +++++++++
 lib/librte_eal/include/rte_eal_interrupts.h | 23 +++++++++++++++++
 lib/librte_eal/linux/eal_interrupts.c       | 28 +++++++++++++++++----
 lib/librte_eal/rte_eal_version.map          |  3 +++
 4 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/freebsd/eal_interrupts.c b/lib/librte_eal/freebsd/eal_interrupts.c
index 6d53d33c81a9..b07cff639318 100644
--- a/lib/librte_eal/freebsd/eal_interrupts.c
+++ b/lib/librte_eal/freebsd/eal_interrupts.c
@@ -684,6 +684,18 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	return -ENOTSUP;
 }
 
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+			     int maxevents, int timeout)
+{
+	RTE_SET_USED(epfd);
+	RTE_SET_USED(events);
+	RTE_SET_USED(maxevents);
+	RTE_SET_USED(timeout);
+
+	return -ENOTSUP;
+}
+
 int
 rte_epoll_ctl(int epfd, int op, int fd, struct rte_epoll_event *event)
 {
diff --git a/lib/librte_eal/include/rte_eal_interrupts.h b/lib/librte_eal/include/rte_eal_interrupts.h
index b1e8a2934e78..7d808a22624a 100644
--- a/lib/librte_eal/include/rte_eal_interrupts.h
+++ b/lib/librte_eal/include/rte_eal_interrupts.h
@@ -87,6 +87,7 @@ struct rte_intr_handle {
 
 /**
  * It waits for events on the epoll instance.
+ * Retries if signal received.
  *
  * @param epfd
  *   Epoll instance fd on which the caller wait for events.
@@ -105,6 +106,28 @@ int
 rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	       int maxevents, int timeout);
 
+/**
+ * It waits for events on the epoll instance.
+ * Does not retry if signal received.
+ *
+ * @param epfd
+ *   Epoll instance fd on which the caller wait for events.
+ * @param events
+ *   Memory area contains the events that will be available for the caller.
+ * @param maxevents
+ *   Up to maxevents are returned, must greater than zero.
+ * @param timeout
+ *   Specifying a timeout of -1 causes a block indefinitely.
+ *   Specifying a timeout equal to zero cause to return immediately.
+ * @return
+ *   - On success, returns the number of available event.
+ *   - On failure, a negative value.
+ */
+__rte_experimental
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout);
+
 /**
  * It performs control operations on epoll instance referred by the epfd.
  * It requests that the operation op be performed for the target fd.
diff --git a/lib/librte_eal/linux/eal_interrupts.c b/lib/librte_eal/linux/eal_interrupts.c
index 13db5c4e8aee..26b5dd4ca86b 100644
--- a/lib/librte_eal/linux/eal_interrupts.c
+++ b/lib/librte_eal/linux/eal_interrupts.c
@@ -1275,9 +1275,9 @@ rte_intr_tls_epfd(void)
 	return RTE_PER_LCORE(_epfd);
 }
 
-int
-rte_epoll_wait(int epfd, struct rte_epoll_event *events,
-	       int maxevents, int timeout)
+static int
+eal_epoll_wait(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout, bool interruptible)
 {
 	struct epoll_event evs[maxevents];
 	int rc;
@@ -1298,8 +1298,12 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 			rc = eal_epoll_process_event(evs, rc, events);
 			break;
 		} else if (rc < 0) {
-			if (errno == EINTR)
-				continue;
+			if (errno == EINTR) {
+				if (interruptible)
+					return -1;
+				else
+					continue;
+			}
 			/* epoll_wait fail */
 			RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
 				strerror(errno));
@@ -1314,6 +1318,20 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events,
 	return rc;
 }
 
+int
+rte_epoll_wait(int epfd, struct rte_epoll_event *events,
+	       int maxevents, int timeout)
+{
+	return eal_epoll_wait(epfd, events, maxevents, timeout, false);
+}
+
+int
+rte_epoll_wait_interruptible(int epfd, struct rte_epoll_event *events,
+			     int maxevents, int timeout)
+{
+	return eal_epoll_wait(epfd, events, maxevents, timeout, true);
+}
+
 static inline void
 eal_epoll_data_safe_free(struct rte_epoll_event *ev)
 {
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 0b18e2ef85f9..a31a7cf5791a 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -397,6 +397,9 @@ EXPERIMENTAL {
 	rte_mp_disable;
 	rte_thread_register;
 	rte_thread_unregister;
+
+	# added in 20.11
+	rte_epoll_wait_interruptible;
 };
 
 INTERNAL {
-- 
2.27.0


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

* Re: [dpdk-dev] [PATCH v2] eal/interrupts: add function to allow interruptible epoll
  2020-09-03 23:28 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
@ 2020-09-14  8:56   ` David Marchand
  2020-09-14 16:39     ` Stephen Hemminger
  2020-10-19 10:15   ` Thomas Monjalon
  1 sibling, 1 reply; 8+ messages in thread
From: David Marchand @ 2020-09-14  8:56 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Harman Kalra

On Fri, Sep 4, 2020 at 1:28 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The existing definition of rte_epoll_wait retries if interrupted
> by a signal. This behavior makes it hard to use rte_epoll_wait
> for applications that want to use signals do do things like
> exit polling loop and shutdown.
>
> Since changing existing semantic might break applications, add
> a new rte_epoll_wait_interruptible() function that does the
> same thing as rte_epoll_wait but will return -1 and errno of EINTR
> if it receives a signal.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Reviewed-by: Harman Kalra <hkalra@marvell.com>

You will certainly argue that the existing function had no unit test
but we want to fix this at some point.
Can a unit test be added?


Thanks.

-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH v2] eal/interrupts: add function to allow interruptible epoll
  2020-09-14  8:56   ` David Marchand
@ 2020-09-14 16:39     ` Stephen Hemminger
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2020-09-14 16:39 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Harman Kalra

On Mon, 14 Sep 2020 10:56:33 +0200
David Marchand <david.marchand@redhat.com> wrote:

> On Fri, Sep 4, 2020 at 1:28 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > The existing definition of rte_epoll_wait retries if interrupted
> > by a signal. This behavior makes it hard to use rte_epoll_wait
> > for applications that want to use signals do do things like
> > exit polling loop and shutdown.
> >
> > Since changing existing semantic might break applications, add
> > a new rte_epoll_wait_interruptible() function that does the
> > same thing as rte_epoll_wait but will return -1 and errno of EINTR
> > if it receives a signal.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Reviewed-by: Harman Kalra <hkalra@marvell.com>  
> 
> You will certainly argue that the existing function had no unit test
> but we want to fix this at some point.
> Can a unit test be added?

The whole interrupt system really has no test, if it did then epoll
would be part of that.

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

* Re: [dpdk-dev] [PATCH v2] eal/interrupts: add function to allow interruptible epoll
  2020-09-03 23:28 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
  2020-09-14  8:56   ` David Marchand
@ 2020-10-19 10:15   ` Thomas Monjalon
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2020-10-19 10:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Harman Kalra

04/09/2020 01:28, Stephen Hemminger:
> The existing definition of rte_epoll_wait retries if interrupted
> by a signal. This behavior makes it hard to use rte_epoll_wait
> for applications that want to use signals do do things like
> exit polling loop and shutdown.
> 
> Since changing existing semantic might break applications, add
> a new rte_epoll_wait_interruptible() function that does the
> same thing as rte_epoll_wait but will return -1 and errno of EINTR
> if it receives a signal.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Reviewed-by: Harman Kalra <hkalra@marvell.com>

Applied, thanks



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

end of thread, other threads:[~2020-10-19 10:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 17:20 [dpdk-dev] [PATCH] eal/interrupts: add function to allow interruptible epoll Stephen Hemminger
2020-07-14  5:41 ` Stephen Hemminger
2020-07-15 15:39   ` Harman Kalra
2020-07-14 19:50 ` Honnappa Nagarahalli
2020-09-03 23:28 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2020-09-14  8:56   ` David Marchand
2020-09-14 16:39     ` Stephen Hemminger
2020-10-19 10:15   ` Thomas Monjalon

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