[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEmfU+ufKWoJLvhksPzADMKkbinV37Tv1KODU6RdJfBM9Juy7w@mail.gmail.com>
Date: Fri, 1 Nov 2024 14:41:46 -0700
From: Benjamin Peterson <benjamin@...flow.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Howard Chu <howardchu95@...il.com>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
"open list:PERFORMANCE EVENTS SUBSYSTEM" <linux-perf-users@...r.kernel.org>,
"open list:PERFORMANCE EVENTS SUBSYSTEM" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] perf trace: avoid garbage when not printing a trace
event's arguments
On Fri, Nov 1, 2024 at 2:30 PM Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
>
> On Fri, Nov 01, 2024 at 02:00:46PM -0700, Howard Chu wrote:
> > Hello Benjamin,
Thanks for testing & reviewing.
> >
> > Before your patch:
> >
> > perf $ ./perf trace -e net:netif_rx_exit
> > 0.000 irq/79-brcmf_p/1694977 net:netif_rx_exit(6n<)
> > 28.153 irq/79-brcmf_p/1694977 net:netif_rx_exit(6n<)
> > 36.429 irq/79-brcmf_p/1694977 net:netif_rx_exit(6n<)
> > 36.461 irq/79-brcmf_p/1694977 net:netif_rx_exit(6n<)
> >
> > After:
> >
> > perf $ ./perf trace -e net:netif_rx_exit
> > 0.000 irq/79-brcmf_p/1694977 net:netif_rx_exit()
> > 7.352 irq/79-brcmf_p/1694977 net:netif_rx_exit()
> > 30.232 irq/79-brcmf_p/1694977 net:netif_rx_exit()
> > 37.529 irq/79-brcmf_p/1694977 net:netif_rx_exit()
> >
> > It works beautifully, but I'm thinking can we simplify it by just doing:
> >
> > + char bf[2048] = { 0 };
> > size_t size = sizeof(bf);
> >
I believe this is slightly suboptimal because it obliges the compiler
to zero out 2kib of the stack every time the function is called.
> >
> > Tested-by: Howard Chu <howardchu95@...il.com>
>
> I haven't tested it yet, just in my mind :-)
>
> The patch looks ok and seems to fix a real problem, my only concern, a
> pet peeve, was that it, in addition to fixing a real problem, did an
> unrelated change, the "Remove the return value...", that part looks like
> a distraction, something that shouldn't be there.
In my mind, it was related because both the bug and the odd return
value arise from incorrect counting of the number of written bytes.
Obviously, the fix is what I care about, so feel free to strip out the
return value change on import, or I can resend.
Powered by blists - more mailing lists