From: Steven Rostedt <rostedt@goodmis.org>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH 2/2] clk: Add trace events for rate requests
Date: Mon, 24 Oct 2022 12:19:26 -0400 [thread overview]
Message-ID: <20221024121926.1f11c57a@gandalf.local.home> (raw)
In-Reply-To: <20221018-clk-rate-request-tracing-v1-2-6f3aa0b0b9de@cerno.tech>
On Tue, 18 Oct 2022 15:56:42 +0200
Maxime Ripard <maxime@cerno.tech> wrote:
I know I reviewed this but looking at this again, I noticed:
> +DECLARE_EVENT_CLASS(clk_rate_request,
> +
> + TP_PROTO(struct clk_rate_request *req),
> +
> + TP_ARGS(req),
> +
> + TP_STRUCT__entry(
> + __string( name, req->core ? req->core->name : "none")
> + __field(unsigned long, min )
> + __field(unsigned long, max )
> + __string( pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none" )
It may be best to move the two __string() declarations together. The reason
is that dynamic strings (which __string() is) uses 4 bytes embedded in the
first part of the event. Two bytes for offset, where the dynamic string
exists, and two bytes for the strings length.
On 64 bit machines the above has:
__string() 4 bytes
__field(unsigned long) 8 bytes
__field(unsigned long) 8 bytes
__string() 4 bytes
and then another unsigned long field below, which is another 8 bytes.
> + __field(unsigned long, prate )
> + ),
> +
> +
As compilers tend to use word alignment, the above turns into:
__string() 4 bytes
__PADDING__ 4 bytes
__field(unsigned long) 8 bytes
__field(unsigned long) 8 bytes
__string() 4 bytes
__PADDING__ 4 bytes
__field(unsigned long) 8 bytes
Where there will be 8 bytes of padding in that event that wastes precious
ring buffer space. By changing the event to:
TP_STRUCT__entry(
__string( name, req->core ? req->core->name : "none")
__string( pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none" )
__field(unsigned long, min )
__field(unsigned long, max )
__field(unsigned long, prate )
),
It will turn the size into:
__string() 4 bytes
__string() 4 bytes
__field(unsigned long) 8 bytes
__field(unsigned long) 8 bytes
__field(unsigned long) 8 bytes
With no padding and no wasted space.
I would suggest changing this.
-- Steve
prev parent reply other threads:[~2022-10-24 18:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 13:56 [PATCH 0/2] clk: Rate Request Tracing Maxime Ripard
2022-10-18 13:56 ` [PATCH 1/2] clk: Store clk_core for clk_rate_request Maxime Ripard
2022-10-26 0:41 ` Stephen Boyd
2022-10-18 13:56 ` [PATCH 2/2] clk: Add trace events for rate requests Maxime Ripard
2022-10-18 14:24 ` Steven Rostedt
2022-10-24 16:19 ` Steven Rostedt [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=20221024121926.1f11c57a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime@cerno.tech \
--cc=mhiramat@kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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).