From: Robert Richter <robert.richter@amd.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Robert Richter <robert.richter@amd.com>
Subject: [PATCH 1/4] perf/core, x86: reduce number of CONFIG_X86_LOCAL_APIC macros
Date: Wed, 17 Mar 2010 12:49:10 +0100 [thread overview]
Message-ID: <1268826553-19518-2-git-send-email-robert.richter@amd.com> (raw)
In-Reply-To: <1268826553-19518-1-git-send-email-robert.richter@amd.com>
The function reserve_pmc_hardware() and release_pmc_hardware() were
hard to read. This patch improves readablity of the code by removing
most of the CONFIG_X86_LOCAL_APIC macros.
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
arch/x86/kernel/cpu/perf_event.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5dacf63..793e63f 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -313,9 +313,10 @@ again:
static atomic_t active_events;
static DEFINE_MUTEX(pmc_reserve_mutex);
+#ifdef CONFIG_X86_LOCAL_APIC
+
static bool reserve_pmc_hardware(void)
{
-#ifdef CONFIG_X86_LOCAL_APIC
int i;
if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -330,11 +331,9 @@ static bool reserve_pmc_hardware(void)
if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
goto eventsel_fail;
}
-#endif
return true;
-#ifdef CONFIG_X86_LOCAL_APIC
eventsel_fail:
for (i--; i >= 0; i--)
release_evntsel_nmi(x86_pmu.eventsel + i);
@@ -349,12 +348,10 @@ perfctr_fail:
enable_lapic_nmi_watchdog();
return false;
-#endif
}
static void release_pmc_hardware(void)
{
-#ifdef CONFIG_X86_LOCAL_APIC
int 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)
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 void release_ds_buffers(void);
--
1.7.0
next prev parent reply other threads:[~2010-03-17 11:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 11:49 [PATCH 0/4] perf/core: some small patches Robert Richter
2010-03-17 11:49 ` Robert Richter [this message]
2010-03-17 12:09 ` [tip:perf/core] perf/core, x86: Reduce number of CONFIG_X86_LOCAL_APIC macros tip-bot for Robert Richter
2010-03-17 11:49 ` [PATCH 2/4] perf/core: correct files in MAINTAINERS entry Robert Richter
2010-03-17 12:09 ` [tip:perf/core] perf/core: Correct " tip-bot for Robert Richter
2010-03-17 11:49 ` [PATCH 3/4] perf/core, x86: remove cpu_hw_events.interrupts Robert Richter
2010-03-17 12:10 ` [tip:perf/core] perf/core, x86: Remove cpu_hw_events.interrupts tip-bot for Robert Richter
2010-03-17 11:49 ` [PATCH 4/4] perf/core, x86: remove duplicate perf_event_mask variable Robert Richter
2010-03-17 12:10 ` [tip:perf/core] perf/core, x86: Remove " tip-bot for Robert Richter
2010-03-17 12:09 ` [PATCH 0/4] perf/core: some small patches Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1268826553-19518-2-git-send-email-robert.richter@amd.com \
--to=robert.richter@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®