From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12EF6188; Mon, 11 Sep 2023 06:50:23 +0000 (UTC) Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AABF6106; Sun, 10 Sep 2023 23:50:22 -0700 (PDT) Date: Mon, 11 Sep 2023 08:50:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694415020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a2io0zqAD/xA8XIZ8XPgfhYmExX7VHlsM0djcORO23k=; b=O+Z1pwtXZF4A9BpeMvuDPjm8QM4M/uuIz647UfZ1o+DINIeJWZLDAYCGiXAuNG91AebBP+ Niv9fWxQO7P2TWB7CRKGWolPhwob8IFMD//nHJBfiTIvlDclQnByh2Bzz/+fk8F81HyCE5 OczF46ElHw2TyhSRflorrr63YIJUc6jy94UcYQhaH5vNeWvjF9oss0sTKMjS/LbE4QmhXO IkG5w3/XMmBUkkV87IGUl1yfjQNUEBjzneKhMqSX2WklZF3hEh3h3rX9zo1Rg4NpibC1Lr PauU9bspR++AguOiukXqkysM42+lD8Kntv/mmE4dIG3xph8KJt/a/FqiZULXvw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694415020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a2io0zqAD/xA8XIZ8XPgfhYmExX7VHlsM0djcORO23k=; b=F9AP7NtqxRIzr7aw1tUlWfEjw1Vhjk/Y9lNePmxwRqlAC3n2CCwC0e/kcPVqhwzY+y3rPV YeOK4Fj19AroAiAA== From: Sebastian Andrzej Siewior To: Hou Tao Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Eric Dumazet , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Paolo Abeni , Thomas Gleixner , Andrii Nakryiko , Hao Luo , Jiri Olsa , KP Singh , Martin KaFai Lau , Song Liu , Stanislav Fomichev , Yonghong Song Subject: Re: [PATCH net 4/4] bpf, cpumap: Flush xdp after cpu_map_bpf_prog_run_skb(). Message-ID: <20230911065016.IkkQJSfN@linutronix.de> References: <20230908135748.794163-1-bigeasy@linutronix.de> <20230908135748.794163-5-bigeasy@linutronix.de> <1cf255a3-e48b-0a90-28ce-1a9c47095fc2@huaweicloud.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1cf255a3-e48b-0a90-28ce-1a9c47095fc2@huaweicloud.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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