[PATCH] MIPS: KGDB: fix kgdb support for SMP platforms.
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); } -- 2.17.0
[PATCH] MIPS: KGDB: fix kgdb support for SMP platforms.
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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c index 6e574c02e4c3b..ea781b29f7f17 100644 --- a/arch/mips/kernel/kgdb.c +++ b/arch/mips/kernel/kgdb.c @@ -33,6 +33,7 @@ #include #include #include +#include static struct hard_trap_info { unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */ @@ -214,7 +215,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); } -- 2.17.0
Re:Re: [PATCH] MIPS: KGDB: fix kgdb support for SMP platforms.
My name is QiaoChong, which is same to my username. Qiao is my family name. Thanks a lot. 在 2019-03-28 00:25:06,"Doug Anderson" 写道: >Hi, > >On Wed, Mar 27, 2019 at 8:06 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 > >Note that you might want to adjust your git settings. Usually in the >kernel they require that a Signed-off-by have your real name, not just >your username. You probably need to spin your patch to fix this. You >should make sure that the authorship of the patch also has your real >name. > > >> --- >> arch/mips/kernel/kgdb.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c >> index 6e574c02e4c3b..ea781b29f7f17 100644 >> --- a/arch/mips/kernel/kgdb.c >> +++ b/arch/mips/kernel/kgdb.c >> @@ -33,6 +33,7 @@ >> #include >> #include >> #include >> +#include >> >> static struct hard_trap_info { >> unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */ >> @@ -214,7 +215,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); >> } > >As per my reply on V1, feel free to add: > >Reviewed-by: Douglas Anderson 北京市海淀区中关村环保科技示范园龙芯产业园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.
Re:Re: Re: [PATCH] MIPS: KGDB: fix kgdb support for SMP platforms.
Hi Doug, I have changed name and signoff info format and resent patch just now. Thanks a lot. 在 2019-03-28 06:27:26,"Doug Anderson" 写道: >Hi, > >On Wed, Mar 27, 2019 at 3:25 PM qiaochong wrote: >> >> >> My name is QiaoChong, which is same to my username. >> Qiao is my family name. >> Thanks a lot. > >I guess it will be up to whichever maintainer lands this (maybe >Daniel?) on whether they want you to spin it. I think folks expect to >see a real name that is capitalized and usually a space between the >family name and the given name. > >-Doug 北京市海淀区中关村环保科技示范园龙芯产业园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.
[PATCH] sched/fair: update_curr changed sum_exec_runtime to 1 when sum_exec_runtime is 0 beacuse some kernel code use sum_exec_runtime==0 to test task just be forked.
From: Chong Qiao Such as: cpu_cgroup_attach> sched_move_task> task_change_group_fair> task_move_group_fair> detach_task_cfs_rq> vruntime_normalized> /* * When !on_rq, vruntime of the task has usually NOT been normalized. * But there are some cases where it has already been normalized: * * - A forked child which is waiting for being woken up by * wake_up_new_task(). * - A task which has been woken up by try_to_wake_up() and * waiting for actually being woken up by sched_ttwu_pending(). */ if (!se->sum_exec_runtime || (p->state == TASK_WAKING && p->sched_remote_wakeup)) return true; p->se.sum_exec_runtime is 0, does not mean task not been run (A forked child which is waiting for being woken up by wake_up_new_task()). Task may have been scheduled multimes, but p->se.sum_exec_runtime is still 0, because delta_exec maybe 0 in update_curr. static void update_curr(struct cfs_rq *cfs_rq) { ... delta_exec = now - curr->exec_start; if (unlikely((s64)delta_exec <= 0)) return; ... curr->sum_exec_runtime += delta_exec; ... } Task has been run and is stopped(on_rq == 0), vruntime not been normalized, but se->sum_exec_runtime == 0. This cause vruntime_normalized set on_rq 1, and does not normalize vruntime. This may cause task use old vruntime in old cgroup, which maybe very large than task's vruntime in new cgroup. Which may cause task may not scheduled in run queue for long time after been waked up. Now I change sum_exec_runtime to 1 when sum_exec_runtime == 0 in update_curr to make sun_exec_runtime not 0. Signed-off-by: Chong Qiao --- kernel/sched/fair.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bc9cfeaac8bd2..c4cd6249d9d2c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -841,8 +841,15 @@ static void update_curr(struct cfs_rq *cfs_rq) return; delta_exec = now - curr->exec_start; - if (unlikely((s64)delta_exec <= 0)) + if (unlikely((s64)delta_exec <= 0)) { + /* +* se.sum_exec_runtime == 0 means task is forked and wait to be run. +* So here change se.sum_exec_runtime to 1, to make it not 0. +*/ + if (!curr->sum_exec_runtime) + curr->sum_exec_runtime++; return; + } curr->exec_start = now; -- 2.17.1
[PATCH] parport_pc: fix find_superio io compare code, should use equal test.
From: QiaoChong git blame drivers/parport/parport_pc.c 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1376) static struct superio_struct *find_superio(struct parport *p) ^1da177e4c3f4 (Linus Torvalds2005-04-16 15:20:36 -0700 1377) { 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1378) int i; 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1379) for (i = 0; i < NR_SUPERIOS; i++) 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1380) if (superios[i].io != p->base) 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1381) return &superios[i]; 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1382) return NULL; 181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1383) } 73e0d48b8c28f (Michael Buesch2009-06-11 13:06:31 +0100 1384) git log -1 -p 181bf1e815a2a -static int get_superio_dma(struct parport *p) +static struct superio_struct *find_superio(struct parport *p) { - int i = 0; + int i; + for (i = 0; i < NR_SUPERIOS; i++) + if (superios[i].io != p->base) + return &superios[i]; + return NULL; +} - while ((i < NR_SUPERIOS) && (superios[i].io != p->base)) - i++; - if (i != NR_SUPERIOS) - return superios[i].dma; the code before 181bf1e815a2a also mean superio[i].io == p->base, fixup it. Signed-off-by: QiaoChong --- drivers/parport/parport_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 9c8249f744792..6296dbb83d470 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p) { int i; for (i = 0; i < NR_SUPERIOS; i++) - if (superios[i].io != p->base) + if (superios[i].io == p->base) return &superios[i]; return NULL; } -- 2.17.1
[PATCH] parport_pc: fix find_superio io compare code, should use equal test.
From: QiaoChong Fixes: 181bf1e815a2a("parport_pc: clean up the modified while loops using for"). The code find_superio should test superio[i].io == p->base then find out superio, fix it. Signed-off-by: QiaoChong --- drivers/parport/parport_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 9c8249f744792..6296dbb83d470 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p) { int i; for (i = 0; i < NR_SUPERIOS; i++) - if (superios[i].io != p->base) + if (superios[i].io == p->base) return &superios[i]; return NULL; } -- 2.17.0