[lkml]   [2019]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe:Re: [PATCH] MIPS: KGDB: fix kgdb support for SMP platforms.
sorry. The patch I just sent missing header asm/irqregs.h.
I resent a patch just now.

I use kgdb on loongson 3a platform, which is 4 core cpu.
Loongson cpu call smp call function by ipi interrupt.

I have tested cpu cmd in kdb and info threads cmd in kgdb with this patch.

Mips save regs and set pt_regs to current_thread_info()->regs(TI_REGS($28)) as bellow.

LONG_S sp, TI_REGS($28)

static inline struct pt_regs *get_irq_regs(void) {
return current_thread_info()->regs; }

在 2019-03-27 22:37:02,"Doug Anderson" <> 写道:

>On Wed, Mar 27, 2019 at 6:17 AM qiaochong <> 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 <>
>> ---
>> 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 <>
>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 <>.

北京市海淀区中关村环保科技示范园龙芯产业园2号楼 100095电话: +86 (10) 62546668传真: +86 (10) 62600826www.loongson.cn本邮件及其附件含有龙芯中科技术有限公司的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部 分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。

This email and its attachments contain confidential information from Loongson
Technology Corporation Limited, which is intended only for the person or entity
whose address is listed above. Any use of the information contained herein in
any way (including, but not limited to, total or partial disclosure,
reproduction or dissemination) by persons other than the intended recipient(s)
is prohibited. If you receive this email in error, please notify the sender by
phone or email immediately and delete it.
 \ /
  Last update: 2019-03-27 16:40    [W:0.024 / U:42.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site