perf/core, x86: Reduce number of CONFIG_X86_LOCAL_APIC macros
The function reserve_pmc_hardware() and release_pmc_hardware() were hard to read. This patch improves readability of the code by removing most of the CONFIG_X86_LOCAL_APIC macros. Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1268826553-19518-2-git-send-email-robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
3b0d516463
commit
b27ea29c62
@@ -313,9 +313,10 @@ again:
|
|||||||
static atomic_t active_events;
|
static atomic_t active_events;
|
||||||
static DEFINE_MUTEX(pmc_reserve_mutex);
|
static DEFINE_MUTEX(pmc_reserve_mutex);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_LOCAL_APIC
|
||||||
|
|
||||||
static bool reserve_pmc_hardware(void)
|
static bool reserve_pmc_hardware(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_X86_LOCAL_APIC
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (nmi_watchdog == NMI_LOCAL_APIC)
|
if (nmi_watchdog == NMI_LOCAL_APIC)
|
||||||
@@ -330,11 +331,9 @@ static bool reserve_pmc_hardware(void)
|
|||||||
if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
|
if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
|
||||||
goto eventsel_fail;
|
goto eventsel_fail;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_LOCAL_APIC
|
|
||||||
eventsel_fail:
|
eventsel_fail:
|
||||||
for (i--; i >= 0; i--)
|
for (i--; i >= 0; i--)
|
||||||
release_evntsel_nmi(x86_pmu.eventsel + i);
|
release_evntsel_nmi(x86_pmu.eventsel + i);
|
||||||
@@ -349,12 +348,10 @@ perfctr_fail:
|
|||||||
enable_lapic_nmi_watchdog();
|
enable_lapic_nmi_watchdog();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_pmc_hardware(void)
|
static void release_pmc_hardware(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_X86_LOCAL_APIC
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < x86_pmu.num_events; i++) {
|
for (i = 0; i < x86_pmu.num_events; i++) {
|
||||||
@@ -364,9 +361,15 @@ static void release_pmc_hardware(void)
|
|||||||
|
|
||||||
if (nmi_watchdog == NMI_LOCAL_APIC)
|
if (nmi_watchdog == NMI_LOCAL_APIC)
|
||||||
enable_lapic_nmi_watchdog();
|
enable_lapic_nmi_watchdog();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static bool reserve_pmc_hardware(void) { return true; }
|
||||||
|
static void release_pmc_hardware(void) {}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static int reserve_ds_buffers(void);
|
static int reserve_ds_buffers(void);
|
||||||
static void release_ds_buffers(void);
|
static void release_ds_buffers(void);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user