linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] MN10300: Fix one of the kernel debugger cacheflush variants
@ 2011-06-06 14:47 David Howells
  2011-06-06 14:47 ` [PATCH 2/3] MN10300: die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs() David Howells
  2011-06-06 14:47 ` [PATCH 3/3] MN10300: Add missing _sdata declaration David Howells
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2011-06-06 14:47 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-am33-list, linux-kernel, David Howells

One of the kernel debugger cacheflush variants escaped proper testing.  Two of
the labels are wrong, being derived from the code that was copied to construct
the variant.

The first label results in the following assembler message:

  AS      arch/mn10300/mm/cache-dbg-flush-by-reg.o
arch/mn10300/mm/cache-dbg-flush-by-reg.S: Assembler messages:
arch/mn10300/mm/cache-dbg-flush-by-reg.S:123: Error: symbol `debugger_local_cache_flushinv_no_dcache' is already defined

And the second label results in the following linker message:

arch/mn10300/mm/built-in.o:(.text+0x1d39): undefined reference to `mn10300_local_icache_inv_range_reg_end'
arch/mn10300/mm/built-in.o:(.text+0x1d39): relocation truncated to fit: R_MN10300_PCREL16 against undefined symbol `mn10300_local_icache_inv_range_reg_end'

To test this file the following configuration pieces must be set:

	CONFIG_AM34=y
	CONFIG_MN10300_CACHE_WBACK=y
	CONFIG_MN10300_DEBUGGER_CACHE_FLUSH_BY_REG=y
	CONFIG_MN10300_CACHE_MANAGE_BY_REG=y
	CONFIG_AM34_HAS_CACHE_SNOOP=n

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/mm/cache-dbg-flush-by-reg.S |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/arch/mn10300/mm/cache-dbg-flush-by-reg.S b/arch/mn10300/mm/cache-dbg-flush-by-reg.S
index 665919f..a775ea5 100644
--- a/arch/mn10300/mm/cache-dbg-flush-by-reg.S
+++ b/arch/mn10300/mm/cache-dbg-flush-by-reg.S
@@ -120,14 +120,14 @@ debugger_local_cache_flushinv_one:
 	# conditionally purge this line in all ways
 	mov	d1,(L1_CACHE_WAYDISP*0,a0)
 
-debugger_local_cache_flushinv_no_dcache:
+debugger_local_cache_flushinv_one_no_dcache:
 	#
 	# now try to flush the icache
 	#
 	mov	CHCTR,a0
 	movhu	(a0),d0
 	btst	CHCTR_ICEN,d0
-	beq	mn10300_local_icache_inv_range_reg_end
+	beq	debugger_local_cache_flushinv_one_end
 
 	LOCAL_CLI_SAVE(d1)
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] MN10300: die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs()
  2011-06-06 14:47 [PATCH 1/3] MN10300: Fix one of the kernel debugger cacheflush variants David Howells
@ 2011-06-06 14:47 ` David Howells
  2011-06-06 14:47 ` [PATCH 3/3] MN10300: Add missing _sdata declaration David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2011-06-06 14:47 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-am33-list, linux-kernel, David Howells

die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs() to
indicate that it wants to probe a kernel address.  Instead it should use
probe_kernel_read().

This fixes the problem of gdb seeing SIGILL rather than SIGTRAP when hitting
the KGDB special breakpoint upon SysRq+g being seen.  The problem was that
die_if_no_fixup() was failing to read the opcode of the instruction that caused
the exception, and thus not fixing up the exception.

This caused gdb to get a S04 response to the $? request in its remote protocol
rather than S05 - which would then cause it to continue with $C04 rather than
$c in an attempt to pass the signal onto the inferior process.  The kernel,
however, does not support $Cnn, and so objects by returning an E22 response,
indicating an error.  gdb does not expect this and prints:

	warning: Remote failure reply: E22

and then returns to the gdb command prompt unable to continue.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/kernel/traps.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index f03cb27..bd3e5e7 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -28,7 +28,7 @@
 #include <linux/irq.h>
 #include <asm/processor.h>
 #include <asm/system.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/atomic.h>
 #include <asm/smp.h>
@@ -156,7 +156,7 @@ int die_if_no_fixup(const char *str, struct pt_regs *regs,
 
 	case EXCEP_TRAP:
 	case EXCEP_UNIMPINS:
-		if (get_user(opcode, (uint8_t __user *)regs->pc) != 0)
+		if (probe_kernel_read(&opcode, (u8 *)regs->pc, 1) < 0)
 			break;
 		if (opcode == 0xff) {
 			if (notify_die(DIE_BREAKPOINT, str, regs, code, 0, 0))


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] MN10300: Add missing _sdata declaration
  2011-06-06 14:47 [PATCH 1/3] MN10300: Fix one of the kernel debugger cacheflush variants David Howells
  2011-06-06 14:47 ` [PATCH 2/3] MN10300: die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs() David Howells
@ 2011-06-06 14:47 ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2011-06-06 14:47 UTC (permalink / raw)
  To: torvalds, akpm
  Cc: linux-am33-list, linux-kernel, David Howells, Steven Rostedt

_sdata needs to be declared in the linker script now as of:

	commit a2d063ac216c1618bfc2b4d40b7176adffa63511
	Author: Steven Rostedt <rostedt@goodmis.org>
	Date:   Thu May 19 21:34:58 2011 -0400
	extable, core_kernel_data(): Make sure all archs define _sdata

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steven Rostedt <rostedt@goodmis.org>
---

 arch/mn10300/kernel/vmlinux.lds.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 6f702a6..13c4814 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -44,6 +44,7 @@ SECTIONS
   RO_DATA(PAGE_SIZE)
 
   /* writeable */
+  _sdata = .;     /* Start of rw data section */
   RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE)
   _edata = .;
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-06 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-06 14:47 [PATCH 1/3] MN10300: Fix one of the kernel debugger cacheflush variants David Howells
2011-06-06 14:47 ` [PATCH 2/3] MN10300: die_if_no_fixup() shouldn't use get_user() as it doesn't call set_fs() David Howells
2011-06-06 14:47 ` [PATCH 3/3] MN10300: Add missing _sdata declaration David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).