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: <20201210171503.GA195565@kernel.org>
Date:   Thu, 10 Dec 2020 14:15:03 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Alexei Budankov <abudankov@...wei.com>,
        Jiri Olsa <jolsa@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 2/3] perf tools: Allow to enable/disable events via
 control file

Em Thu, Dec 10, 2020 at 05:24:30PM +0100, Jiri Olsa escreveu:
> On Mon, Dec 07, 2020 at 08:02:20PM +0300, Alexei Budankov wrote:
> > Hi,
> > 
> > On 06.12.2020 20:05, Jiri Olsa wrote:
> > > Adding new control events to enable/disable specific event.
> > > The interface string for control file are:
> > > 
> > >   'enable-<EVENT NAME>'
> > >   'disable-<EVENT NAME>'
> > 
> > <SNIP>
> > 
> > > 
> > > when received the command, perf will scan the current evlist
> > > for <EVENT NAME> and if found it's enabled/disabled.
> > 
> > <SNIP>
> > 
> > > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> > > index 70aff26612a9..05723227bebf 100644
> > > --- a/tools/perf/util/evlist.c
> > > +++ b/tools/perf/util/evlist.c
> > > @@ -1915,7 +1915,13 @@ static int evlist__ctlfd_recv(struct evlist *evlist, enum evlist_ctl_cmd *cmd,
> > >  		 bytes_read == data_size ? "" : c == '\n' ? "\\n" : "\\0");
> > >  
> > >  	if (bytes_read > 0) {
> > > -		if (!strncmp(cmd_data, EVLIST_CTL_CMD_ENABLE_TAG,
> > > +		if (!strncmp(cmd_data, EVLIST_CTL_CMD_ENABLE_EVSEL_TAG,
> > > +				    (sizeof(EVLIST_CTL_CMD_ENABLE_EVSEL_TAG)-1))) {
> > > +			*cmd = EVLIST_CTL_CMD_ENABLE_EVSEL;
> > > +		} else if (!strncmp(cmd_data, EVLIST_CTL_CMD_DISABLE_EVSEL_TAG,
> > > +				    (sizeof(EVLIST_CTL_CMD_DISABLE_EVSEL_TAG)-1))) {
> > > +			*cmd = EVLIST_CTL_CMD_DISABLE_EVSEL;
> > > +		} else if (!strncmp(cmd_data, EVLIST_CTL_CMD_ENABLE_TAG,
> > >  			     (sizeof(EVLIST_CTL_CMD_ENABLE_TAG)-1))) {
> > >  			*cmd = EVLIST_CTL_CMD_ENABLE;
> > >  		} else if (!strncmp(cmd_data, EVLIST_CTL_CMD_DISABLE_TAG,
> > > @@ -1952,6 +1958,8 @@ int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd)
> > >  	char cmd_data[EVLIST_CTL_CMD_MAX_LEN];
> > >  	int ctlfd_pos = evlist->ctl_fd.pos;
> > >  	struct pollfd *entries = evlist->core.pollfd.entries;
> > > +	struct evsel *evsel;
> > > +	char *evsel_name;
> > >  
> > >  	if (!evlist__ctlfd_initialized(evlist) || !entries[ctlfd_pos].revents)
> > >  		return 0;
> > > @@ -1967,6 +1975,26 @@ int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd)
> > >  			case EVLIST_CTL_CMD_DISABLE:
> > >  				evlist__disable(evlist);
> > >  				break;
> > > +			case EVLIST_CTL_CMD_ENABLE_EVSEL:
> > > +				evsel_name = cmd_data + sizeof(EVLIST_CTL_CMD_ENABLE_EVSEL_TAG) - 1;
> > 
> > It makes sense to check that evsel_name still points
> > into cmd_data buffer after assigning to event name.
> 
> right, will add that

So, I'm finishing test builds, so probably I'll push the first two
patches publicly and then you can send a patch on top of this, ok?

Unless the tests break somewhere and then I'll have to restart, so I'll
fold in whatever gets at that time...


- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ