Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-13 Thread Aravinda Prasad


On Friday 13 November 2015 01:08 PM, Thomas Huth wrote:
> On 13/11/15 07:26, Aravinda Prasad wrote:
>>
>> On Friday 13 November 2015 07:20 AM, David Gibson wrote:
>>> On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote:
> [...]
 So thinking whether qemu should explicitly enable the new NMI
 behavior.
>>>
>>> So, I think the reasoning above tends towards having qemu control the
>>> MC behaviour.  If qemu does nothing, MCs are delivered direct to
>>> 0x200, if it enables the new handling, they cause a KVM exit and qemu
>>> will deliver the MC.
>>
>> This essentially requires qemu to control how KVM behaves as KVM does
>> the actual redirection of MC either to guest's 0x200 vector or to exit
>> guest. So, if we are running new qemu, then KVM should exit guest and if
>> we are running old qemu, KVM should redirect MC to 0x200. Is there any
>> way to communicate this to KVM? ioctl?
> 
> Simply introduce a KVM capability that can be enabled by userspace.
> See kvm_vcpu_ioctl_enable_cap() in arch/powerpc/kvm/powerpc.c.

Thanks. I will look at it.

Regards,
Aravinda

> 
>  Thomas
> 

-- 
Regards,
Aravinda

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: input: i8042: build failure on powerpc

2015-11-13 Thread LABBE Corentin
On Thu, Nov 12, 2015 at 07:41:17AM -0800, Guenter Roeck wrote:
> On Thu, Nov 12, 2015 at 04:01:45PM +0100, LABBE Corentin wrote:
> > Hello
> > 
> > I have made a random .config for testing my powerpc cross-compiler and I 
> > got this fail:
> > 
> 
> In general it helps to provide the broken configuration.
> 
> If you do some digging, you may notice that this has been broken
> since commit 917f0af9e5a9 ("powerpc: Remove arch/ppc and include/asm-ppc"),
> or in other words since 2008. CONFIG_INPUT is not set with walnut_defconfig,
> which may explain why no one noticed.
> 
> I would suggest to just remove the offending code. Quite obviously it is dead.
> 

Just for be clear, you suggest that I make a patch for removing powerpc support 
of the i8042 driver ?
I have add linuxppc-dev@lists.ozlabs.org to the discution.

Regards

> >   LD  init/built-in.o
> > drivers/built-in.o: In function `i8042_wait_write':
> > i8042.c:(.text+0x13d8be): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13d8c6): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13d8e6): undefined reference to `kb_cs'
> > drivers/built-in.o: In function `i8042_kbd_write':
> > i8042.c:(.text+0x13d9aa): undefined reference to `kb_data'
> > i8042.c:(.text+0x13d9ae): undefined reference to `kb_data'
> > drivers/built-in.o: In function `i8042_flush':
> > i8042.c:(.text+0x13da56): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13da62): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13da66): undefined reference to `kb_data'
> > i8042.c:(.text+0x13da86): undefined reference to `kb_data'
> > drivers/built-in.o: In function `i8042_panic_blink':
> > i8042.c:(.text+0x13db92): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13db9a): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13dc06): undefined reference to `kb_data'
> > i8042.c:(.text+0x13dc16): undefined reference to `kb_data'
> > i8042.c:(.text+0x13dc8a): undefined reference to `kb_data'
> > drivers/built-in.o: In function `i8042_interrupt':
> > i8042.c:(.text+0x13dd1a): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13dd1e): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13dd3e): undefined reference to `kb_data'
> > i8042.c:(.text+0x13dd42): undefined reference to `kb_data'
> > drivers/built-in.o: In function `__i8042_command':
> > i8042.c:(.text+0x13e2b6): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13e2be): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13e2ea): undefined reference to `kb_data'
> > i8042.c:(.text+0x13e302): undefined reference to `kb_data'
> > i8042.c:(.text+0x13e34e): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13e362): undefined reference to `kb_cs'
> > i8042.c:(.text+0x13e366): undefined reference to `kb_data'
> > i8042.c:(.text+0x13e3de): undefined reference to `kb_data'
> > drivers/built-in.o: In function `i8042_aux_test_irq':
> > i8042.c:(.init.text+0x59a2): undefined reference to `kb_cs'
> > i8042.c:(.init.text+0x59a6): undefined reference to `kb_cs'
> > i8042.c:(.init.text+0x59ca): undefined reference to `kb_data'
> > i8042.c:(.init.text+0x59ce): undefined reference to `kb_data'
> > drivers/built-in.o: In function `i8042_probe':
> > i8042.c:(.init.text+0x5dda): undefined reference to `kb_cs'
> > i8042.c:(.init.text+0x5dde): undefined reference to `kb_cs'
> > i8042.c:(.init.text+0x6366): undefined reference to `kb_data'
> > i8042.c:(.init.text+0x6376): undefined reference to `kb_cs'
> > i8042.c:(.init.text+0x637a): undefined reference to `kb_data'
> > Makefile:929: recipe for target 'vmlinux' failed
> > 
> > it seems that kb_data and kb_cs (declared as extern in 
> > drivers/input/serio/i8042-ppcio.h) are defined anywhere.
> > 
> > Regards
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [xmon PATCH 1/1] RFC: Add xmon command to dump process/task similar to ps(1)

2015-11-13 Thread Douglas Miller

Thanks, Ben, for the feedback.

Here is an updated patch. I added a macro XMON_PROTECT() to wrap a 
statement in what I think is the correct setjmp/protection code. Each 
place seems to do it slightly differently, so I wasn't sure what the 
right way was and didn't want to change all other places until we were 
certain. If you have a better way to implement this, please let me know. 
It may be difficult to make a macro that fits all use cases, too.


I checked using a task point of NULL and it errored out safely, and also 
tried a pointer to valid memory but not a valid task_struct and it also 
errored out cleanly. Of course, random memory might not always cause a 
fault but rather just print garbage.


Thanks,
Doug

On 11/11/2015 02:09 AM, Benjamin Herrenschmidt wrote:

On Tue, 2015-11-10 at 10:50 -0600, Douglas Miller wrote:

+{
+   unsigned long tskv;
+   struct task_struct *tsk;
+
+   if (scanhex()) {
+   procshow((struct task_struct *)tskv);
+   } else {
+   for_each_process(tsk) {
+   procshow(tsk);
+   }
+   }
+}
+

The main thing is wrap it with the setjump magic that xmon uses for
other things that allows it to recover if you hit a bad pointer
along the way:

if (setjmp(bus_error_jmp) == 0) {
catch_memory_errors = 1;
sync();
... do your stuff...
sync();
}
catch_memory_errors = 0;

We could make some kind of helper or macro to factor that out
while it it ;-) (For bonus points !)

Cheers,
Ben.




>From a0e7eeef8c51ecedad131aa4c04541f37fc083c4 Mon Sep 17 00:00:00 2001
From: Douglas Miller 
Date: Thu, 5 Nov 2015 07:55:33 -0600
Subject: [PATCH] Add xmon command to dump process/task similar to ps(1)

---
 arch/powerpc/xmon/xmon.c |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 13c6e20..5c24f55 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -149,6 +149,7 @@ static int  cpu_cmd(void);
 static void csum(void);
 static void bootcmds(void);
 static void proccall(void);
+static void proclist(void);
 void dump_segments(void);
 static void symbol_lookup(void);
 static void xmon_show_stack(unsigned long sp, unsigned long lr,
@@ -191,6 +192,24 @@ extern void xmon_leave(void);
 			 || ('A' <= (c) && (c) <= 'Z'))
 #define isspace(c)	(c == ' ' || c == '\t' || c == 10 || c == 13 || c == 0)
 
+/*
+ * Wrap a statement (typically function call) in setjmp to
+ * protect it from memory access errors. msg... are printf
+ * fmt+args used if error is trapped.
+ */
+#define XMON_PROTECT(stmt, msg...) 		\
+	if (setjmp(bus_error_jmp) != 0) {	\
+		catch_memory_errors = 0;	\
+		printf(msg);			\
+	} else {\
+		catch_memory_errors = 1;	\
+		sync();\
+		stmt;\
+		sync();\
+		__delay(200);			\
+		catch_memory_errors = 0;	\
+	}
+
 static char *help_string = "\
 Commands:\n\
   b	show breakpoints\n\
@@ -228,6 +247,7 @@ Commands:\n\
   mz	zero a block of memory\n\
   mi	show information about memory allocation\n\
   p 	call a procedure\n\
+  P 	list processes/tasks\n\
   r	print registers\n\
   s	single step\n"
 #ifdef CONFIG_SPU_BASE
@@ -947,6 +967,9 @@ cmds(struct pt_regs *excp)
 		case 'p':
 			proccall();
 			break;
+		case 'P':
+			proclist();
+			break;
 #ifdef CONFIG_PPC_STD_MMU
 		case 'u':
 			dump_segments();
@@ -2450,6 +2473,41 @@ memzcan(void)
 		printf("%.8x\n", a - mskip);
 }
 
+static void procshow(struct task_struct *tsk)
+{
+	char state;
+
+	state = (tsk->state == 0) ? 'R' :
+		(tsk->state < 0) ? 'U' :
+		(tsk->state & TASK_UNINTERRUPTIBLE) ? 'D' :
+		(tsk->state & TASK_STOPPED) ? 'T' :
+		(tsk->state & TASK_TRACED) ? 'C' :
+		(tsk->exit_state & EXIT_ZOMBIE) ? 'Z' :
+		(tsk->exit_state & EXIT_DEAD) ? 'E' :
+		(tsk->state & TASK_INTERRUPTIBLE) ? 'S' : '?';
+
+	printf("%p %016lx %6d %6d %c %2d %s\n", tsk,
+		tsk->thread.ksp,
+		tsk->pid, tsk->parent->pid,
+		state, task_thread_info(tsk)->cpu,
+		tsk->comm);
+}
+
+static void proclist(void)
+{
+	unsigned long tskv;
+	struct task_struct *tsk;
+
+	if (scanhex()) {
+		tsk = (struct task_struct *)tskv;
+		XMON_PROTECT(procshow(tsk), "*** Error dumping task %p\n", tsk);
+	} else {
+		for_each_process(tsk) {
+			XMON_PROTECT(procshow(tsk), "*** Error dumping task %p\n", tsk);
+		}
+	}
+}
+
 static void proccall(void)
 {
 	unsigned long args[8];
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/1 v4] drivers/nvme: default to 4k device page size

2015-11-13 Thread Keith Busch
On Thu, Nov 12, 2015 at 11:37:54PM -0800, Christoph Hellwig wrote:
> Jens, Keith: any chance to get this to Linux for 4.4 (and -stable)?

I agreed, looks good to me.

Acked-by: Keith Busch 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: input: i8042: build failure on powerpc

2015-11-13 Thread Guenter Roeck

On 11/13/2015 12:35 AM, LABBE Corentin wrote:

On Thu, Nov 12, 2015 at 07:41:17AM -0800, Guenter Roeck wrote:

On Thu, Nov 12, 2015 at 04:01:45PM +0100, LABBE Corentin wrote:

Hello

I have made a random .config for testing my powerpc cross-compiler and I got 
this fail:



In general it helps to provide the broken configuration.

If you do some digging, you may notice that this has been broken
since commit 917f0af9e5a9 ("powerpc: Remove arch/ppc and include/asm-ppc"),
or in other words since 2008. CONFIG_INPUT is not set with walnut_defconfig,
which may explain why no one noticed.

I would suggest to just remove the offending code. Quite obviously it is dead.



Just for be clear, you suggest that I make a patch for removing powerpc support 
of the i8042 driver ?
I have add linuxppc-dev@lists.ozlabs.org to the discution.



s/powerpc/walnut/

Guenter


Regards


   LD  init/built-in.o
drivers/built-in.o: In function `i8042_wait_write':
i8042.c:(.text+0x13d8be): undefined reference to `kb_cs'
i8042.c:(.text+0x13d8c6): undefined reference to `kb_cs'
i8042.c:(.text+0x13d8e6): undefined reference to `kb_cs'
drivers/built-in.o: In function `i8042_kbd_write':
i8042.c:(.text+0x13d9aa): undefined reference to `kb_data'
i8042.c:(.text+0x13d9ae): undefined reference to `kb_data'
drivers/built-in.o: In function `i8042_flush':
i8042.c:(.text+0x13da56): undefined reference to `kb_cs'
i8042.c:(.text+0x13da62): undefined reference to `kb_cs'
i8042.c:(.text+0x13da66): undefined reference to `kb_data'
i8042.c:(.text+0x13da86): undefined reference to `kb_data'
drivers/built-in.o: In function `i8042_panic_blink':
i8042.c:(.text+0x13db92): undefined reference to `kb_cs'
i8042.c:(.text+0x13db9a): undefined reference to `kb_cs'
i8042.c:(.text+0x13dc06): undefined reference to `kb_data'
i8042.c:(.text+0x13dc16): undefined reference to `kb_data'
i8042.c:(.text+0x13dc8a): undefined reference to `kb_data'
drivers/built-in.o: In function `i8042_interrupt':
i8042.c:(.text+0x13dd1a): undefined reference to `kb_cs'
i8042.c:(.text+0x13dd1e): undefined reference to `kb_cs'
i8042.c:(.text+0x13dd3e): undefined reference to `kb_data'
i8042.c:(.text+0x13dd42): undefined reference to `kb_data'
drivers/built-in.o: In function `__i8042_command':
i8042.c:(.text+0x13e2b6): undefined reference to `kb_cs'
i8042.c:(.text+0x13e2be): undefined reference to `kb_cs'
i8042.c:(.text+0x13e2ea): undefined reference to `kb_data'
i8042.c:(.text+0x13e302): undefined reference to `kb_data'
i8042.c:(.text+0x13e34e): undefined reference to `kb_cs'
i8042.c:(.text+0x13e362): undefined reference to `kb_cs'
i8042.c:(.text+0x13e366): undefined reference to `kb_data'
i8042.c:(.text+0x13e3de): undefined reference to `kb_data'
drivers/built-in.o: In function `i8042_aux_test_irq':
i8042.c:(.init.text+0x59a2): undefined reference to `kb_cs'
i8042.c:(.init.text+0x59a6): undefined reference to `kb_cs'
i8042.c:(.init.text+0x59ca): undefined reference to `kb_data'
i8042.c:(.init.text+0x59ce): undefined reference to `kb_data'
drivers/built-in.o: In function `i8042_probe':
i8042.c:(.init.text+0x5dda): undefined reference to `kb_cs'
i8042.c:(.init.text+0x5dde): undefined reference to `kb_cs'
i8042.c:(.init.text+0x6366): undefined reference to `kb_data'
i8042.c:(.init.text+0x6376): undefined reference to `kb_cs'
i8042.c:(.init.text+0x637a): undefined reference to `kb_data'
Makefile:929: recipe for target 'vmlinux' failed

it seems that kb_data and kb_cs (declared as extern in 
drivers/input/serio/i8042-ppcio.h) are defined anywhere.

Regards




___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev