From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, Matthew Hall <mhall@mhcomputing.net>
Subject: Re: [dpdk-dev] [PATCH] eal_interrupts.c: properly init struct epoll_event (valgrind)
Date: Thu, 17 Mar 2016 15:18:15 +0100 [thread overview]
Message-ID: <1663421.MSGVGpLJHn@xps13> (raw)
In-Reply-To: <20160214122209.38b0efb6@xeon-e3>
Hi Stephen,
Please, could you turn it into a real patch with your sign-off?
Thanks
2016-02-14 12:22, Stephen Hemminger:
> A better patch would be to move the data structure into the
> code block used, and get rid of the useless else (rte_panic never returns);
> and fix the indentation, and use C99 initialization which should make valgrind
> happier.
>
> The moral is don't just slap memsets around
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> index 06b26a9..d53826e 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
> @@ -799,8 +799,6 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
> static __attribute__((noreturn)) void *
> eal_intr_thread_main(__rte_unused void *arg)
> {
> - struct epoll_event ev;
> -
> /* host thread, never break out */
> for (;;) {
> /* build up the epoll fd with all descriptors we are to
> @@ -834,20 +832,22 @@ eal_intr_thread_main(__rte_unused void *arg)
> TAILQ_FOREACH(src, &intr_sources, next) {
> if (src->callbacks.tqh_first == NULL)
> continue; /* skip those with no callbacks */
> - ev.events = EPOLLIN | EPOLLPRI;
> - ev.data.fd = src->intr_handle.fd;
> +
> + struct epoll_event ev = {
> + .events = EPOLLIN | EPOLLPRI,
> + .data.fd = src->intr_handle.fd,
> + };
>
> /**
> * add all the uio device file descriptor
> * into wait list.
> */
> if (epoll_ctl(pfd, EPOLL_CTL_ADD,
> - src->intr_handle.fd, &ev) < 0){
> + src->intr_handle.fd, &ev) < 0)
> rte_panic("Error adding fd %d epoll_ctl, %s\n",
> src->intr_handle.fd, strerror(errno));
> - }
> - else
> - numfds++;
> +
> + numfds++;
> }
> rte_spinlock_unlock(&intr_lock);
> /* serve the interrupt */
next prev parent reply other threads:[~2016-03-17 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 6:41 Matthew Hall
2016-02-14 20:22 ` Stephen Hemminger
2016-03-17 14:18 ` Thomas Monjalon [this message]
2016-03-17 17:19 ` Stephen Hemminger
2016-03-17 23:00 ` Matthew Hall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1663421.MSGVGpLJHn@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=mhall@mhcomputing.net \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).