lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130917055302.GB12926@twins.programming.kicks-ass.net>
Date:	Tue, 17 Sep 2013 07:53:02 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Yan, Zheng" <zheng.z.yan@...el.com>
Cc:	eranian@...gle.com, Ingo Molnar <mingo@...nel.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [BUG] uncore_pmu_event_init: using smp_processor_id() in
 preemptible core

On Tue, Sep 17, 2013 at 12:58:34PM +0800, Yan, Zheng wrote:
> ---
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index fd8011e..a12a22f 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -2713,7 +2713,10 @@ struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cp
>  
>  	size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);
>  
> -	box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
> +	if (cpu < 0)
> +		box = kzalloc(size, GFP_KERNEL);
> +	else
> +		box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
>  	if (!box)
>  		return NULL;

I believe -1 is a valid node number for all allocators, in which case
they fall back to the current node.

>  
> @@ -3031,7 +3034,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
>  	struct intel_uncore_box *fake_box;
>  	int ret = -EINVAL, n;
>  
> -	fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
> +	fake_box = uncore_alloc_box(pmu->type, -1);
>  	if (!fake_box)
>  		return -ENOMEM;
>  

Yes, much better indeed.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ