BPF List
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>
Cc: "Alexander Lobakin" <aleksander.lobakin@intel.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH net-next 3/3] bpf: test_run: Fix cacheline alignment of live XDP frame data structures
Date: Thu, 15 Feb 2024 14:26:32 +0100	[thread overview]
Message-ID: <20240215132634.474055-4-toke@redhat.com> (raw)
In-Reply-To: <20240215132634.474055-1-toke@redhat.com>

The live XDP frame code in BPF_PROG_RUN suffered from suboptimal cache
line placement due to the forced cache line alignment of struct
xdp_rxq_info. Rearrange things so we don't waste a whole cache line on
padding, and also add explicit alignment to the data_hard_start field in
the start-of-page data structure we use for the data pages.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 net/bpf/test_run.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index c742869a0612..d153a3b3528f 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -108,12 +108,12 @@ struct xdp_page_head {
 		/* ::data_hard_start starts here */
 		DECLARE_FLEX_ARRAY(struct xdp_frame, frame);
 		DECLARE_FLEX_ARRAY(u8, data);
-	};
+	} ____cacheline_aligned;
 };
 
 struct xdp_test_data {
-	struct xdp_buff *orig_ctx;
 	struct xdp_rxq_info rxq;
+	struct xdp_buff *orig_ctx;
 	struct net_device *dev;
 	struct xdp_frame **frames;
 	struct sk_buff **skbs;
-- 
2.43.0


  parent reply	other threads:[~2024-02-15 13:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 13:26 [PATCH net-next 0/3] Change BPF_TEST_RUN use the system page pool for live XDP frames Toke Høiland-Jørgensen
2024-02-15 13:26 ` [PATCH net-next 1/3] net: Register system page pool as an XDP memory model Toke Høiland-Jørgensen
2024-02-15 13:26 ` [PATCH net-next 2/3] bpf: test_run: Use system page pool for XDP live frame mode Toke Høiland-Jørgensen
2024-02-20  9:06   ` Daniel Borkmann
2024-02-20  9:45     ` Paolo Abeni
2024-02-20 13:14       ` Toke Høiland-Jørgensen
2024-02-20 14:57         ` Paolo Abeni
2024-02-20 19:33           ` Toke Høiland-Jørgensen
2024-02-15 13:26 ` Toke Høiland-Jørgensen [this message]
2024-02-20  9:06   ` [PATCH net-next 3/3] bpf: test_run: Fix cacheline alignment of live XDP frame data structures Daniel Borkmann
2024-02-15 15:30 ` [PATCH net-next 0/3] Change BPF_TEST_RUN use the system page pool for live XDP frames Alexander Lobakin
2024-02-15 17:06   ` Toke Høiland-Jørgensen
2024-02-16 11:41     ` Alexander Lobakin
2024-02-16 14:00       ` Toke Høiland-Jørgensen
2024-02-19 18:52 ` Toke Høiland-Jørgensen
2024-02-20  8:39   ` Daniel Borkmann
2024-02-20  9:03     ` Paolo Abeni
2024-02-20  9:19       ` Daniel Borkmann
2024-02-20 11:23     ` Toke Høiland-Jørgensen
2024-02-20 12:35       ` Daniel Borkmann
2024-02-20 15:24         ` Toke Høiland-Jørgensen

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=20240215132634.474055-4-toke@redhat.com \
    --to=toke@redhat.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --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=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