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: <2f3938f6-41c7-46f8-a8f0-a3792fb21e96@bytedance.com>
Date: Wed, 4 Dec 2024 16:24:47 +0800
From: Yang Jihong <yangjihong@...edance.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: peterz@...radead.org, mingo@...hat.com, namhyung@...nel.org,
 mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
 irogers@...gle.com, adrian.hunter@...el.com, kan.liang@...ux.intel.com,
 james.clark@....com, linux-perf-users@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [External] Re: [RFC 01/12] perf record: Add event action support

Hello,

On 11/29/24 04:19, Arnaldo Carvalho de Melo wrote:
> On Thu, Nov 28, 2024 at 09:35:42PM +0800, Yang Jihong wrote:
>> In perf-record, when an event is triggered, default behavior is to
>> save sample data to perf.data. Sometimes, we may just want to do
>> some lightweight actions, such as printing a log.
>>
>> Based on this requirement, add the --action option to the event to
>> specify the behavior when the event occurs.
>>
>> Signed-off-by: Yang Jihong <yangjihong@...edance.com>
>> ---
>>   tools/perf/Documentation/perf-record.txt |   8 +
>>   tools/perf/builtin-record.c              |  31 +++
>>   tools/perf/util/Build                    |  18 ++
>>   tools/perf/util/parse-action.c           | 230 +++++++++++++++++++++++
>>   tools/perf/util/parse-action.h           |  75 ++++++++
>>   tools/perf/util/parse-action.l           |  40 ++++
>>   tools/perf/util/parse-action.y           |  82 ++++++++
>>   tools/perf/util/record_action.c          |  15 ++
>>   tools/perf/util/record_action.h          |  24 +++
>>   9 files changed, 523 insertions(+)
>>   create mode 100644 tools/perf/util/parse-action.c
>>   create mode 100644 tools/perf/util/parse-action.h
>>   create mode 100644 tools/perf/util/parse-action.l
>>   create mode 100644 tools/perf/util/parse-action.y
>>   create mode 100644 tools/perf/util/record_action.c
>>   create mode 100644 tools/perf/util/record_action.h
>>
>> diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
>> index 242223240a08..d0d9e0f69f3d 100644
>> --- a/tools/perf/Documentation/perf-record.txt
>> +++ b/tools/perf/Documentation/perf-record.txt
>> @@ -833,6 +833,14 @@ filtered through the mask provided by -C option.
>>   	Prepare BPF filter to be used by regular users.  The action should be
>>   	either "pin" or "unpin".  The filter can be used after it's pinned.
>>   
>> +--action=<action>::
>> +	Actions are the programs that run when the sampling event is triggered.
>> +	The action is a list of expressions separated by semicolons (;).
>> +	The sample data is saved by bpf prog attached by the event.
>> +	The call currently supported is print(); some commonly used built-in special
>> +	variables are also supported
>> +	For example:
>> +	  # perf record -e sched:sched_switch --action 'print("[%llu]comm=%s, cpu=%d, pid=%d, tid=%d\n", time, comm, cpu, pid, tid)' true
> 
> But at this point in the series this isn't available, right?
> 
> I.e. when testing this specific patch I can't follow what the
> documentation above says and expect anything, right? It will just fail?

Yes, The entire patchset needs to be applied to fully support this feature.

This patch simply implements the data organization structure.

Thanks,
Yang


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ