LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add crashdump shutdown hooks
From: Michael Neuling @ 2008-01-18  4:50 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <1200608167.508733.302962562869.qpush@coopers>

The following patches add crashdump shutdown hooks for POWERPC.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Sorry, last update didn't include both patches.

^ permalink raw reply

* [PATCH 1/2] Make setjmp/longjmp code generic
From: Michael Neuling @ 2008-01-18  4:50 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <1200631830.307661.474596673142.qpush@coopers>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6605 bytes --]

This makes the setjmp/longjmp code used by xmon, generically available
to other code.  It also removes the requirement for debugger hooks to
be only called on 0x300 (data storage) exception.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---

 arch/powerpc/kernel/misc.S   |   65 +++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/mm/fault.c      |    6 +--
 arch/powerpc/xmon/setjmp.S   |   61 ----------------------------------------
 arch/powerpc/xmon/xmon.c     |    6 ---
 include/asm-powerpc/setjmp.h |   18 +++++++++++
 5 files changed, 86 insertions(+), 70 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/misc.S
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/misc.S
+++ linux-2.6-ozlabs/arch/powerpc/kernel/misc.S
@@ -8,6 +8,8 @@
  * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
  * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
  *
+ * setjmp/longjmp code by Paul Mackerras.
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version
@@ -15,6 +17,8 @@
  */
 #include <asm/ppc_asm.h>
 #include <asm/unistd.h>
+#include <asm/asm-compat.h>
+#include <asm/asm-offsets.h>
 
 	.text
 
@@ -51,3 +55,64 @@ _GLOBAL(kernel_execve)
 	bnslr
 	neg	r3,r3
 	blr
+
+_GLOBAL(setjmp)
+	mflr	r0
+	PPC_STL	r0,0(r3)
+	PPC_STL	r1,SZL(r3)
+	PPC_STL	r2,2*SZL(r3)
+	mfcr	r0
+	PPC_STL	r0,3*SZL(r3)
+	PPC_STL	r13,4*SZL(r3)
+	PPC_STL	r14,5*SZL(r3)
+	PPC_STL	r15,6*SZL(r3)
+	PPC_STL	r16,7*SZL(r3)
+	PPC_STL	r17,8*SZL(r3)
+	PPC_STL	r18,9*SZL(r3)
+	PPC_STL	r19,10*SZL(r3)
+	PPC_STL	r20,11*SZL(r3)
+	PPC_STL	r21,12*SZL(r3)
+	PPC_STL	r22,13*SZL(r3)
+	PPC_STL	r23,14*SZL(r3)
+	PPC_STL	r24,15*SZL(r3)
+	PPC_STL	r25,16*SZL(r3)
+	PPC_STL	r26,17*SZL(r3)
+	PPC_STL	r27,18*SZL(r3)
+	PPC_STL	r28,19*SZL(r3)
+	PPC_STL	r29,20*SZL(r3)
+	PPC_STL	r30,21*SZL(r3)
+	PPC_STL	r31,22*SZL(r3)
+	li	r3,0
+	blr
+
+_GLOBAL(longjmp)
+	PPC_LCMPI r4,0
+	bne	1f
+	li	r4,1
+1:	PPC_LL	r13,4*SZL(r3)
+	PPC_LL	r14,5*SZL(r3)
+	PPC_LL	r15,6*SZL(r3)
+	PPC_LL	r16,7*SZL(r3)
+	PPC_LL	r17,8*SZL(r3)
+	PPC_LL	r18,9*SZL(r3)
+	PPC_LL	r19,10*SZL(r3)
+	PPC_LL	r20,11*SZL(r3)
+	PPC_LL	r21,12*SZL(r3)
+	PPC_LL	r22,13*SZL(r3)
+	PPC_LL	r23,14*SZL(r3)
+	PPC_LL	r24,15*SZL(r3)
+	PPC_LL	r25,16*SZL(r3)
+	PPC_LL	r26,17*SZL(r3)
+	PPC_LL	r27,18*SZL(r3)
+	PPC_LL	r28,19*SZL(r3)
+	PPC_LL	r29,20*SZL(r3)
+	PPC_LL	r30,21*SZL(r3)
+	PPC_LL	r31,22*SZL(r3)
+	PPC_LL	r0,3*SZL(r3)
+	mtcrf	0x38,r0
+	PPC_LL	r0,0(r3)
+	PPC_LL	r1,SZL(r3)
+	PPC_LL	r2,2*SZL(r3)
+	mtlr	r0
+	mr	r3,r4
+	blr
Index: linux-2.6-ozlabs/arch/powerpc/mm/fault.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/fault.c
+++ linux-2.6-ozlabs/arch/powerpc/mm/fault.c
@@ -167,10 +167,8 @@ int __kprobes do_page_fault(struct pt_re
 	if (notify_page_fault(regs))
 		return 0;
 
-	if (trap == 0x300) {
-		if (debugger_fault_handler(regs))
-			return 0;
-	}
+	if (unlikely(debugger_fault_handler(regs)))
+		return 0;
 
 	/* On a kernel SLB miss we can only check for a valid exception entry */
 	if (!user_mode(regs) && (address >= TASK_SIZE))
Index: linux-2.6-ozlabs/arch/powerpc/xmon/setjmp.S
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/xmon/setjmp.S
+++ linux-2.6-ozlabs/arch/powerpc/xmon/setjmp.S
@@ -12,67 +12,6 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
-_GLOBAL(xmon_setjmp)
-	mflr	r0
-	PPC_STL	r0,0(r3)
-	PPC_STL	r1,SZL(r3)
-	PPC_STL	r2,2*SZL(r3)
-	mfcr	r0
-	PPC_STL	r0,3*SZL(r3)
-	PPC_STL	r13,4*SZL(r3)
-	PPC_STL	r14,5*SZL(r3)
-	PPC_STL	r15,6*SZL(r3)
-	PPC_STL	r16,7*SZL(r3)
-	PPC_STL	r17,8*SZL(r3)
-	PPC_STL	r18,9*SZL(r3)
-	PPC_STL	r19,10*SZL(r3)
-	PPC_STL	r20,11*SZL(r3)
-	PPC_STL	r21,12*SZL(r3)
-	PPC_STL	r22,13*SZL(r3)
-	PPC_STL	r23,14*SZL(r3)
-	PPC_STL	r24,15*SZL(r3)
-	PPC_STL	r25,16*SZL(r3)
-	PPC_STL	r26,17*SZL(r3)
-	PPC_STL	r27,18*SZL(r3)
-	PPC_STL	r28,19*SZL(r3)
-	PPC_STL	r29,20*SZL(r3)
-	PPC_STL	r30,21*SZL(r3)
-	PPC_STL	r31,22*SZL(r3)
-	li	r3,0
-	blr
-
-_GLOBAL(xmon_longjmp)
-	PPC_LCMPI r4,0
-	bne	1f
-	li	r4,1
-1:	PPC_LL	r13,4*SZL(r3)
-	PPC_LL	r14,5*SZL(r3)
-	PPC_LL	r15,6*SZL(r3)
-	PPC_LL	r16,7*SZL(r3)
-	PPC_LL	r17,8*SZL(r3)
-	PPC_LL	r18,9*SZL(r3)
-	PPC_LL	r19,10*SZL(r3)
-	PPC_LL	r20,11*SZL(r3)
-	PPC_LL	r21,12*SZL(r3)
-	PPC_LL	r22,13*SZL(r3)
-	PPC_LL	r23,14*SZL(r3)
-	PPC_LL	r24,15*SZL(r3)
-	PPC_LL	r25,16*SZL(r3)
-	PPC_LL	r26,17*SZL(r3)
-	PPC_LL	r27,18*SZL(r3)
-	PPC_LL	r28,19*SZL(r3)
-	PPC_LL	r29,20*SZL(r3)
-	PPC_LL	r30,21*SZL(r3)
-	PPC_LL	r31,22*SZL(r3)
-	PPC_LL	r0,3*SZL(r3)
-	mtcrf	0x38,r0
-	PPC_LL	r0,0(r3)
-	PPC_LL	r1,SZL(r3)
-	PPC_LL	r2,2*SZL(r3)
-	mtlr	r0
-	mr	r3,r4
-	blr
-
 /*
  * Grab the register values as they are now.
  * This won't do a particularily good job because we really
Index: linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/xmon/xmon.c
+++ linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
@@ -40,6 +40,7 @@
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
 #include <asm/firmware.h>
+#include <asm/setjmp.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
@@ -71,12 +72,9 @@ static unsigned long ncsum = 4096;
 static int termch;
 static char tmpstr[128];
 
-#define JMP_BUF_LEN	23
 static long bus_error_jmp[JMP_BUF_LEN];
 static int catch_memory_errors;
 static long *xmon_fault_jmp[NR_CPUS];
-#define setjmp xmon_setjmp
-#define longjmp xmon_longjmp
 
 /* Breakpoint stuff */
 struct bpt {
@@ -162,8 +160,6 @@ int xmon_no_auto_backtrace;
 extern void xmon_enter(void);
 extern void xmon_leave(void);
 
-extern long setjmp(long *);
-extern void longjmp(long *, long);
 extern void xmon_save_regs(struct pt_regs *);
 
 #ifdef CONFIG_PPC64
Index: linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
===================================================================
--- /dev/null
+++ linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright © 2008 Michael Neuling IBM Corporation
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      as published by the Free Software Foundation; either version
+ *      2 of the License, or (at your option) any later version.
+ *
+ */
+#ifndef _ASM_POWERPC_SETJMP_H
+#define _ASM_POWERPC_SETJMP_H
+
+#define JMP_BUF_LEN    23
+
+extern long setjmp(long *);
+extern void longjmp(long *, long);
+
+#endif /* _ASM_POWERPC_SETJMP_H */

^ permalink raw reply

* [PATCH 2/2] kdump shutdown hook support
From: Michael Neuling @ 2008-01-18  4:50 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <1200631830.307661.474596673142.qpush@coopers>

This adds hooks into the default_machine_crash_shutdown so drivers can
register a function to be run in the first kernel before we hand off
to the second kernel.  This should only be used in exceptional
circumstances, like where the device can't be reset in the second
kernel alone (as is the case with eHEA).  To emphasize this, the
number of handles allowed to be registered is currently #def to 1.

This uses the setjmp/longjmp code to call out to the registered hooks,
so any bogus exceptions we encounter will hopefully be recoverable.  

Tested with bogus data and instruction exceptions.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---

 arch/powerpc/kernel/crash.c |  106 +++++++++++++++++++++++++++++++++++++++++---
 include/asm-powerpc/kexec.h |    3 +
 2 files changed, 104 insertions(+), 5 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/crash.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/crash.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/crash.c
@@ -32,6 +32,8 @@
 #include <asm/lmb.h>
 #include <asm/firmware.h>
 #include <asm/smp.h>
+#include <asm/system.h>
+#include <asm/setjmp.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
@@ -45,6 +47,11 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
+#define CRASH_HANDLER_MAX 1
+/* NULL terminated list of shutdown handles */
+static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
+static DEFINE_SPINLOCK(crash_handlers_lock);
+
 #ifdef CONFIG_SMP
 static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
 
@@ -285,9 +292,72 @@ static inline void crash_kexec_stop_spus
 }
 #endif /* CONFIG_SPU_BASE */
 
+/*
+ * Register a function to be called on shutdown.  Only use this if you
+ * can't reset your device in the second kernel.
+ */
+int crash_shutdown_register(crash_shutdown_t handler)
+{
+	unsigned int i, rc;
+
+	spin_lock(&crash_handlers_lock);
+	for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
+		if (!crash_shutdown_handles[i]) {
+			/* Insert handle at first empty entry */
+			crash_shutdown_handles[i] = handler;
+			rc = 0;
+			break;
+		}
+
+	if (i == CRASH_HANDLER_MAX) {
+		printk(KERN_ERR "Crash shutdown handles full, "
+		       "not registered.\n");
+		rc = 1;
+	}
+
+	spin_unlock(&crash_handlers_lock);
+	return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_register);
+
+int crash_shutdown_unregister(crash_shutdown_t handler)
+{
+	unsigned int i, rc;
+
+	spin_lock(&crash_handlers_lock);
+	for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
+		if (crash_shutdown_handles[i] == handler)
+			break;
+
+	if (i == CRASH_HANDLER_MAX) {
+		printk(KERN_ERR "Crash shutdown handle not found\n");
+		rc = 1;
+	} else {
+		/* Shift handles down */
+		for (; crash_shutdown_handles[i]; i++)
+			crash_shutdown_handles[i] =
+				crash_shutdown_handles[i+1];
+		rc = 0;
+	}
+
+	spin_unlock(&crash_handlers_lock);
+	return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_unregister);
+
+static unsigned long crash_shutdown_buf[JMP_BUF_LEN];
+
+static int handle_fault(struct pt_regs *regs)
+{
+	longjmp(crash_shutdown_buf, 1);
+	return 0;
+}
+
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
-	unsigned int irq;
+	unsigned int i;
+	int (*old_handler)(struct pt_regs *regs);
+
 
 	/*
 	 * This function is only called after the system
@@ -301,15 +371,41 @@ void default_machine_crash_shutdown(stru
 	 */
 	hard_irq_disable();
 
-	for_each_irq(irq) {
-		struct irq_desc *desc = irq_desc + irq;
+	for_each_irq(i) {
+		struct irq_desc *desc = irq_desc + i;
 
 		if (desc->status & IRQ_INPROGRESS)
-			desc->chip->eoi(irq);
+			desc->chip->eoi(i);
 
 		if (!(desc->status & IRQ_DISABLED))
-			desc->chip->disable(irq);
+			desc->chip->disable(i);
+	}
+
+	/*
+	 * Call registered shutdown routines savely.  Swap out
+	 * __debugger_fault_handler, and replace on exit.
+	 */
+	old_handler = __debugger_fault_handler;
+	__debugger_fault_handler = handle_fault;
+	for (i = 0; crash_shutdown_handles[i]; i++) {
+		if (setjmp(crash_shutdown_buf) == 0) {
+			/*
+			 * Insert syncs and delay to ensure
+			 * instructions in the dangerous region don't
+			 * leak away from this protected region.
+			 */
+			asm volatile("sync; isync");
+			/* dangerous region */
+			crash_shutdown_handles[i]();
+			asm volatile("sync; isync");
+			/* 
+			 * wait a little while to see if we get a
+			 * machine check 
+			 */
+			__delay(200);
+		}
 	}
+	__debugger_fault_handler = old_handler;
 
 	/*
 	 * Make a note of crashing cpu. Will be used in machine_kexec
Index: linux-2.6-ozlabs/include/asm-powerpc/kexec.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/kexec.h
+++ linux-2.6-ozlabs/include/asm-powerpc/kexec.h
@@ -123,6 +123,9 @@ struct pt_regs;
 extern void default_machine_kexec(struct kimage *image);
 extern int default_machine_kexec_prepare(struct kimage *image);
 extern void default_machine_crash_shutdown(struct pt_regs *regs);
+typedef void (*crash_shutdown_t)(void);
+extern int crash_shutdown_register(crash_shutdown_t handler);
+extern int crash_shutdown_unregister(crash_shutdown_t handler);
 
 extern void machine_kexec_simple(struct kimage *image);
 extern void crash_kexec_secondary(struct pt_regs *regs);

^ permalink raw reply

* Re: [PATCH] Fake NUMA emulation for PowerPC (Take 2)
From: Michael Ellerman @ 2008-01-18  5:34 UTC (permalink / raw)
  To: Balbir Singh; +Cc: linuxppc-dev, LKML
In-Reply-To: <20071207223714.11448.91386.sendpatchset@balbir-laptop>

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

On Sat, 2007-12-08 at 04:07 +0530, Balbir Singh wrote:
> Changelog
> 
> 1. Get rid of the constant 5 (based on comments from
>                                 Geert.Uytterhoeven@sonycom.com)
> 2. Implement suggestions from Olof Johannson
> 3. Check if cmdline is NULL in fake_numa_create_new_node()
> 
> Tested with additional parameters from Olof
> 
> numa=debug,fake=
> numa=foo,fake=bar


I'm not sure why yet, but git bisect tells me it's this patch that's
causing the for-2.6.25 tree to explode on boot on cell machines.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Fake NUMA emulation for PowerPC (Take 2)
From: Michael Ellerman @ 2008-01-18  5:44 UTC (permalink / raw)
  To: Balbir Singh; +Cc: linuxppc-dev, Paul Mackerras, LKML
In-Reply-To: <1200634493.7806.0.camel@concordia.ozlabs.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

On Fri, 2008-01-18 at 16:34 +1100, Michael Ellerman wrote:
> On Sat, 2007-12-08 at 04:07 +0530, Balbir Singh wrote:
> > Changelog
> > 
> > 1. Get rid of the constant 5 (based on comments from
> >                                 Geert.Uytterhoeven@sonycom.com)
> > 2. Implement suggestions from Olof Johannson
> > 3. Check if cmdline is NULL in fake_numa_create_new_node()
> > 
> > Tested with additional parameters from Olof
> > 
> > numa=debug,fake=
> > numa=foo,fake=bar
> 
> 
> I'm not sure why yet, but git bisect tells me it's this patch that's
> causing the for-2.6.25 tree to explode on boot on cell machines.

This fixes it, although I'm a little worried about some of the
removals/movings of node_set_online() in the patch.


diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 1666e7d..dcedc26 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -49,7 +49,6 @@ static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
 	static unsigned int fake_nid = 0;
 	static unsigned long long curr_boundary = 0;
 
-	*nid = fake_nid;
 	if (!p)
 		return 0;
 
@@ -60,6 +59,7 @@ static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
 	if (mem < curr_boundary)
 		return 0;
 
+	*nid = fake_nid;
 	curr_boundary = mem;
 
 	if ((end_pfn << PAGE_SHIFT) > mem) {


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: Patches added to master/for-2.6.25 branch of powerpc.git
From: Grant Likely @ 2008-01-18  5:53 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18320.11472.758570.408071@cargo.ozlabs.ibm.com>

On 1/17/08, Paul Mackerras <paulus@samba.org> wrote:
> Grant Likely writes:
>
> > Paul, can you also please pull the following 52xx changes?
>
> Could you please re-do your tree and make sure the headline for each
> commit starts with "[POWERPC]" (unless it isn't powerpc-specific, in
> which case it probably shouldn't be in your tree...).

Oops, I thought I had done that.  Sorry, I'll get that respun ASAP.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [PATCH] Fake NUMA emulation for PowerPC (Take 2)
From: Michael Ellerman @ 2008-01-18  5:55 UTC (permalink / raw)
  To: Balbir Singh; +Cc: linuxppc-dev, Paul Mackerras, LKML
In-Reply-To: <20071207223714.11448.91386.sendpatchset@balbir-laptop>

[-- Attachment #1: Type: text/plain, Size: 3288 bytes --]

On Sat, 2007-12-08 at 04:07 +0530, Balbir Singh wrote:
> Here's a dumb simple implementation of fake NUMA nodes for PowerPC. Fake
> NUMA nodes can be specified using the following command line option
> 

> 
> Comments are as always welcome!

Here's some :)

> diff -puN arch/powerpc/mm/numa.c~ppc-fake-numa-easy arch/powerpc/mm/numa.c
> --- linux-2.6.24-rc4-mm1/arch/powerpc/mm/numa.c~ppc-fake-numa-easy	2007-12-07 21:25:55.000000000 +0530
> +++ linux-2.6.24-rc4-mm1-balbir/arch/powerpc/mm/numa.c	2007-12-08 03:19:46.000000000 +0530
> @@ -24,6 +24,8 @@
>  
>  static int numa_enabled = 1;
>  
> +static char *cmdline __initdata;

Can you call this fake_numa_args or something, cmdline is a bit generic.


> @@ -39,6 +41,43 @@ static bootmem_data_t __initdata plat_no
>  static int min_common_depth;
>  static int n_mem_addr_cells, n_mem_size_cells;
>  
> +static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
> +						unsigned int *nid)
> +{
> +	unsigned long long mem;
> +	char *p = cmdline;
> +	static unsigned int fake_nid = 0;
> +	static unsigned long long curr_boundary = 0;
> +
> +	*nid = fake_nid;

As I mentioned in my other email I think this is broken, you
unconditionally overwrite *nid, even if no fake numa was specified?

> +	if (!p)
> +		return 0;
> +
> +	mem = memparse(p, &p);
> +	if (!mem)
> +		return 0;
> +
> +	if (mem < curr_boundary)
> +		return 0;
> +
> +	curr_boundary = mem;
> +
> +	if ((end_pfn << PAGE_SHIFT) > mem) {
> +		/*
> +		 * Skip commas and spaces
> +		 */
> +		while (*p == ',' || *p == ' ' || *p == '\t')
> +			p++;
> +
> +		cmdline = p;
> +		fake_nid++;
> +		*nid = fake_nid;
> +		dbg("created new fake_node with id %d\n", fake_nid);
> +		return 1;
> +	}
> +	return 0;
> +}
> +
>  static void __cpuinit map_cpu_to_node(int cpu, int node)
>  {
>  	numa_cpu_lookup_table[cpu] = node;
> @@ -344,12 +383,14 @@ static void __init parse_drconf_memory(s
>  			if (nid == 0xffff || nid >= MAX_NUMNODES)
>  				nid = default_nid;
>  		}
> -		node_set_online(nid);
>  
>  		size = numa_enforce_memory_limit(start, lmb_size);
>  		if (!size)
>  			continue;
>  
> +		fake_numa_create_new_node(((start + size) >> PAGE_SHIFT), &nid);
> +		node_set_online(nid);

I can't convince myself that this is 100% ok, the moving of
node_set_online(). At the very least it's a change in behaviour,
previously we would online the node regardless of the memory limit.

>  		add_active_range(nid, start >> PAGE_SHIFT,
>  				 (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
>  	}
> @@ -429,7 +470,6 @@ new_range:
>  		nid = of_node_to_nid_single(memory);
>  		if (nid < 0)
>  			nid = default_nid;
> -		node_set_online(nid);
>  
>  		if (!(size = numa_enforce_memory_limit(start, size))) {
>  			if (--ranges)
> @@ -438,6 +478,9 @@ new_range:
>  				continue;
>  		}
>  
> +		fake_numa_create_new_node(((start + size) >> PAGE_SHIFT), &nid);
> +		node_set_online(nid);

Ditto previous comment.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH v5] [POWERPC] Add LED driver for Promess Motion-PRO board.
From: Stephen Rothwell @ 2008-01-18  6:06 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20080117180805.18035.60818.stgit@hekate.izotz.org>

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

Hi Marian,

On Thu, 17 Jan 2008 19:09:17 +0100 Marian Balakowicz <m8@semihalf.com> wrote:
>
> +static int __devinit mpled_probe(struct of_device *op,
> +				 const struct of_device_id *match)
> +{
> +	struct motionpro_led *mpled;
> +	const unsigned int *of_blink_delay;
> +	const char *label;
> +	int err;
> +
> +	dev_dbg(&op->dev, "mpled_probe: node=%s (op=%p, match=%p)\n",
> +		op->node->name, op, match);
> +
> +	mpled = kzalloc(sizeof(*mpled), GFP_KERNEL);
> +	if (!mpled)
> +		return -ENOMEM;
> +
> +	mpled->gpt = of_iomap(op->node, 0);
> +	if (!mpled->gpt) {
> +		printk(KERN_ERR __FILE__ ": "
> +			"Error mapping GPT registers for LED %s\n",
> +			op->node->full_name);
> +		err = -EIO;
> +		goto err_free;
> +	}
> +
> +	/* initialize GPT for LED use */
> +	mpled_init_led(&mpled->gpt->mode);
> +
> +	spin_lock_init(&mpled->led_lock);
> +	mpled->mode = LED_MODE_KERNEL;
> +
> +	/* get LED label, used to register led classdev */
> +	label = of_get_property(op->node, "label", NULL);
> +	if (label == NULL) {
> +		printk(KERN_ERR __FILE__ ": "
> +			"No label property provided for LED %s\n",
> +			op->node->full_name);
> +		err = -EINVAL;
> +		goto err_free;

		goto err;

> +static struct of_device_id mpled_match[] = {

Make this const, please.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Convert MPC837x device trees to dts-v1
From: Kumar Gala @ 2008-01-18  6:31 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev
In-Reply-To: <1199791957-5309-1-git-send-email-leoli@freescale.com>


On Jan 8, 2008, at 5:32 AM, Li Yang wrote:

> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/boot/dts/mpc8377_mds.dts |  148 +++++++++++++++ 
> +---------------
> arch/powerpc/boot/dts/mpc8378_mds.dts |  140 ++++++++++++++ 
> +---------------
> arch/powerpc/boot/dts/mpc8379_mds.dts |  156 ++++++++++++++++ 
> +----------------
> 3 files changed, 225 insertions(+), 219 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [PATCH 1/3] add default device trees for MPC837x MDS board
From: Kumar Gala @ 2008-01-18  6:31 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <1199707400-23588-1-git-send-email-leoli@freescale.com>


On Jan 7, 2008, at 6:03 AM, Li Yang wrote:

> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> address comments and use new dts spec.
>
> arch/powerpc/boot/dts/mpc8377_mds.dts |  277 ++++++++++++++++++++++++ 
> +++++++
> arch/powerpc/boot/dts/mpc8378_mds.dts |  263 ++++++++++++++++++++++++ 
> +++++
> arch/powerpc/boot/dts/mpc8379_mds.dts |  291 ++++++++++++++++++++++++ 
> +++++++++
> 3 files changed, 831 insertions(+), 0 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [PATCH 2/3 v2] add MPC837x USB platform support
From: Kumar Gala @ 2008-01-18  6:37 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev, paulus, sfr
In-Reply-To: <1199776726-22963-1-git-send-email-leoli@freescale.com>


On Jan 8, 2008, at 1:18 AM, Li Yang wrote:

> Add chip specific and board specific initialization for MPC837x USB.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/platforms/83xx/mpc837x_mds.c |   51 ++++++++++++++++++++ 
> +++++++++
> arch/powerpc/platforms/83xx/mpc83xx.h     |    3 ++
> arch/powerpc/platforms/83xx/usb.c         |   40 ++++++++++++++++++++ 
> ++
> 3 files changed, 94 insertions(+), 0 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [PATCH 3/3 v2] USB device tree cleanups
From: Kumar Gala @ 2008-01-18  6:38 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev, paulus, sfr
In-Reply-To: <1199776726-22963-2-git-send-email-leoli@freescale.com>


On Jan 8, 2008, at 1:18 AM, Li Yang wrote:

> Remove device_type = "usb"
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> Documentation/powerpc/booting-without-of.txt |    4 ----
> arch/powerpc/boot/dts/mpc8313erdb.dts        |    1 -
> arch/powerpc/boot/dts/mpc832x_mds.dts        |    1 -
> arch/powerpc/boot/dts/mpc8349emitx.dts       |    2 --
> arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    1 -
> arch/powerpc/boot/dts/mpc834x_mds.dts        |    2 --
> arch/powerpc/boot/dts/mpc836x_mds.dts        |    1 -
> arch/powerpc/platforms/83xx/usb.c            |    8 ++++----
> arch/powerpc/sysdev/fsl_soc.c                |   12 +++++-------
> 9 files changed, 9 insertions(+), 23 deletions(-)

applied.

- k

^ permalink raw reply

* Re: SCHED_FIFO & System()
From: Matias Sundman @ 2008-01-18  6:38 UTC (permalink / raw)
  To: Scott Wood, Arnon Kaufman(Work); +Cc: linuxppc-embedded@ozlabs.org
In-Reply-To: <478FD3B7.2030105@freescale.com>

Hello,

/>>Are you running a preemptible kernel? [Scott]/
 
Yes the Kernel is configured as - Preemptible Kernel (Low-Latency Desktop)

/>>//what you actually need is a better kernel preemption such as  using 
Ingo Molnar 's  PREEMPT_RT patch. (it may reduce performance a little) 
[Arnon]
/
Ok - we can try to enable the PREEMPT_RT patches.

-------------------------------

I also tried with a sched_yield() before the call to system() in order 
to see if the behavior changed somewhat but it didn't.


Cheers // Matias :-)



Scott Wood skrev:
> Matias Sundman wrote:
>   
>> Hello,
>> I have some strange behavior in one of my systems.
>>
>> I have a real-time thread under SCHED_FIFO which is running every 10ms. 
>> It is blocking on a semaphore and released by a timer interrupt every 10ms.
>> Generally this works really well.
>>
>> However, there is a module in the system that makes a / system() / call 
>> from c-code ;
>>
>>   system("run_my_script");
>>
>> By calling and running a bash script. Independent of how the actual 
>> script looks like the real time thread does not get scheduled under 80ms 
>> -- the time it takes
>> for the system() call to finish.
>>     
>
> Are you running a preemptible kernel?
>
> -Scott
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>   
[From : Arnon Kaufman(Work) <arnon.work@gmail.com>]

I've seen this kind of behavior. i may guess that you configure the 
kernel with PREEMPT, assuming it will solve the problem for you.

I'll split the problem into two:
1. program loading stage is finished (+ reschedule)
2. thread execution time (delay)

when executing a new application it's involved with plenty of kernel 
activity such as fetching the application from storage, loader 
relocation,allocating and remapping pages, resolving dynamic linking 
etc..., all the activity occurs under the hood of the kernel, suspending 
most of the kernel activities, due to many spin locks on the way. that 
delays other kernel threads as well, and even workqueues.

trying to bypass the symptom  - re-running the exact external 
application ,  should not be involved with a second delay, as it was 
cached. so may be running the external application in advance may be 
good enough for you.

what you actually need is a better kernel preemption such as  using Ingo 
Molnar 's  PREEMPT_RT patch. (it may reduce performance a little).

the second part is that the scheduler delays the thread execution as it 
think other kernel's entities has a higher priority such as softirqs, 
workqueue, etc...

the PREEMPT_RT may solve this problem as well as it bring a better 
priority control, with the addition of priority inheritance.

^ permalink raw reply

* Re: [PATCH] Convert MPC837x device trees to dts-v1
From: Kumar Gala @ 2008-01-18  6:39 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Li Yang
In-Reply-To: <5863BE5F-95D7-499C-AFC4-C7ECE62847D4@kernel.crashing.org>


On Jan 18, 2008, at 12:31 AM, Kumar Gala wrote:

>
> On Jan 8, 2008, at 5:32 AM, Li Yang wrote:
>
>> Signed-off-by: Li Yang <leoli@freescale.com>
>> ---
>> arch/powerpc/boot/dts/mpc8377_mds.dts |  148 +++++++++++++++
>> +---------------
>> arch/powerpc/boot/dts/mpc8378_mds.dts |  140 ++++++++++++++
>> +---------------
>> arch/powerpc/boot/dts/mpc8379_mds.dts |  156 ++++++++++++++++
>> +----------------
>> 3 files changed, 225 insertions(+), 219 deletions(-)
>
> applied.

I dropped the "fsl,pq2pro-sata" compat prop.  We need to come up with  
something a bit more generic.

- k

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Kumar Gala @ 2008-01-18  6:45 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: netdev, Paul Mackerras, linuxppc-dev
In-Reply-To: <20071206225121.31080.86606.stgit@localhost.localdomain>

On Fri, 7 Dec 2007, Vitaly Bordug wrote:

>
> With that patch fixed.c now fully emulates MDIO bus, thus no need
> to duplicate PHY layer functionality. That, in turn, drastically
> simplifies the code, and drops down line count.
>
> As an additional bonus, now there is no need to register MDIO bus
> for each PHY, all emulated PHYs placed on the platform fixed MDIO bus.
> There is also no more need to pre-allocate PHYs via .config option,
> this is all now handled dynamically.
>
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> Acked-by: Jeff Garzik <jeff@garzik.org>
>
> ---
>
>  drivers/net/phy/Kconfig   |   32 +--
>  drivers/net/phy/fixed.c   |  445 +++++++++++++++++----------------------------
>  include/linux/phy_fixed.h |   51 ++---
>  3 files changed, 195 insertions(+), 333 deletions(-)
>

applied.

- k

^ permalink raw reply

* Re: [PATCH 3/3] [POWERPC] MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus
From: Kumar Gala @ 2008-01-18  6:46 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: netdev, Paul Mackerras, linuxppc-dev
In-Reply-To: <20071206225139.31080.18384.stgit@localhost.localdomain>

On Fri, 7 Dec 2007, Vitaly Bordug wrote:

>
> ...thus use fixed-link to register proper "Fixed PHY"
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
>

applied.

- k

^ permalink raw reply

* Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
From: Kumar Gala @ 2008-01-18  6:46 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: netdev, Paul Mackerras, linuxppc-dev
In-Reply-To: <20071206225131.31080.7872.stgit@localhost.localdomain>

On Fri, 7 Dec 2007, Vitaly Bordug wrote:

>
> fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that
> not connected to the real MDIO bus.
>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>
> ---
>
>  Documentation/powerpc/booting-without-of.txt |    4 +
>  arch/powerpc/sysdev/fsl_soc.c                |   79 ++++++++++++++++++++------
>  2 files changed, 66 insertions(+), 17 deletions(-)
>

applied.

- k

^ permalink raw reply

* Re: [PATCH v7] qe: add ability to upload QE firmware
From: Kumar Gala @ 2008-01-18  6:46 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, sfr
In-Reply-To: <11998098582795-git-send-email-timur@freescale.com>

On Tue, 8 Jan 2008, Timur Tabi wrote:

> Define the layout of a binary blob that contains a QE firmware and instructions
> on how to upload it.  Add function qe_upload_firmware() to parse the blob
> and perform the actual upload.  Fully define 'struct rsp' in immap_qe.h to
> include the actual RISC Special Registers.  Added description of a new
> QE firmware node to booting-without-of.txt.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> Updated w.r.t. comments from Stephen R.
>
> This patch is for Kumar's for-2.6.25 branch.  This code is necessary for
> my QE UART driver.
>
>  Documentation/powerpc/00-INDEX               |    3 +
>  Documentation/powerpc/booting-without-of.txt |   33 +++-
>  Documentation/powerpc/qe_firmware.txt        |  295 ++++++++++++++++++++++++++
>  arch/powerpc/platforms/Kconfig               |    1 +
>  arch/powerpc/sysdev/qe_lib/qe.c              |  247 +++++++++++++++++++++
>  include/asm-powerpc/immap_qe.h               |   34 +++-
>  include/asm-powerpc/qe.h                     |   61 ++++++
>  7 files changed, 670 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/powerpc/qe_firmware.txt
>

applied.

- k

^ permalink raw reply

* Re: [PATCH v2] [SERIAL] qe-uart: add support for Freescale QUICCEngine UART
From: Kumar Gala @ 2008-01-18  6:47 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, linux-serial
In-Reply-To: <12004125733910-git-send-email-timur@freescale.com>

On Tue, 15 Jan 2008, Timur Tabi wrote:

> Add file ucc_uart.c, a serial device driver for the Freescale QUICCEngine.
> Update the Kconfig and Makefile accordingly.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> Updated to reflect comments from Kumar.
>
>  drivers/serial/Kconfig    |   10 +
>  drivers/serial/Makefile   |    1 +
>  drivers/serial/ucc_uart.c | 1514 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 1525 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/serial/ucc_uart.c
>

applied.

- k

^ permalink raw reply

* Re: [PATCH] [POWERPC] qe: add support for Freescale QUICCEngine UART
From: Kumar Gala @ 2008-01-18  6:47 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, linux-serial
In-Reply-To: <11999217072674-git-send-email-timur@freescale.com>

On Wed, 9 Jan 2008, Timur Tabi wrote:

> Add support for UART serial ports using a Freescale QUICCEngine. Update
> booting-without-of.txt to define new properties for a QE UART node.  Update
> the MPC8323E-MDS device tree to add UCC5 as a UART.  Update the QE library
> to support slow UCC devices and modules.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>  Documentation/powerpc/booting-without-of.txt |    9 ++++-
>  arch/powerpc/boot/dts/mpc832x_mds.dts        |   50 ++++++++++++++++++++++++++
>  arch/powerpc/sysdev/qe_lib/Kconfig           |    2 +-
>  arch/powerpc/sysdev/qe_lib/ucc_slow.c        |   10 +++++-
>  4 files changed, 68 insertions(+), 3 deletions(-)
>

applied.

- k

^ permalink raw reply

* Re: [PATCH v3] [POWERPC] Update MPC8610 HPCD to support audio drivers
From: Kumar Gala @ 2008-01-18  6:48 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel, linuxppc-dev, olof, david
In-Reply-To: <12000050664035-git-send-email-timur@freescale.com>

On Thu, 10 Jan 2008, Timur Tabi wrote:

> Update the MPC8610 HPCD files to support the audio driver.  Update
> booting-without-of.txt with information on the SSI device.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---

Can you respin this.  It doesn't apply cleanly to my tree.

- k

^ permalink raw reply

* Re: [Add mpc5121 support PATCH v3 1/8] Add IPIC config option
From: Kumar Gala @ 2008-01-18  6:50 UTC (permalink / raw)
  To: John Rigby; +Cc: linuxppc-dev
In-Reply-To: <1200614738-25654-2-git-send-email-jrigby@freescale.com>

On Thu, 17 Jan 2008, John Rigby wrote:

> IPIC is not just for 83xx anymore so make it a separate
> config option.
>
> Signed-off-by: John Rigby <jrigby@freescale.com>
> ---
>  arch/powerpc/platforms/Kconfig |    5 +++++
>  arch/powerpc/sysdev/Makefile   |    2 +-
>  2 files changed, 6 insertions(+), 1 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [Add mpc5121 support PATCH v3 2/8] Add mpc512x ipic support
From: Kumar Gala @ 2008-01-18  6:51 UTC (permalink / raw)
  To: John Rigby; +Cc: linuxppc-dev
In-Reply-To: <1200614738-25654-3-git-send-email-jrigby@freescale.com>

On Thu, 17 Jan 2008, John Rigby wrote:

> Added ipic_info entries for vectors used by 512x that
> were previously unused by 83xx.
>
> Signed-off-by: John Rigby <jrigby@freescale.com>
> ---
>  arch/powerpc/sysdev/ipic.c |   62 ++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 62 insertions(+), 0 deletions(-)
>

applied.

- k

^ permalink raw reply

* Re: [PATCH] Fix carry bug in 128-bit unsigned integer adding
From: Kumar Gala @ 2008-01-18  6:51 UTC (permalink / raw)
  To: Liu Yu; +Cc: linuxppc-dev
In-Reply-To: <12006264992105-git-send-email-Yu.Liu@freescale.com>

On Fri, 18 Jan 2008, Liu Yu wrote:

> Synchronize it to the definition in include/math-emu/op-4.h for short term.
>
> Signed-off-by: Liu Yu <Yu.Liu@freescale.com>
> ---
>  arch/powerpc/math-emu/op-4.h |   40 ++++++++++++++++++++++++++++++----------
>  1 files changed, 30 insertions(+), 10 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [PATCH] mpc85xx_ads: add in missing of_node_put()
From: Kumar Gala @ 2008-01-18  6:52 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Stephen Rothwell, linuxppc-dev
In-Reply-To: <20080102175001.GA18205@windriver.com>

> From: Paul Gortmaker <paul.gortmaker@windriver.com>
> Date: Fri, 21 Dec 2007 10:12:38 -0500
> Subject: [PATCH] mpc85xx_ads: add in missing of_node_put()
>
> Add in missing of_node_put() after cpm2_pic_init(). This and other coding
> style cleanups as suggested by Stephen Rothwell.
>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  arch/powerpc/platforms/85xx/mpc85xx_ads.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)

applied.

- k

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox