[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231004070926.5b4ba04c@kernel.org>
Date: Wed, 4 Oct 2023 07:09:26 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, "David S. Miller"
<davem@...emloft.net>, Björn Töpel <bjorn@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Eric Dumazet <edumazet@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jesper Dangaard Brouer <hawk@...nel.org>, Jiri
Olsa <jolsa@...nel.org>, John Fastabend <john.fastabend@...il.com>,
Jonathan Lemon <jonathan.lemon@...il.com>, KP Singh <kpsingh@...nel.org>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>, Magnus Karlsson
<magnus.karlsson@...el.com>, Martin KaFai Lau <martin.lau@...ux.dev>, Paolo
Abeni <pabeni@...hat.com>, Song Liu <song@...nel.org>, Stanislav Fomichev
<sdf@...gle.com>, Thomas Gleixner <tglx@...utronix.de>, Yonghong Song
<yonghong.song@...ux.dev>
Subject: Re: [PATCH bpf-next] net: Add a warning if NAPI cb missed
xdp_do_flush().
On Fri, 29 Sep 2023 18:58:25 +0200 Sebastian Andrzej Siewior wrote:
> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_DEBUG_NET)
> +bool __dev_check_flush(void);
> +bool __cpu_map_check_flush(void);
> +
> +#else
> +static inline bool __dev_check_flush(void)
> +{
> + return false;
> +}
> +
> +static inline bool __cpu_map_check_flush(void)
> +{
> + return false;
> +}
> +#endif
I think you're going too hard with the ifdefs.
These functions are only called if DEBUG_NET, add if BPF on the call
site and spare us the static inlines for all the __ helpers.
> static __always_inline int
> bpf_probe_read_kernel_common(void *dst, u32 size, const void *unsafe_ptr)
> {
> diff --git a/include/linux/filter.h b/include/linux/filter.h
> index 27406aee2d402..db095d731813e 100644
> --- a/include/linux/filter.h
> +++ b/include/linux/filter.h
> @@ -1025,6 +1025,14 @@ int xdp_do_redirect_frame(struct net_device *dev,
> struct bpf_prog *prog);
> void xdp_do_flush(void);
>
> +#ifdef CONFIG_DEBUG_NET
> +void xdp_do_check_flushed(struct napi_struct *napi);
> +
> +#else
> +static inline void xdp_do_check_flushed(struct napi_struct *napi) { }
> +
> +#endif
Can you move this to net/core/dev.h? Or a new header under net/core
if you prefer? This looks internal to the stack.
Also nit: drop the empty lines inside the #ifdef?
Powered by blists - more mailing lists