lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e77cf128-b8d2-9866-a80f-23ec46e2245b@huawei.com>
Date:   Wed, 12 Jul 2023 22:32:33 +0800
From:   Yang Jihong <yangjihong1@...wei.com>
To:     Adrian Hunter <adrian.hunter@...el.com>, <peterz@...radead.org>,
        <mingo@...hat.com>, <acme@...nel.org>, <mark.rutland@....com>,
        <alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
        <namhyung@...nel.org>, <irogers@...gle.com>,
        <kan.liang@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
        <linux-perf-users@...r.kernel.org>
Subject: Re: [PATCH 2/5] perf evlist: Add evlist__findnew_tracking_event()
 helper

Hello,

On 2023/7/11 21:13, Adrian Hunter wrote:
> On 4/07/23 10:42, Yang Jihong wrote:
>> Currently, intel-bts, intel-pt, and arm-spe may add a dummy event for
>> tracking to the evlist. We may need to search for the dummy event for
>> some settings. Therefore, add evlist__findnew_tracking_event() helper.
>>
>> Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
>> ---
>>   tools/perf/builtin-record.c | 11 +++--------
>>   tools/perf/util/evlist.c    | 17 +++++++++++++++++
>>   tools/perf/util/evlist.h    |  1 +
>>   3 files changed, 21 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>> index aec18db7ff23..8872cd037f2c 100644
>> --- a/tools/perf/builtin-record.c
>> +++ b/tools/perf/builtin-record.c
>> @@ -1295,14 +1295,9 @@ static int record__open(struct record *rec)
>>   	 */
>>   	if (opts->target.initial_delay || target__has_cpu(&opts->target) ||
>>   	    perf_pmus__num_core_pmus() > 1) {
>> -		pos = evlist__get_tracking_event(evlist);
>> -		if (!evsel__is_dummy_event(pos)) {
>> -			/* Set up dummy event. */
>> -			if (evlist__add_dummy(evlist))
>> -				return -ENOMEM;
>> -			pos = evlist__last(evlist);
>> -			evlist__set_tracking_event(evlist, pos);
>> -		}
>> +		pos = evlist__findnew_tracking_event(evlist);
>> +		if (!pos)
>> +			return -ENOMEM;
>>   
>>   		/*
>>   		 * Enable the dummy event when the process is forked for
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index 7ef43f72098e..4621ddaeb8f3 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -1694,6 +1694,23 @@ void evlist__set_tracking_event(struct evlist *evlist, struct evsel *tracking_ev
>>   	tracking_evsel->tracking = true;
>>   }
>>   
>> +struct evsel *evlist__findnew_tracking_event(struct evlist *evlist)
>> +{
>> +	struct evsel *evsel;
>> +
>> +	evsel = evlist__get_tracking_event(evlist);
>> +	if (!evsel__is_dummy_event(evsel)) {
>> +		/* Set up dummy event. */
>> +		if (evlist__add_dummy(evlist))
> 
> evlist__add_dummy() does not exclude_kernel so it
> will end up relying on evsel__fallback() to work in
> cases where the user does not have kernel access.
> 
> evlist__add_aux_dummy() is probably better suited.
> Consequently perhaps pass system_wide as
> a parameter to evlist__findnew_tracking_event() and
> deal with that all inside evlist__findnew_tracking_event()
> 
OK. These two points will be modified in the next version.

Thanks,
Yang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ