[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 5 May 2009 21:31:09 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Paul Mackerras <paulus@...ba.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/7] perf_counter: ioctl(PERF_COUNTER_IOC_RESET)
* Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> On Tue, 2009-05-05 at 11:31 -0700, Corey Ashford wrote:
> > Hi Peter,
> >
> > Peter Zijlstra wrote:
> >
> > > +static void perf_counter_reset(struct perf_counter *counter)
> > > +{
> > > + atomic_set(&counter->count, 0);
> > > +}
> > > +
> >
> >
> > Thanks for posting a patch for this issue.
> >
> > As Ingo said, I think the hardware counter needs to be reset as well as
> > the value saved in the perf_counter struct.
> >
>
> I don't think that's needed, we calculate a delta between prev_count and
> the current read and use that to increment counter->count. Therefore
> when we reset counter->count we should not need to touch the hardware
> counter.
>
> However, I do think we need the below, first read the hardware counter
> to ensure that delta spoken of above is as close to zero as possible
> when we reset.
>
> And update the user-page bits.
>
> ---
> Index: linux-2.6/kernel/perf_counter.c
> ===================================================================
> --- linux-2.6.orig/kernel/perf_counter.c
> +++ linux-2.6/kernel/perf_counter.c
> @@ -1299,7 +1299,9 @@ static unsigned int perf_poll(struct fil
>
> static void perf_counter_reset(struct perf_counter *counter)
> {
> + (void)perf_counter_read(counter);
> atomic_set(&counter->count, 0);
> + perf_counter_update_userpage(counter);
> }
Mind sending a changelogged patch? Thanks,
Ingo
--
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