From: tip-bot for Robert Richter <robert.richter@amd.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, robert.richter@amd.com, a.p.zijlstra@chello.nl,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/core] perf_counter, x86: make x86_pmu data a static struct
Date: Wed, 29 Apr 2009 13:05:58 GMT [thread overview]
Message-ID: <tip-4a06bd8508f65ad1dd5cd2046b85694813fa36a2@git.kernel.org> (raw)
In-Reply-To: <1241002046-8832-15-git-send-email-robert.richter@amd.com>
Commit-ID: 4a06bd8508f65ad1dd5cd2046b85694813fa36a2
Gitweb: http://git.kernel.org/tip/4a06bd8508f65ad1dd5cd2046b85694813fa36a2
Author: Robert Richter <robert.richter@amd.com>
AuthorDate: Wed, 29 Apr 2009 12:47:11 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 29 Apr 2009 14:51:07 +0200
perf_counter, x86: make x86_pmu data a static struct
Instead of using a pointer to reference to the x86 pmu we now have one
single data structure that is initialized at the beginning. This saves
the pointer access when using this memory.
[ Impact: micro-optimization ]
Signed-off-by: Robert Richter <robert.richter@amd.com>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1241002046-8832-15-git-send-email-robert.richter@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/perf_counter.c | 50 ++++++++++++++++++------------------
1 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 7c72a94..68597d7 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -60,7 +60,7 @@ struct x86_pmu {
int max_events;
};
-static struct x86_pmu *x86_pmu __read_mostly;
+static struct x86_pmu x86_pmu __read_mostly;
static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = {
.enabled = 1,
@@ -184,12 +184,12 @@ static bool reserve_pmc_hardware(void)
disable_lapic_nmi_watchdog();
for (i = 0; i < nr_counters_generic; i++) {
- if (!reserve_perfctr_nmi(x86_pmu->perfctr + i))
+ if (!reserve_perfctr_nmi(x86_pmu.perfctr + i))
goto perfctr_fail;
}
for (i = 0; i < nr_counters_generic; i++) {
- if (!reserve_evntsel_nmi(x86_pmu->eventsel + i))
+ if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
goto eventsel_fail;
}
@@ -197,13 +197,13 @@ static bool reserve_pmc_hardware(void)
eventsel_fail:
for (i--; i >= 0; i--)
- release_evntsel_nmi(x86_pmu->eventsel + i);
+ release_evntsel_nmi(x86_pmu.eventsel + i);
i = nr_counters_generic;
perfctr_fail:
for (i--; i >= 0; i--)
- release_perfctr_nmi(x86_pmu->perfctr + i);
+ release_perfctr_nmi(x86_pmu.perfctr + i);
if (nmi_watchdog == NMI_LOCAL_APIC)
enable_lapic_nmi_watchdog();
@@ -216,8 +216,8 @@ static void release_pmc_hardware(void)
int i;
for (i = 0; i < nr_counters_generic; i++) {
- release_perfctr_nmi(x86_pmu->perfctr + i);
- release_evntsel_nmi(x86_pmu->eventsel + i);
+ release_perfctr_nmi(x86_pmu.perfctr + i);
+ release_evntsel_nmi(x86_pmu.eventsel + i);
}
if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -297,14 +297,14 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
* Raw event type provide the config in the event structure
*/
if (perf_event_raw(hw_event)) {
- hwc->config |= x86_pmu->raw_event(perf_event_config(hw_event));
+ hwc->config |= x86_pmu.raw_event(perf_event_config(hw_event));
} else {
- if (perf_event_id(hw_event) >= x86_pmu->max_events)
+ if (perf_event_id(hw_event) >= x86_pmu.max_events)
return -EINVAL;
/*
* The generic map:
*/
- hwc->config |= x86_pmu->event_map(perf_event_id(hw_event));
+ hwc->config |= x86_pmu.event_map(perf_event_id(hw_event));
}
counter->destroy = hw_perf_counter_destroy;
@@ -356,7 +356,7 @@ u64 hw_perf_save_disable(void)
if (unlikely(!perf_counters_initialized))
return 0;
- return x86_pmu->save_disable_all();
+ return x86_pmu.save_disable_all();
}
/*
* Exported because of ACPI idle
@@ -396,7 +396,7 @@ void hw_perf_restore(u64 ctrl)
if (unlikely(!perf_counters_initialized))
return;
- x86_pmu->restore_all(ctrl);
+ x86_pmu.restore_all(ctrl);
}
/*
* Exported because of ACPI idle
@@ -441,7 +441,7 @@ static void hw_perf_enable(int idx, u64 config)
if (unlikely(!perf_counters_initialized))
return;
- x86_pmu->enable(idx, config);
+ x86_pmu.enable(idx, config);
}
static void intel_pmu_disable_counter(int idx, u64 config)
@@ -463,7 +463,7 @@ static void hw_perf_disable(int idx, u64 config)
if (unlikely(!perf_counters_initialized))
return;
- x86_pmu->disable(idx, config);
+ x86_pmu.disable(idx, config);
}
static inline void
@@ -580,11 +580,11 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
event = hwc->config & ARCH_PERFMON_EVENT_MASK;
- if (unlikely(event == x86_pmu->event_map(PERF_COUNT_INSTRUCTIONS)))
+ if (unlikely(event == x86_pmu.event_map(PERF_COUNT_INSTRUCTIONS)))
return X86_PMC_IDX_FIXED_INSTRUCTIONS;
- if (unlikely(event == x86_pmu->event_map(PERF_COUNT_CPU_CYCLES)))
+ if (unlikely(event == x86_pmu.event_map(PERF_COUNT_CPU_CYCLES)))
return X86_PMC_IDX_FIXED_CPU_CYCLES;
- if (unlikely(event == x86_pmu->event_map(PERF_COUNT_BUS_CYCLES)))
+ if (unlikely(event == x86_pmu.event_map(PERF_COUNT_BUS_CYCLES)))
return X86_PMC_IDX_FIXED_BUS_CYCLES;
return -1;
@@ -628,8 +628,8 @@ try_generic:
set_bit(idx, cpuc->used);
hwc->idx = idx;
}
- hwc->config_base = x86_pmu->eventsel;
- hwc->counter_base = x86_pmu->perfctr;
+ hwc->config_base = x86_pmu.eventsel;
+ hwc->counter_base = x86_pmu.perfctr;
}
perf_counters_lapic_init(hwc->nmi);
@@ -677,8 +677,8 @@ void perf_counter_print_debug(void)
pr_info("CPU#%d: used: %016llx\n", cpu, *(u64 *)cpuc->used);
for (idx = 0; idx < nr_counters_generic; idx++) {
- rdmsrl(x86_pmu->eventsel + idx, pmc_ctrl);
- rdmsrl(x86_pmu->perfctr + idx, pmc_count);
+ rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
+ rdmsrl(x86_pmu.perfctr + idx, pmc_count);
prev_left = per_cpu(prev_left[idx], cpu);
@@ -819,7 +819,7 @@ void smp_perf_counter_interrupt(struct pt_regs *regs)
irq_enter();
apic_write(APIC_LVTPC, LOCAL_PERF_VECTOR);
ack_APIC_irq();
- x86_pmu->handle_irq(regs, 0);
+ x86_pmu.handle_irq(regs, 0);
irq_exit();
}
@@ -876,7 +876,7 @@ perf_counter_nmi_handler(struct notifier_block *self,
regs = args->regs;
apic_write(APIC_LVTPC, APIC_DM_NMI);
- ret = x86_pmu->handle_irq(regs, 1);
+ ret = x86_pmu.handle_irq(regs, 1);
return ret ? NOTIFY_STOP : NOTIFY_OK;
}
@@ -940,7 +940,7 @@ static int intel_pmu_init(void)
pr_info("... bit width: %d\n", eax.split.bit_width);
pr_info("... mask length: %d\n", eax.split.mask_length);
- x86_pmu = &intel_pmu;
+ x86_pmu = intel_pmu;
nr_counters_generic = eax.split.num_counters;
nr_counters_fixed = edx.split.num_counters_fixed;
@@ -951,7 +951,7 @@ static int intel_pmu_init(void)
static int amd_pmu_init(void)
{
- x86_pmu = &amd_pmu;
+ x86_pmu = amd_pmu;
nr_counters_generic = 4;
nr_counters_fixed = 0;
next prev parent reply other threads:[~2009-04-29 13:09 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-29 10:46 [PATCH 0/29] x86/perfcounters: x86 and AMD cpu updates Robert Richter
2009-04-29 10:46 ` [PATCH 01/29] x86: perfcounter: remove X86_FEATURE_ARCH_PERFMON flag for AMD cpus Robert Richter
2009-04-29 11:21 ` Ingo Molnar
2009-04-29 13:03 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-05-10 5:02 ` Jaswinder Singh Rajput
2009-05-10 5:53 ` Jaswinder Singh Rajput
2009-05-10 6:30 ` Ingo Molnar
2009-05-10 6:51 ` Jaswinder Singh Rajput
2009-05-11 10:02 ` Ingo Molnar
2009-05-11 10:27 ` Jaswinder Singh Rajput
2009-05-11 12:05 ` Ingo Molnar
2009-05-11 12:13 ` Jaswinder Singh Rajput
2009-05-11 12:39 ` Robert Richter
2009-05-11 13:07 ` Jaswinder Singh Rajput
2009-05-11 13:15 ` Robert Richter
2009-04-29 10:46 ` [PATCH 02/29] perfcounter: declare perf_max_counters only for CONFIG_PERF_COUNTERS Robert Richter
2009-04-29 13:03 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 03/29] x86/perfcounters: add default path to cpu detection Robert Richter
2009-04-29 13:03 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 04/29] x86/perfcounters: rework pmc_amd_save_disable_all() and pmc_amd_restore_all() Robert Richter
2009-04-29 11:07 ` Peter Zijlstra
2009-04-29 11:11 ` Ingo Molnar
2009-04-29 11:16 ` Peter Zijlstra
2009-04-29 11:19 ` Ingo Molnar
2009-04-29 11:27 ` Peter Zijlstra
2009-04-29 12:33 ` Paul Mackerras
2009-04-29 12:55 ` Ingo Molnar
2009-04-29 13:04 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 05/29] x86/perfcounters: protect per-cpu variables with compile barriers only Robert Richter
2009-04-29 13:04 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 06/29] perfcounters: rename struct hw_perf_counter_ops into struct pmu Robert Richter
2009-04-29 13:04 ` [tip:perfcounters/core] " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 07/29] x86/perfcounters: rename struct pmc_x86_ops into struct x86_pmu Robert Richter
2009-04-29 13:04 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 08/29] x86/perfcounters: make interrupt handler model specific Robert Richter
2009-04-29 13:04 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 09/29] x86/perfcounters: remove get_status() from struct x86_pmu Robert Richter
2009-04-29 13:05 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 10/29] x86/perfcounters: remove ack_status() " Robert Richter
2009-04-29 13:05 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 11/29] x86/perfcounters: rename __hw_perf_counter_set_period into x86_perf_counter_set_period Robert Richter
2009-04-29 13:05 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 12/29] x86/perfcounters: rename intel only functions Robert Richter
2009-04-29 13:05 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 13/29] x86/perfcounters: modify initialization of struct x86_pmu Robert Richter
2009-04-29 13:05 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 14/29] x86/perfcounters: make x86_pmu data a static struct Robert Richter
2009-04-29 13:05 ` tip-bot for Robert Richter [this message]
2009-04-29 10:47 ` [PATCH 15/29] x86/perfcounters: move counter parameters to struct x86_pmu Robert Richter
2009-04-29 13:06 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 16/29] x86/perfcounters: make pmu version generic Robert Richter
2009-04-29 13:06 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 17/29] x86/perfcounters: make x86_pmu_read() static inline Robert Richter
2009-04-29 13:06 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 18/29] x86/perfcounters: rename cpuc->active_mask Robert Richter
2009-04-29 11:24 ` Ingo Molnar
2009-04-29 13:06 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 13:10 ` Ingo Molnar
2009-04-29 14:55 ` [PATCH] perf_counter, x86: rename bitmasks to ->used_mask and ->active_mask Robert Richter
2009-04-29 20:21 ` [tip:perfcounters/core] " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 19/29] x86/perfcounters: generic use of cpuc->active Robert Richter
2009-04-29 13:06 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 20/29] x86/perfcounters: consistent use of type int for counter index Robert Richter
2009-04-29 13:07 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 21/29] x86/perfcounters: rework counter enable functions Robert Richter
2009-04-29 13:07 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 22/29] x86/perfcounters: rework counter disable functions Robert Richter
2009-04-29 13:07 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 23/29] x86/perfcounters: change and remove pmu initialization checks Robert Richter
2009-04-29 13:07 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 24/29] x86/perfcounters: implement the interrupt handler for AMD cpus Robert Richter
2009-04-29 13:07 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 25/29] x86/perfcounters: return raw count with x86_perf_counter_update() Robert Richter
2009-04-29 13:08 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 26/29] x86/perfcounters: introduce max_period variable Robert Richter
2009-04-29 11:14 ` Ingo Molnar
2009-04-29 13:08 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 27/29] x86/perfcounters: remove vendor check in fixed_mode_idx() Robert Richter
2009-04-29 13:08 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-05-04 18:24 ` [tip:perfcounters/core] perf_counter: fix fixed-purpose counter support on v2 Intel-PERFMON tip-bot for Ingo Molnar
2009-04-29 10:47 ` [PATCH 28/29] x86/perfcounters: remove unused function argument in intel_pmu_get_status() Robert Richter
2009-04-29 13:08 ` [tip:perfcounters/core] perf_counter, x86: " tip-bot for Robert Richter
2009-04-29 10:47 ` [PATCH 29/29] perfcounters: updating kerneltop documentation Robert Richter
2009-04-29 11:12 ` Ingo Molnar
2009-04-29 13:08 ` [tip:perfcounters/core] perf_counter: update 'perf top' documentation tip-bot for Robert Richter
2009-04-29 11:09 ` [PATCH 0/29] x86/perfcounters: x86 and AMD cpu updates Ingo Molnar
2009-04-29 11:22 ` Peter Zijlstra
2009-04-29 11:28 ` 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=tip-4a06bd8508f65ad1dd5cd2046b85694813fa36a2@git.kernel.org \
--to=robert.richter@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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