Re: [PATCH v8 06/22] perf arm-spe: Refactor printing string to buffer
From: Arnaldo Carvalho de Melo
Date: Wed Nov 11 2020 - 13:02:53 EST
Em Wed, Nov 11, 2020 at 03:01:27PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Nov 11, 2020 at 05:58:27PM +0000, Dave Martin escreveu:
> >
> > On Wed, Nov 11, 2020 at 05:39:22PM +0000, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Nov 11, 2020 at 03:45:23PM +0000, Andr� Przywara escreveu:
> > > > On 11/11/2020 15:35, Arnaldo Carvalho de Melo wrote:
> > > > > Isn't this 'ret +=' ? Otherwise if any of these arm_spe_pkt_snprintf()
> > > > > calls are made the previous 'ret' value is simply discarded. Can you
> > > > > clarify this?
>
> > > > ret is the same as err. If err is negative (from previous calls), we
> > > > return that straight away, so it does nothing but propagating the error.
>
> > > Usually the return of a snprintf is used to account for buffer space, ok
> > > I'll have to read it, which I shouldn't as snprintf has a well defined
> > > meaning...
>
> > > Ok, now that I look at it, I realize it is not a snprintf() routine, but
> > > something with different semantics, that will look at a pointer to an
> > > integer and then do nothing if it comes with some error, etc, confusing
> > > :-/
>
> > Would you be happier if the function were renamed?
>
> > Originally we were aiming for snprintf() semantics, but this still
> > spawns a lot of boilerplate code and encourages mistakes in the local
> > caller here -- hence the current sticky error approach.
>
> > So maybe the name should now be less "snprintf"-like.
>
> Please, its important to stick to semantics for such well known type of
> routines, helps reviewing, etc.
>
> I'll keep the series up to that point and will run my build tests, then
> push it publicly to acme/perf/core and you can go from there, ok?
>
> I've changed the BIT() to BIT_ULL() as Andre suggested and I'm testing
> it again.
To make it clear, this is what I have locally:
0a04244cabc5560c (HEAD -> perf/core) perf arm-spe: Fix packet length handling
b65577baf4829092 perf arm-spe: Refactor arm_spe_get_events()
b2ded2e2e2764e50 perf arm-spe: Refactor payload size calculation
903b659436b70692 perf arm-spe: Fix a typo in comment
c185f1cde46653cd perf arm-spe: Include bitops.h for BIT() macro
40714c58630aaaf1 perf mem: Support ARM SPE events
c825f7885178f994 perf c2c: Support AUX trace
13e5df1e3f1ba1a9 perf mem: Support AUX trace
014a771c7867fda5 perf auxtrace: Add itrace option '-M' for memory events
436cce00710a3f23 perf mem: Only initialize memory event for recording
8b8173b45a7a9709 perf c2c: Support memory event PERF_MEM_EVENTS__LOAD_STORE
4ba2452cd88f39da perf mem: Support new memory event PERF_MEM_EVENTS__LOAD_STORE
eaf6aaeec5fa301c perf mem: Introduce weak function perf_mem_events__ptr()
f9f16dfbe76e63ba perf mem: Search event name with more flexible path
644bf4b0f7acde64 (tag: perf-tools-tests-v5.11-2020-11-04, acme/perf/core) perf jevents: Add test for arch std events
The perf-tools-tests-v5.11-2020-11-04, is in git.kernel.org, as it was
tested, etc, test results are in that signed tag, as usual for some
months.
- Arnaldo