Re: [PATCH 05/37] perf tools: Create separate mmap for dummy tracking event

From: Namhyung Kim
Date: Tue Dec 30 2014 - 00:56:13 EST


On Mon, Dec 29, 2014 at 03:44:21PM +0200, Adrian Hunter wrote:
> > @@ -843,9 +889,22 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
> >
> > fd = FD(evsel, cpu, thread);
> >
> > - if (*output == -1) {
> > + if (perf_evsel__is_dummy_tracking(evsel)) {
> > + struct mmap_params track_mp = {
> > + .prot = mp->prot,
> > + .len = TRACK_MMAP_SIZE,
> > + };
> > +
> > + if (__perf_evlist__mmap(evlist, &evlist->track_mmap[idx],
> > + &track_mp, fd) < 0)
> > + return -1;
> > +
> > + /* mark idx as track mmap idx (negative) */
> > + idx = track_mmap_idx(idx);
>
> Do you not still need to do SET_OUTPUT when there are multiple cpus and
> multiple pids?

You're right. I just considered simple cases, will fix.

Thanks,
Namhyung


>
>
> > + } else if (*output == -1) {
> > *output = fd;
> > - if (__perf_evlist__mmap(evlist, idx, mp, *output) < 0)
> > + if (__perf_evlist__mmap(evlist, &evlist->mmap[idx],
> > + mp, *output) < 0)
> > return -1;
> > } else {
> > if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0)
> > @@ -874,6 +933,11 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
> > perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
> > thread);
> > }
> > +
> > + if (mp->track && perf_evsel__is_dummy_tracking(evsel)) {
> > + /* restore idx as normal idx (positive) */
> > + idx = track_mmap_idx(idx);
> > + }
> > }
> >
> > return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/