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: <OSBPR01MB46008051704CF17164C05847F7EA9@OSBPR01MB4600.jpnprd01.prod.outlook.com>
Date:   Mon, 11 Apr 2022 08:29:20 +0000
From:   "nakamura.shun@...itsu.com" <nakamura.shun@...itsu.com>
To:     'Jiri Olsa' <olsajiri@...il.com>
CC:     "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "jolsa@...hat.com" <jolsa@...hat.com>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>
Subject: RE: [RFC PATCH v2 3/7] libperf: Add perf_evsel__{refresh, period}()
 functions

Hi jirka

> On Fri, Mar 25, 2022 at 01:38:25PM +0900, Shunsuke Nakamura wrote:
> 
> SNIP
> 
> > +int perf_evsel__refresh_cpu(struct perf_evsel *evsel, int refresh,
> > +int cpu_map_idx) {
> > +	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_REFRESH,
> refresh,
> > +cpu_map_idx); }
> > +
> > +int perf_evsel__refresh(struct perf_evsel *evsel, int refresh) {
> > +	int i;
> > +	int err = 0;
> > +
> > +	for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++)
> > +		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_REFRESH,
> refresh, i);
> > +	return err;
> > +}
> > +
> > +int perf_evsel__period_cpu(struct perf_evsel *evsel, __u64 period,
> > +int cpu_map_idx) {
> > +	struct perf_event_attr *attr;
> > +	int err = 0;
> > +
> > +	attr = perf_evsel__attr(evsel);
> > +	if (!attr)
> > +		return -EINVAL;
> > +
> > +	err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_PERIOD,
> > +				    (unsigned long)&period, cpu_map_idx);
> > +	if (err)
> > +		return err;
> > +
> > +	attr->sample_period = period;
> 
> what's the point in updating attr? this will be used after event is created right?
> 
This is to maintain consistency between evsel->attr->sample_period and the sample_period of the created event.
Users can reference evsel->attr->sample_period using perf_evsel__attr().
So I thought it was necessary to update the sample_period of the event and the sample_period of evsel to avoid discrepancies.


Best Regards
Shunsuke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ