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]
Date:	Mon, 5 Aug 2013 13:10:52 -0300
From:	Arnaldo Carvalho de Melo <acme@...radead.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Andi Kleen <andi@...stfloor.org>, eranian@...gle.com,
	jolsa@...hat.com, linux-kernel@...r.kernel.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 2/5] tools, perf: Add support to evsel for enabling
 counters

Em Mon, Aug 05, 2013 at 05:28:14PM +0900, Namhyung Kim escreveu:
> Hi Andi,
> 
> On Fri,  2 Aug 2013 17:41:10 -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@...ux.intel.com>
> >
> > Add support for enabling already set up counters by using an
> > ioctl. I share some code with the filter setup.
> >
> > Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> > ---
> >  tools/perf/util/evsel.c | 21 ++++++++++++++++++---
> >  tools/perf/util/evsel.h |  1 +
> >  2 files changed, 19 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index c9c7494..60e0d84 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -605,16 +605,16 @@ int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
> >  	return evsel->fd != NULL ? 0 : -ENOMEM;
> >  }
> >  
> > -int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
> > -			   const char *filter)
> > +static int perf_evsel__run_ioctl(struct perf_evsel *evsel, int ncpus, int nthreads,
> > +			  int ioc,  void *arg)
> >  {
> >  	int cpu, thread;
> >  
> >  	for (cpu = 0; cpu < ncpus; cpu++) {
> >  		for (thread = 0; thread < nthreads; thread++) {
> >  			int fd = FD(evsel, cpu, thread),
> > -			    err = ioctl(fd, PERF_EVENT_IOC_SET_FILTER, filter);
> >  
> > +			err = ioctl(fd, ioc, arg);
> 
> Looks very strange to have a blank line between variable declarations.
> You'd better separating declarations on the other lines like:
> 
> 			int fd, err;
> 
> 			fd = FD(evsel, cpu, thread);
> 			err = ioctl(fd, ioc, arg);

Preferences :-) I think the best way is:

			int fd = FD(evsel, cpu, thread),
			    err = ioctl(fd, ioc, arg);

As its all short and so uses 2 instead of 4 lines. I'll fix up the
alignment.

> 
> Thanks,
> Namhyung
> 
> 
> >  			if (err)
> >  				return err;
> >  		}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ