[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f47a2146-2f1a-49fc-2306-3341154f1186@intel.com>
Date: Thu, 6 Sep 2018 16:26:24 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: tglx@...utronix.de, fenghua.yu@...el.com, tony.luck@...el.com,
mingo@...hat.com, acme@...nel.org, vikas.shivappa@...ux.intel.com,
gavin.hindman@...el.com, jithu.joseph@...el.com,
dave.hansen@...el.com, hpa@...or.com, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 4/6] x86/intel_rdt: Add helper to obtain performance
counter index
Hi Peter,
On 9/6/2018 7:47 AM, Peter Zijlstra wrote:
> On Thu, Aug 16, 2018 at 01:16:07PM -0700, Reinette Chatre wrote:
>
>> +static inline int x86_perf_rdpmc_ctr_get(struct perf_event *event)
>> +{
>> + lockdep_assert_irqs_disabled();
>> +
>> + return IS_ERR_OR_NULL(event) ? -1 : event->hw.event_base_rdpmc;
>> +}
>
> That should be in arch/x86/include/asm/perf_event.h if anywhere. Also,
> call the thing x86_perf_rdpmc_index(), that's consistent with the other
> naming.
Moving it to arch/x86/include/asm/perf_event.h is not trivial since this
file is not familiar with struct perf_event.
struct perf_event, struct hw_perf_event and its member event_base_rdpmc
are all defined in include/linux/perf_event.h - could this function
perhaps be moved there? If so, would perf_rdpmc_index() perhaps be a
better name to be consistent with the other naming?
>
> I don't think there's any point in testing for !event, this is an
> interface that mandates you know wth you're doing anyway.
>
I could add:
/* !CONFIG_PERF_EVENTS */
static inline int perf_rdpmc_index(struct perf_event *event)
{
return -1;
}
Reinette
Powered by blists - more mailing lists