From: "Jiayuan Chen" <jiayuan.chen@linux.dev>
To: "Steven Rostedt" <rostedt@goodmis.org>
Cc: bpf@vger.kernel.org, mrpre@163.com,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"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>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
"Jakub Sitnicki" <jakub@cloudflare.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v1] bpf, sockmap: Introduce tracing capability for sockmap
Date: Wed, 09 Apr 2025 16:40:55 +0000 [thread overview]
Message-ID: <c292a4c4daa4d27f5062a23bd871ac58285ec406@linux.dev> (raw)
In-Reply-To: <20250409121125.48510acb@gandalf.local.home>
April 10, 2025 at 24:11, "Steven Rostedt" <rostedt@goodmis.org> wrote:
>
> On Wed, 9 Apr 2025 18:29:33 +0800
>
> Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
>
> >
> > +#define trace_sockmap_skmsg_redirect(sk, prog, msg, act) \
> > + trace_sockmap_redirect((sk), "msg", (prog), (msg)->sg.size, (act))
> > +
> > +#define trace_sockmap_skb_redirect(sk, prog, skb, act) \
> > + trace_sockmap_redirect((sk), "skb", (prog), (skb)->len, (act))
> > +
> > +TRACE_EVENT(sockmap_redirect,
> > + TP_PROTO(const struct sock *sk, const char *type,
> > + const struct bpf_prog *prog, int length, int act),
> > + TP_ARGS(sk, type, prog, length, act),
> > +
> > + TP_STRUCT__entry(
> > + __field(const void *, sk)
> > + __field(const char *, type)
> >
>
> On 64bit, const char * is 8 bytes, and you are pointing it to a string of
> size 4 bytes (3 chars and '\0'). Why not just make it a constant string, or
> better yet, an enum?
>
> -- Steve
>
Using an enum is indeed more appropriate in TRACE.
Thank you for the suggestion.
next prev parent reply other threads:[~2025-04-09 16:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 10:29 [PATCH bpf-next v1] bpf, sockmap: Introduce tracing capability for sockmap Jiayuan Chen
2025-04-09 16:11 ` Steven Rostedt
2025-04-09 16:40 ` Jiayuan Chen [this message]
2025-04-09 17:04 ` Cong Wang
2025-04-10 1:19 ` Jiayuan Chen
2025-04-10 9:14 ` Jakub Sitnicki
2025-04-10 14:27 ` Jiayuan Chen
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=c292a4c4daa4d27f5062a23bd871ac58285ec406@linux.dev \
--to=jiayuan.chen@linux.dev \
--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=horms@kernel.org \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mrpre@163.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sdf@fomichev.me \
--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;
as well as URLs for NNTP newsgroup(s).