diff mbox series

MIPS: KGDB: fix kgdb support for SMP platforms.

Message ID 20190327131711.7484-1-qiaochong@loongson.cn (mailing list archive)
State Superseded
Headers show
Series MIPS: KGDB: fix kgdb support for SMP platforms. | expand

Commit Message

qiaochong March 27, 2019, 1:17 p.m. UTC
KGDB_call_nmi_hook is called by other cpu through smp call.
MIPS smp call is processed in ipi irq handler and regs is saved in
 handle_int.
So kgdb_call_nmi_hook get regs by get_irq_regs and regs will be passed
 to kgdb_cpu_enter.

Signed-off-by: qiaochong <qiaochong@loongson.cn>
---
 arch/mips/kernel/kgdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Doug Anderson March 27, 2019, 2:37 p.m. UTC | #1
Hi,

On Wed, Mar 27, 2019 at 6:17 AM qiaochong <qiaochong@loongson.cn> wrote:
>
> KGDB_call_nmi_hook is called by other cpu through smp call.
> MIPS smp call is processed in ipi irq handler and regs is saved in
>  handle_int.
> So kgdb_call_nmi_hook get regs by get_irq_regs and regs will be passed
>  to kgdb_cpu_enter.
>
> Signed-off-by: qiaochong <qiaochong@loongson.cn>
> ---
>  arch/mips/kernel/kgdb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
> index 6e574c02e4c3b..6c438a0fd2075 100644
> --- a/arch/mips/kernel/kgdb.c
> +++ b/arch/mips/kernel/kgdb.c
> @@ -214,7 +214,7 @@ void kgdb_call_nmi_hook(void *ignored)
>         old_fs = get_fs();
>         set_fs(KERNEL_DS);
>
> -       kgdb_nmicallback(raw_smp_processor_id(), NULL);
> +       kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
>
>         set_fs(old_fs);
>  }

I'm excited to see others using kgdb!  :-)

As far as I can tell your patch is good, or at least as seems like it
will make MIPS on par with other platforms.  I always wondered why
MIPS (and ARC) didn't have the get_irq_regs() call but when I last
touched this code I left it alone since I didn't have the history for
it and had no way to test.  Since it seems like you have a way to test
this then we should do it.  Now to find someone who would do the same
for ARC.  :-P  Thus:

Reviewed-by: Douglas Anderson <dianders@chromium.org>

NOTE as pointed out in code reviews when I last touched this code,
using get_irq_regs() isn't perfect since it could plausibly return
NULL.  I created a bug in the Chromium tracker with all the details
for this at <https://crbug.com/908723>.

-Doug
diff mbox series

Patch

diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 6e574c02e4c3b..6c438a0fd2075 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -214,7 +214,7 @@  void kgdb_call_nmi_hook(void *ignored)
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 
-	kgdb_nmicallback(raw_smp_processor_id(), NULL);
+	kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
 
 	set_fs(old_fs);
 }