[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1437540961.30906.39.camel@axtens.net>
Date: Wed, 22 Jul 2015 14:56:01 +1000
From: Daniel Axtens <dja@...ens.net>
To: Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>,
Paul Mackerras <paulus@...ba.org>,
Anton Blanchard <anton@...ba.org>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
Anshuman Khandual <khandual@...ux.vnet.ibm.com>
Subject: Re: [PATCH v5 6/7] powerpc/powernv: generic nest pmu event functions
> +static void p8_nest_read_counter(struct perf_event *event)
> +{
> + uint64_t *addr;
> + u64 data = 0;
You've got a u64 and a uint64_t, and then...
> +
> + addr = (u64 *)event->hw.event_base;
... you cast to event_base to a u64 pointer, which you assign to a
uint64_t pointer.
> + data = __be64_to_cpu(*addr);
And now you dereference the pointer.
Could you just have:
data = __be64_to_cpu(*event->hw.event_base);
> + local64_set(&event->hw.prev_count, data);
> +}
> +
> +static void p8_nest_perf_event_update(struct perf_event *event)
> +{
> + u64 counter_prev, counter_new, final_count;
> + uint64_t *addr;
> +
> + addr = (uint64_t *)event->hw.event_base;
Here at least the cast type is the same as the type of addr, but again,
why do you need the different types, and why local variable?
> + counter_prev = local64_read(&event->hw.prev_count);
> + counter_new = __be64_to_cpu(*addr);
> + final_count = counter_new - counter_prev;
> +
> + local64_set(&event->hw.prev_count, counter_new);
> + local64_add(final_count, &event->count);
> +}
> +
> +static void p8_nest_event_start(struct perf_event *event, int flags)
> +{
> + event->hw.state = 0;
Should this be an enum or a #define rather than a bare 0? (It may not
need to be, I was just wondering because I don't know what 0 means.)
> + p8_nest_read_counter(event);
> +}
> +
--
Regards,
Daniel
Download attachment "signature.asc" of type "application/pgp-signature" (861 bytes)
Powered by blists - more mailing lists