[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291922222.6803.40.camel@twins>
Date: Thu, 09 Dec 2010 20:17:02 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Lin Ming <ming.m.lin@...el.com>
Cc: Stephane Eranian <eranian@...gle.com>,
Andi Kleen <andi@...stfloor.org>, Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
Arjan van de Ven <arjan@...radead.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 2/3 v3] perf: Implement Nehalem uncore pmu
On Tue, 2010-12-07 at 14:15 +0800, Lin Ming wrote:
> On Thu, 2010-12-02 at 13:20 +0800, Lin Ming wrote:
> > +
> > +static int
> > +uncore_perf_event_set_period(struct perf_event *event)
> > +{
> > + struct hw_perf_event *hwc = &event->hw;
> > + s64 left = local64_read(&hwc->period_left);
> > + s64 period = hwc->sample_period;
> > + u64 max_period = (1ULL << UNCORE_CNTVAL_BITS) - 1;
> > + int ret = 0, idx = hwc->idx;
> > +
> > + /*
> > + * If we are way outside a reasonable range then just skip forward:
> > + */
> > + if (unlikely(left <= -period)) {
> > + left = period;
> > + local64_set(&hwc->period_left, left);
> > + hwc->last_period = period;
> > + ret = 1;
> > + }
> > +
> > + if (unlikely(left <= 0)) {
> > + left += period;
> > + local64_set(&hwc->period_left, left);
> > + hwc->last_period = period;
> > + ret = 1;
> > + }
> > +
> > + if (left > max_period)
> > + left = max_period;
> > +
> > + /*
> > + * The hw event starts counting from this event offset,
> > + * mark it to be able to extra future deltas:
> > + */
> > + local64_set(&hwc->prev_count, (u64)-left);
>
> All uncore pmu interrupts from a socket are routed to one of the four
> cores, so local64_set seems not correct here.
>
> But hwc->prev_count is defined as local64_t, any idea how to set it
> correctly?
>
> Or is it OK if local64_set is always executed in the same cpu?
Yes, the local_t bits work as expected when its always accessed by the
same cpu.
--
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