[dpdk-dev,v4,08/11] eal: replace rte_panic instances in interrupts thread

Message ID 1524117669-25729-9-git-send-email-arnon@qwilt.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Arnon Warshavsky April 19, 2018, 6:01 a.m. UTC
  replace panic calls with log and retrun value.
Thread function removes the noretrun attribute.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)
  

Comments

Kevin Traynor April 19, 2018, 5:27 p.m. UTC | #1
On 04/19/2018 07:01 AM, Arnon Warshavsky wrote:
> replace panic calls with log and retrun value.
> Thread function removes the noretrun attribute.
> 
> Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> index 58e9328..8b8650a 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> @@ -785,7 +785,7 @@ struct rte_intr_source {
>   * @return
>   *  never return;
>   */
> -static __attribute__((noreturn)) void *
> +static void *
>  eal_intr_thread_main(__rte_unused void *arg)
>  {
>  	struct epoll_event ev;
> @@ -803,8 +803,11 @@ static __attribute__((noreturn)) void *
>  
>  		/* create epoll fd */
>  		int pfd = epoll_create(1);
> -		if (pfd < 0)
> -			rte_panic("Cannot create epoll instance\n");
> +		if (pfd < 0) {
> +			RTE_LOG(CRIT, EAL, "%s(): Cannot create epoll instance\n",
> +					__func__);
> +			return NULL;
> +		}
>  
>  		pipe_event.data.fd = intr_pipe.readfd;
>  		/**
> @@ -813,8 +816,11 @@ static __attribute__((noreturn)) void *
>  		 */
>  		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
>  						&pipe_event) < 0) {
> -			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
> +			RTE_LOG(CRIT, EAL, "%s(): Error adding fd to %d "
> +					"epoll_ctl, %s\n",
> +					__func__,
>  					intr_pipe.readfd, strerror(errno));
> +			return NULL;
>  		}
>  		numfds++;
>  
> @@ -831,9 +837,14 @@ static __attribute__((noreturn)) void *
>  			 * into wait list.
>  			 */
>  			if (epoll_ctl(pfd, EPOLL_CTL_ADD,
> -					src->intr_handle.fd, &ev) < 0){
> -				rte_panic("Error adding fd %d epoll_ctl, %s\n",
> -					src->intr_handle.fd, strerror(errno));
> +				src->intr_handle.fd, &ev) < 0) {

The alignment changed here, not sure if it was deliberate

> +				RTE_LOG(CRIT, EAL,
> +						"%s(): Error adding fd %d "
> +						"epoll_ctl, %s\n",
> +						__func__,
> +						src->intr_handle.fd,
> +						strerror(errno));
> +				return NULL;
>  			}
>  			else
>  				numfds++;
> @@ -848,6 +859,8 @@ static __attribute__((noreturn)) void *
>  		 */
>  		close(pfd);
>  	}
> +
> +	return NULL;
>  }
>  
>  int
>
  
Arnon Warshavsky April 20, 2018, 1:18 p.m. UTC | #2
Not deliberate.Thanks

On Thu, Apr 19, 2018 at 8:27 PM, Kevin Traynor <ktraynor@redhat.com> wrote:

> On 04/19/2018 07:01 AM, Arnon Warshavsky wrote:
> > replace panic calls with log and retrun value.
> > Thread function removes the noretrun attribute.
> >
> > Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> > ---
> >  lib/librte_eal/linuxapp/eal/eal_interrupts.c | 27
> ++++++++++++++++++++-------
> >  1 file changed, 20 insertions(+), 7 deletions(-)
> >
> > diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> > index 58e9328..8b8650a 100644
> > --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> > +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> > @@ -785,7 +785,7 @@ struct rte_intr_source {
> >   * @return
> >   *  never return;
> >   */
> > -static __attribute__((noreturn)) void *
> > +static void *
> >  eal_intr_thread_main(__rte_unused void *arg)
> >  {
> >       struct epoll_event ev;
> > @@ -803,8 +803,11 @@ static __attribute__((noreturn)) void *
> >
> >               /* create epoll fd */
> >               int pfd = epoll_create(1);
> > -             if (pfd < 0)
> > -                     rte_panic("Cannot create epoll instance\n");
> > +             if (pfd < 0) {
> > +                     RTE_LOG(CRIT, EAL, "%s(): Cannot create epoll
> instance\n",
> > +                                     __func__);
> > +                     return NULL;
> > +             }
> >
> >               pipe_event.data.fd = intr_pipe.readfd;
> >               /**
> > @@ -813,8 +816,11 @@ static __attribute__((noreturn)) void *
> >                */
> >               if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
> >                                               &pipe_event) < 0) {
> > -                     rte_panic("Error adding fd to %d epoll_ctl, %s\n",
> > +                     RTE_LOG(CRIT, EAL, "%s(): Error adding fd to %d "
> > +                                     "epoll_ctl, %s\n",
> > +                                     __func__,
> >                                       intr_pipe.readfd, strerror(errno));
> > +                     return NULL;
> >               }
> >               numfds++;
> >
> > @@ -831,9 +837,14 @@ static __attribute__((noreturn)) void *
> >                        * into wait list.
> >                        */
> >                       if (epoll_ctl(pfd, EPOLL_CTL_ADD,
> > -                                     src->intr_handle.fd, &ev) < 0){
> > -                             rte_panic("Error adding fd %d epoll_ctl,
> %s\n",
> > -                                     src->intr_handle.fd,
> strerror(errno));
> > +                             src->intr_handle.fd, &ev) < 0) {
>
> The alignment changed here, not sure if it was deliberate
>
> > +                             RTE_LOG(CRIT, EAL,
> > +                                             "%s(): Error adding fd %d "
> > +                                             "epoll_ctl, %s\n",
> > +                                             __func__,
> > +                                             src->intr_handle.fd,
> > +                                             strerror(errno));
> > +                             return NULL;
> >                       }
> >                       else
> >                               numfds++;
> > @@ -848,6 +859,8 @@ static __attribute__((noreturn)) void *
> >                */
> >               close(pfd);
> >       }
> > +
> > +     return NULL;
> >  }
> >
> >  int
> >
>
>
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 58e9328..8b8650a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -785,7 +785,7 @@  struct rte_intr_source {
  * @return
  *  never return;
  */
-static __attribute__((noreturn)) void *
+static void *
 eal_intr_thread_main(__rte_unused void *arg)
 {
 	struct epoll_event ev;
@@ -803,8 +803,11 @@  static __attribute__((noreturn)) void *
 
 		/* create epoll fd */
 		int pfd = epoll_create(1);
-		if (pfd < 0)
-			rte_panic("Cannot create epoll instance\n");
+		if (pfd < 0) {
+			RTE_LOG(CRIT, EAL, "%s(): Cannot create epoll instance\n",
+					__func__);
+			return NULL;
+		}
 
 		pipe_event.data.fd = intr_pipe.readfd;
 		/**
@@ -813,8 +816,11 @@  static __attribute__((noreturn)) void *
 		 */
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
-			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
+			RTE_LOG(CRIT, EAL, "%s(): Error adding fd to %d "
+					"epoll_ctl, %s\n",
+					__func__,
 					intr_pipe.readfd, strerror(errno));
+			return NULL;
 		}
 		numfds++;
 
@@ -831,9 +837,14 @@  static __attribute__((noreturn)) void *
 			 * into wait list.
 			 */
 			if (epoll_ctl(pfd, EPOLL_CTL_ADD,
-					src->intr_handle.fd, &ev) < 0){
-				rte_panic("Error adding fd %d epoll_ctl, %s\n",
-					src->intr_handle.fd, strerror(errno));
+				src->intr_handle.fd, &ev) < 0) {
+				RTE_LOG(CRIT, EAL,
+						"%s(): Error adding fd %d "
+						"epoll_ctl, %s\n",
+						__func__,
+						src->intr_handle.fd,
+						strerror(errno));
+				return NULL;
 			}
 			else
 				numfds++;
@@ -848,6 +859,8 @@  static __attribute__((noreturn)) void *
 		 */
 		close(pfd);
 	}
+
+	return NULL;
 }
 
 int