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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101029202809.GB6130@lenovo>
Date:	Sat, 30 Oct 2010 00:28:09 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	eric.dumazet@...il.com, brgerst@...il.com, tglx@...utronix.de,
	mingo@...e.hu, linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/urgent] x86-32: Restore irq stacks NUMA-aware
	allocations

On Fri, Oct 29, 2010 at 08:32:26PM +0200, Peter Zijlstra wrote:
> On Fri, 2010-10-29 at 06:43 +0000, tip-bot for Eric Dumazet wrote:
> > +       irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
> > +                                              THREAD_FLAGS,
> > +                                              THREAD_ORDER)); 
> 
> Shouldn't we be checking for a NULL return from alloc_pages_node()
> before calling page_address() on it?
> --

 Something like below I guess, but probably we could try to allocate
on appropriate NUMA node first and if it fails -- via old alloc_pages
and if it fail in turn -- then we panic.

  Cyrill
---
 arch/x86/kernel/irq_32.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irq_32.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irq_32.c
+++ linux-2.6.git/arch/x86/kernel/irq_32.c
@@ -122,13 +122,16 @@ execute_on_irq_stack(int overflow, struc
 void __cpuinit irq_ctx_init(int cpu)
 {
 	union irq_ctx *irqctx;
+	struct page *page;
 
 	if (per_cpu(hardirq_ctx, cpu))
 		return;
 
-	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+	page = alloc_pages_node(cpu_to_node(cpu),
+				THREAD_FLAGS, THREAD_ORDER);
+	BUG_ON(!page);
+
+	irqctx				= page_address(page);
 	irqctx->tinfo.task		= NULL;
 	irqctx->tinfo.exec_domain	= NULL;
 	irqctx->tinfo.cpu		= cpu;
@@ -137,9 +140,11 @@ void __cpuinit irq_ctx_init(int cpu)
 
 	per_cpu(hardirq_ctx, cpu) = irqctx;
 
-	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+	page = alloc_pages_node(cpu_to_node(cpu),
+				THREAD_FLAGS, THREAD_ORDER);
+	BUG_ON(!page);
+
+	irqctx				= page_address(page);
 	irqctx->tinfo.task		= NULL;
 	irqctx->tinfo.exec_domain	= NULL;
 	irqctx->tinfo.cpu		= cpu;
--
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