netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Hou Tao <houtao@huaweicloud.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrii Nakryiko <andrii@kernel.org>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, KP Singh <kpsingh@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Stanislav Fomichev <sdf@google.com>,
	Yonghong Song <yonghong.song@linux.dev>
Subject: Re: [PATCH net 4/4] bpf, cpumap: Flush xdp after cpu_map_bpf_prog_run_skb().
Date: Mon, 11 Sep 2023 08:50:16 +0200	[thread overview]
Message-ID: <20230911065016.IkkQJSfN@linutronix.de> (raw)
In-Reply-To: <1cf255a3-e48b-0a90-28ce-1a9c47095fc2@huaweicloud.com>

On 2023-09-09 10:49:09 [+0800], Hou Tao wrote:
> Hi,
Hi,

> > --- a/kernel/bpf/cpumap.c
> > +++ b/kernel/bpf/cpumap.c
> > @@ -248,12 +248,12 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames,
> >  
> >  	nframes = cpu_map_bpf_prog_run_xdp(rcpu, frames, xdp_n, stats);
> >  
> > -	if (stats->redirect)
> > -		xdp_do_flush();
> > -
> >  	if (unlikely(!list_empty(list)))
> >  		cpu_map_bpf_prog_run_skb(rcpu, list, stats);
> >  
> > +	if (stats->redirect)
> > +		xdp_do_flush();
> > +
> 
> The purpose of xdp_do_flush() is to flush xdp frames stashed in per-cpu
> cpu_map_flush list into xdp_bulk_queue. But for redirected skbs, these
> skbs will be directly added into xdp_bulk_queue() in
> cpu_map_generic_redirect(), so I think xdp_do_flush() is not needed for
> redirected skbs.

Now that I checked the down streams of cpu_map_bpf_prog_run_skb() it
does not queue anything to the per-CPU lists like I assumed.  You are
right, it is no needed.

Sorry for the confusion.

> >  	rcu_read_unlock_bh(); /* resched point, may call do_softirq() */
> >  
> >  	return nframes;
> 

Sebastian

      reply	other threads:[~2023-09-11  6:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 13:57 [PATCH net 0/4] Add missing xdp_do_flush() invocations Sebastian Andrzej Siewior
2023-09-08 13:57 ` [PATCH net 1/4] net: ena: Flush XDP packets on error Sebastian Andrzej Siewior
2023-09-10  7:42   ` Kiyanovski, Arthur
2023-09-08 13:57 ` [PATCH net 2/4] bnxt_en: Flush XDP for bnxt_poll_nitroa0()'s NAPI Sebastian Andrzej Siewior
2023-09-08 16:30   ` Pavan Chebbi
2023-09-08 17:57     ` Michael Chan
2023-09-08 18:18       ` Andy Gospodarek
2023-09-08 13:57 ` [PATCH net 3/4] octeontx2-pf: Do xdp_do_flush() after redirects Sebastian Andrzej Siewior
2023-09-13  4:34   ` [EXT] " Geethasowjanya Akula
2023-09-08 13:57 ` [PATCH net 4/4] bpf, cpumap: Flush xdp after cpu_map_bpf_prog_run_skb() Sebastian Andrzej Siewior
2023-09-09  2:49   ` Hou Tao
2023-09-11  6:50     ` Sebastian Andrzej Siewior [this message]

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=20230911065016.IkkQJSfN@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=houtao@huaweicloud.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yonghong.song@linux.dev \
    /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).