[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2ff24cb-5d62-6366-81dc-d51a79062570@arm.com>
Date: Mon, 24 Apr 2023 17:43:13 +0100
From: James Clark <james.clark@....com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: denik@...gle.com, Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
John Garry <john.g.garry@...cle.com>,
Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org, coresight@...ts.linaro.org,
shy828301@...il.com
Subject: Re: [PATCH 2/7] perf tools: Add util function for overriding user set
config values
On 24/04/2023 16:36, Adrian Hunter wrote:
> On 24/04/23 16:47, James Clark wrote:
>> There is some duplicated code to only override config values if they
>> haven't already been set by the user so make a util function for this.
>>
>> Signed-off-by: James Clark <james.clark@....com>
>
> One minor comment, nevertheless:
>
> Acked-by: Adrian Hunter <adrian.hunter@...el.com>
>
Thanks for the review
>> ---
>> tools/perf/arch/arm64/util/arm-spe.c | 26 ++-----------------------
>> tools/perf/arch/x86/util/intel-pt.c | 22 ++-------------------
>> tools/perf/util/evsel.c | 29 ++++++++++++++++++++++++++++
>> tools/perf/util/evsel.h | 3 +++
>> 4 files changed, 36 insertions(+), 44 deletions(-)
>>
[...]
>> }
>> }
>> +
>> +/*
>> + * Set @config_name to @val as long as the user hasn't already set or cleared it
>> + * by passing a config term on the command line.
>> + *
>> + * @val is the value to put into the bits specified by @config_name rather than
>> + * the bit pattern. It is shifted into position by this function, so to set
>> + * something to true, pass 1 for val rather than a pre shifted value.
>> + */
>> +#define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
>
> I notice there is already tools/include/linux/bitfield.h
> so may FIELD_PREP from there could be used?
I tried that first, but it seems like quite a lot of effort went into it
to make it work on const only values so it doesn't work here. There is
this [1] change to make a non const one but it doesn't look like it went
anywhere:
[1]:
https://patchwork.kernel.org/project/linux-omap/patch/3a54a6703879d10f08cf0275a2a69297ebd2b1d4.1637592133.git.geert+renesas@glider.be/#24610749
Powered by blists - more mailing lists