[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110801213142.GE11795@erda.amd.com>
Date: Mon, 1 Aug 2011 23:31:42 +0200
From: Robert Richter <robert.richter@....com>
To: Maarten Lankhorst <m.b.lankhorst@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC: Thomas Gleixner <tglx@...utronix.de>,
"x86@...nel.org" <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH v3] oprofile, x86: Convert memory allocation to static
array
On 01.08.11 11:08:59, Maarten Lankhorst wrote:
> On -rt, allocators don't work from atomic context any more,
> and the maximum size of the array is known at compile time.
>
> Signed-off-by: Maarten Lankhorst <m.b.lankhorst@...il.com>
Applied to oprofile/core. Thanks, Maarten.
Ingo, Peter,
do you want this for 3.1 (perf/urgent) or 3.2?
-Robert
>
> ---
>
> diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
> index 94b7450..608874b 100644
> --- a/arch/x86/oprofile/op_model_ppro.c
> +++ b/arch/x86/oprofile/op_model_ppro.c
> @@ -28,7 +28,7 @@ static int counter_width = 32;
>
> #define MSR_PPRO_EVENTSEL_RESERVED ((0xFFFFFFFFULL<<32)|(1ULL<<21))
>
> -static u64 *reset_value;
> +static u64 reset_value[OP_MAX_COUNTER];
>
> static void ppro_shutdown(struct op_msrs const * const msrs)
> {
> @@ -40,10 +40,6 @@ static void ppro_shutdown(struct op_msrs const * const msrs)
> release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
> release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
> }
> - if (reset_value) {
> - kfree(reset_value);
> - reset_value = NULL;
> - }
> }
>
> static int ppro_fill_in_addresses(struct op_msrs * const msrs)
> @@ -79,13 +75,6 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
> u64 val;
> int i;
>
> - if (!reset_value) {
> - reset_value = kzalloc(sizeof(reset_value[0]) * num_counters,
> - GFP_ATOMIC);
> - if (!reset_value)
> - return;
> - }
> -
> if (cpu_has_arch_perfmon) {
> union cpuid10_eax eax;
> eax.full = cpuid_eax(0xa);
> @@ -141,13 +130,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
> u64 val;
> int i;
>
> - /*
> - * This can happen if perf counters are in use when
> - * we steal the die notifier NMI.
> - */
> - if (unlikely(!reset_value))
> - goto out;
> -
> for (i = 0; i < num_counters; ++i) {
> if (!reset_value[i])
> continue;
> @@ -179,8 +161,6 @@ static void ppro_start(struct op_msrs const * const msrs)
> u64 val;
> int i;
>
> - if (!reset_value)
> - return;
> for (i = 0; i < num_counters; ++i) {
> if (reset_value[i]) {
> rdmsrl(msrs->controls[i].addr, val);
> @@ -196,8 +176,6 @@ static void ppro_stop(struct op_msrs const * const msrs)
> u64 val;
> int i;
>
> - if (!reset_value)
> - return;
> for (i = 0; i < num_counters; ++i) {
> if (!reset_value[i])
> continue;
>
>
>
--
Advanced Micro Devices, Inc.
Operating System Research Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists