From: Joe Damato <jdamato@fastly.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, corbet@lwn.net, hdanton@sina.com,
bagasdotme@gmail.com, pabeni@redhat.com, namangulati@google.com,
edumazet@google.com, amritha.nambiar@intel.com,
sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net,
m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org,
willy@infradead.org, skhawaja@google.com, kuba@kernel.org,
Martin Karsten <mkarsten@uwaterloo.ca>,
"David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net-next v8 5/6] selftests: net: Add busy_poll_test
Date: Fri, 8 Nov 2024 09:55:36 -0800 [thread overview]
Message-ID: <Zy5QmNT5XqZUJ3f8@LQ3V64L9R2> (raw)
In-Reply-To: <672e26ec429be_2a4cd22944c@willemb.c.googlers.com.notmuch>
On Fri, Nov 08, 2024 at 09:57:48AM -0500, Willem de Bruijn wrote:
> Joe Damato wrote:
[...]
> > diff --git a/tools/testing/selftests/net/busy_poller.c b/tools/testing/selftests/net/busy_poller.c
> > new file mode 100644
> > index 000000000000..8d8aa9e5939a
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/busy_poller.c
> > @@ -0,0 +1,328 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <assert.h>
> > +#include <errno.h>
> > +#include <error.h>
> > +#include <fcntl.h>
> > +#include <inttypes.h>
> > +#include <limits.h>
> > +#include <stdlib.h>
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include <unistd.h>
> > +
> > +#include <arpa/inet.h>
> > +#include <netinet/in.h>
> > +
> > +#include <sys/ioctl.h>
> > +#include <sys/epoll.h>
> > +#include <sys/socket.h>
> > +#include <sys/types.h>
> > +
> > +#include <linux/netlink.h>
> > +#include <linux/genetlink.h>
> > +#include "netdev-user.h"
> > +#include <ynl.h>
> > +
> > +/* if the headers haven't been updated, we need to define some things */
>
> This should not be needed, as headers are taken from $KERNELSRC/usr after
> make headers_install.
>
> Generally discouraged for tests (else every new feature test for a new
> features is forced to adds such checks).
I get that, but the reason this is required is complex:
- sys/epoll.h defines epoll_data, which is needed by the program to
access stuff like epoll_event.data.fd and linux/eventpoll.h does
not. At the same time, older glibcs do not have the ioctl yet
(I've sent a change to glibc to add it; I don't know which release
it'll be in or when CI will be updated to a distro with that
glibc).
- linux/eventpoll.h does not define epoll_event's data field, it's
simply an opaque "__u64 data", but does include the ioctl
definitions.
So, it'd seem I'd need parts of both headers... but of course you
can't include both, because they redefine types found in the other.
Maybe there's a solution I'm missing (please let me know), but it
seems that the only workable solution is to include the #ifdef blob
below, but perhaps with a comment explaining the above.
> > +#if !defined(EPOLL_IOC_TYPE)
> > +struct epoll_params {
> > + uint32_t busy_poll_usecs;
> > + uint16_t busy_poll_budget;
> > + uint8_t prefer_busy_poll;
> > +
> > + /* pad the struct to a multiple of 64bits */
> > + uint8_t __pad;
> > +};
> > +
> > +#define EPOLL_IOC_TYPE 0x8A
> > +#define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params)
> > +#define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params)
> > +#endif
next prev parent reply other threads:[~2024-11-08 17:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 4:53 [PATCH net-next v8 0/6] Suspend IRQs during application busy periods Joe Damato
2024-11-08 4:53 ` [PATCH net-next v8 1/6] net: Add napi_struct parameter irq_suspend_timeout Joe Damato
2024-11-08 4:53 ` [PATCH net-next v8 2/6] net: Add control functions for irq suspension Joe Damato
2024-11-08 4:53 ` [PATCH net-next v8 3/6] eventpoll: Trigger napi_busy_loop, if prefer_busy_poll is set Joe Damato
2024-11-08 4:53 ` [PATCH net-next v8 4/6] eventpoll: Control irq suspension for prefer_busy_poll Joe Damato
2024-11-08 4:53 ` [PATCH net-next v8 5/6] selftests: net: Add busy_poll_test Joe Damato
2024-11-08 14:57 ` Willem de Bruijn
2024-11-08 16:36 ` Joe Damato
2024-11-08 17:47 ` Willem de Bruijn
2024-11-08 17:51 ` Joe Damato
2024-11-09 5:05 ` Joe Damato
2024-11-08 17:55 ` Joe Damato [this message]
2024-11-08 4:53 ` [PATCH net-next v8 6/6] docs: networking: Describe irq suspension Joe Damato
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=Zy5QmNT5XqZUJ3f8@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=amritha.nambiar@intel.com \
--cc=bagasdotme@gmail.com \
--cc=bjorn@rivosinc.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hch@infradead.org \
--cc=hdanton@sina.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=m2shafiei@uwaterloo.ca \
--cc=mkarsten@uwaterloo.ca \
--cc=namangulati@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter@typeblog.net \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=sridhar.samudrala@intel.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=willy@infradead.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