[PATCH] Fix kgdb on little endian ppc64le

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3817d

6 messages, 3 authors, 2016-02-22 · open the first message on its own page

[PATCH] Fix kgdb on little endian ppc64le

From: Balbir Singh <bsingharora@gmail.com>
Date: 2016-02-01 06:04:00

From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 arch/powerpc/kernel/kgdb.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index e77c3cc..92c8f80 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -445,7 +445,11 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
  * Global data
  */
 struct kgdb_arch arch_kgdb_ops = {
+#ifdef __LITTLE_ENDIAN__
+	.gdb_bpt_instr = {0x08, 0x10, 0x82, 0x7d},
+#else
 	.gdb_bpt_instr = {0x7d, 0x82, 0x10, 0x08},
+#endif /* __LITTLE_ENDIAN__ */
 };
 
 static int kgdb_not_implemented(struct pt_regs *regs)
-- 
2.5.0

Re: [PATCH] Fix kgdb on little endian ppc64le

From: Andrew Donnellan <hidden>
Date: 2016-02-01 10:40:07

On 01/02/16 17:03, Balbir Singh wrote:
From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Should this be Cc'd to stable?


-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited

Re: [PATCH] Fix kgdb on little endian ppc64le

From: Balbir Singh <bsingharora@gmail.com>
Date: 2016-02-01 23:32:09

On Mon, 1 Feb 2016 21:39:00 +1100
Andrew Donnellan [off-list ref] wrote:
On 01/02/16 17:03, Balbir Singh wrote:
quoted
From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected

Signed-off-by: Balbir Singh <bsingharora@gmail.com>  
Should this be Cc'd to stable?
Good suggestion, Michael? I can repost this to stable if required?

Balbir Singh.

Re: Fix kgdb on little endian ppc64le

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-02-09 10:12:00

On Mon, 2016-01-02 at 06:03:25 UTC, Balbir Singh wrote:
From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected
The test suite isn't working for me (I think?), so I think maybe we need
something more?


  KGDB: Registered I/O driver kgdbts
  kgdbts:RUN plant and detach test

  Entering kdb (current=0xc0000001fefc0000, pid 1) on processor 12 due to Keyboard Entry
  [12]kdb> kgdbts:RUN sw breakpoint test
  kgdbts: BP mismatch c00000000018e2cc expected c00000000061c510
  KGDB: re-enter exception: ALL breakpoints killed
  CPU: 12 PID: 1 Comm: swapper/0 Not tainted 4.5.0-rc3-00006-g893791ee8b01 #5
  Call Trace:
  [c0000001fb082e10] [c0000000009c4608] dump_stack+0xb0/0xf0 (unreliable)
  [c0000001fb082e50] [c00000000018fa8c] kgdb_handle_exception+0x2ac/0x2c0
  [c0000001fb082f20] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb082f50] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb082fc0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at check_and_rewind_pc+0x100/0x130
      LR = check_and_rewind_pc+0xfc/0x130
  [c0000001fb083340] [c00000000061bfc0] validate_simple_test+0x60/0x170
  [c0000001fb083370] [c00000000061c784] run_simple_test+0x194/0x3c0
  [c0000001fb0833f0] [c00000000061c17c] kgdbts_put_char+0x4c/0x70
  [c0000001fb083420] [c0000000001902e0] put_packet+0x130/0x210
  [c0000001fb083470] [c000000000191338] gdb_serial_stub+0x478/0x1110
  [c0000001fb083560] [c00000000018f19c] kgdb_cpu_enter+0x3fc/0x800
  [c0000001fb083660] [c00000000018f970] kgdb_handle_exception+0x190/0x2c0
  [c0000001fb083730] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb083760] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb0837d0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at kgdb_breakpoint+0x3c/0x70
      LR = run_breakpoint_test+0xa4/0x120
  [c0000001fb083ac0] [0000000000000000]           (null) (unreliable)
  [c0000001fb083ae0] [c00000000061d714] run_breakpoint_test+0xa4/0x120
  [c0000001fb083b50] [c00000000061dcb4] configure_kgdbts+0x2c4/0x6e0
  [c0000001fb083c30] [c00000000000b3d0] do_one_initcall+0xd0/0x250
  [c0000001fb083d00] [c000000000cc42f8] kernel_init_freeable+0x270/0x350
  [c0000001fb083dc0] [c00000000000bd3c] kernel_init+0x2c/0x150
  [c0000001fb083e30] [c0000000000095b0] ret_from_kernel_thread+0x5c/0xac
  Kernel panic - not syncing: Recursive entry to debugger
  CPU: 12 PID: 1 Comm: swapper/0 Not tainted 4.5.0-rc3-00006-g893791ee8b01 #5
  Call Trace:
  [c0000001fb082d70] [c0000000009c4608] dump_stack+0xb0/0xf0 (unreliable)
  [c0000001fb082db0] [c0000000009c2edc] panic+0x138/0x300
  [c0000001fb082e50] [c00000000018fa9c] kgdb_handle_exception+0x2bc/0x2c0
  [c0000001fb082f20] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb082f50] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb082fc0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at check_and_rewind_pc+0x100/0x130
      LR = check_and_rewind_pc+0xfc/0x130
  [c0000001fb083340] [c00000000061bfc0] validate_simple_test+0x60/0x170
  [c0000001fb083370] [c00000000061c784] run_simple_test+0x194/0x3c0
  [c0000001fb0833f0] [c00000000061c17c] kgdbts_put_char+0x4c/0x70
  [c0000001fb083420] [c0000000001902e0] put_packet+0x130/0x210
  [c0000001fb083470] [c000000000191338] gdb_serial_stub+0x478/0x1110
  [c0000001fb083560] [c00000000018f19c] kgdb_cpu_enter+0x3fc/0x800
  [c0000001fb083660] [c00000000018f970] kgdb_handle_exception+0x190/0x2c0
  [c0000001fb083730] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb083760] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb0837d0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at kgdb_breakpoint+0x3c/0x70
      LR = run_breakpoint_test+0xa4/0x120
  [c0000001fb083ac0] [0000000000000000]           (null) (unreliable)
  [c0000001fb083ae0] [c00000000061d714] run_breakpoint_test+0xa4/0x120
  [c0000001fb083b50] [c00000000061dcb4] configure_kgdbts+0x2c4/0x6e0
  [c0000001fb083c30] [c00000000000b3d0] do_one_initcall+0xd0/0x250
  [c0000001fb083d00] [c000000000cc42f8] kernel_init_freeable+0x270/0x350
  [c0000001fb083dc0] [c00000000000bd3c] kernel_init+0x2c/0x150
  [c0000001fb083e30] [c0000000000095b0] ret_from_kernel_thread+0x5c/0xac
  Rebooting in 10 seconds..


cheers

Re: Fix kgdb on little endian ppc64le

From: Balbir Singh <bsingharora@gmail.com>
Date: 2016-02-11 06:03:35

On Tue, 2016-02-09 at 21:11 +1100, Michael Ellerman wrote:
On Mon, 2016-01-02 at 06:03:25 UTC, Balbir Singh wrote:
quoted
From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected
The test suite isn't working for me (I think?), so I think maybe we need
something more?


  KGDB: Registered I/O driver kgdbts
  kgdbts:RUN plant and detach test

  Entering kdb (current=0xc0000001fefc0000, pid 1) on processor 12 due to
Keyboard Entry
  [12]kdb> kgdbts:RUN sw breakpoint test
  kgdbts: BP mismatch c00000000018e2cc expected c00000000061c510
  KGDB: re-enter exception: ALL breakpoints killed
  CPU: 12 PID: 1 Comm: swapper/0 Not tainted 4.5.0-rc3-00006-g893791ee8b01 #5
  Call Trace:
  [c0000001fb082e10] [c0000000009c4608] dump_stack+0xb0/0xf0 (unreliable)
  [c0000001fb082e50] [c00000000018fa8c] kgdb_handle_exception+0x2ac/0x2c0
  [c0000001fb082f20] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb082f50] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb082fc0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at check_and_rewind_pc+0x100/0x130
      LR = check_and_rewind_pc+0xfc/0x130
  [c0000001fb083340] [c00000000061bfc0] validate_simple_test+0x60/0x170
  [c0000001fb083370] [c00000000061c784] run_simple_test+0x194/0x3c0
  [c0000001fb0833f0] [c00000000061c17c] kgdbts_put_char+0x4c/0x70
  [c0000001fb083420] [c0000000001902e0] put_packet+0x130/0x210
  [c0000001fb083470] [c000000000191338] gdb_serial_stub+0x478/0x1110
  [c0000001fb083560] [c00000000018f19c] kgdb_cpu_enter+0x3fc/0x800
  [c0000001fb083660] [c00000000018f970] kgdb_handle_exception+0x190/0x2c0
  [c0000001fb083730] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb083760] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb0837d0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at kgdb_breakpoint+0x3c/0x70
      LR = run_breakpoint_test+0xa4/0x120
  [c0000001fb083ac0] [0000000000000000]           (null) (unreliable)
  [c0000001fb083ae0] [c00000000061d714] run_breakpoint_test+0xa4/0x120
  [c0000001fb083b50] [c00000000061dcb4] configure_kgdbts+0x2c4/0x6e0
  [c0000001fb083c30] [c00000000000b3d0] do_one_initcall+0xd0/0x250
  [c0000001fb083d00] [c000000000cc42f8] kernel_init_freeable+0x270/0x350
  [c0000001fb083dc0] [c00000000000bd3c] kernel_init+0x2c/0x150
  [c0000001fb083e30] [c0000000000095b0] ret_from_kernel_thread+0x5c/0xac
  Kernel panic - not syncing: Recursive entry to debugger
  CPU: 12 PID: 1 Comm: swapper/0 Not tainted 4.5.0-rc3-00006-g893791ee8b01 #5
  Call Trace:
  [c0000001fb082d70] [c0000000009c4608] dump_stack+0xb0/0xf0 (unreliable)
  [c0000001fb082db0] [c0000000009c2edc] panic+0x138/0x300
  [c0000001fb082e50] [c00000000018fa9c] kgdb_handle_exception+0x2bc/0x2c0
  [c0000001fb082f20] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb082f50] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb082fc0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at check_and_rewind_pc+0x100/0x130
      LR = check_and_rewind_pc+0xfc/0x130
  [c0000001fb083340] [c00000000061bfc0] validate_simple_test+0x60/0x170
  [c0000001fb083370] [c00000000061c784] run_simple_test+0x194/0x3c0
  [c0000001fb0833f0] [c00000000061c17c] kgdbts_put_char+0x4c/0x70
  [c0000001fb083420] [c0000000001902e0] put_packet+0x130/0x210
  [c0000001fb083470] [c000000000191338] gdb_serial_stub+0x478/0x1110
  [c0000001fb083560] [c00000000018f19c] kgdb_cpu_enter+0x3fc/0x800
  [c0000001fb083660] [c00000000018f970] kgdb_handle_exception+0x190/0x2c0
  [c0000001fb083730] [c0000000000405f4] kgdb_handle_breakpoint+0x64/0xa0
  [c0000001fb083760] [c0000000009bcee4] program_check_exception+0x144/0x370
  [c0000001fb0837d0] [c000000000006244] program_check_common+0x144/0x180
  --- interrupt: 700 at kgdb_breakpoint+0x3c/0x70
      LR = run_breakpoint_test+0xa4/0x120
  [c0000001fb083ac0] [0000000000000000]           (null) (unreliable)
  [c0000001fb083ae0] [c00000000061d714] run_breakpoint_test+0xa4/0x120
  [c0000001fb083b50] [c00000000061dcb4] configure_kgdbts+0x2c4/0x6e0
  [c0000001fb083c30] [c00000000000b3d0] do_one_initcall+0xd0/0x250
  [c0000001fb083d00] [c000000000cc42f8] kernel_init_freeable+0x270/0x350
  [c0000001fb083dc0] [c00000000000bd3c] kernel_init+0x2c/0x150
  [c0000001fb083e30] [c0000000000095b0] ret_from_kernel_thread+0x5c/0xac
  Rebooting in 10 seconds..
I tried the tests with and without my changes and they both fail. I suspect its
broken on ppc64le on which I am testing. The tests require more work to fix.
I'll see if I can find some time to work on them. This patch is independent of
the current breakage

Thanks for testing the patch.

Balbir Singh

Re: Fix kgdb on little endian ppc64le

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-02-22 09:45:56

On Mon, 2016-01-02 at 06:03:25 UTC, Balbir Singh wrote:
From: Balbir Singh <bsingharora@gmail.com>

I spent some time trying to use kgdb and debugged my inability to
resume from kgdb_handle_breakpoint(). NIP is not incremented
and that leads to a loop in the debugger.

I've tested this lightly on a virtual instance with KDB enabled.
After the patch, I am able to get the "go" command to work as
expected

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/94e3d923592fcfe5585c18a0af

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help