linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] LoongArch: Fixup do_ri csr_era
@ 2022-09-26 12:27 Jun Yi
  2022-09-26 23:41 ` Guo Ren
  0 siblings, 1 reply; 4+ messages in thread
From: Jun Yi @ 2022-09-26 12:27 UTC (permalink / raw)
  To: Huacai Chen, WANG Xuerui, Tiezhu Yang, Jiaxun Yang, Qing Zhang,
	Guo Ren, Mao Bibo, Jianmin Lv
  Cc: loongarch, linux-kernel

csr_era of pt_regs in do_ri should not add 4 to point to the
next instruction.

Signed-off-by: Jun Yi <yijun@loongson.cn>
---
 arch/loongarch/kernel/traps.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
index aa1c95aaf595..ec888eda3d45 100644
--- a/arch/loongarch/kernel/traps.c
+++ b/arch/loongarch/kernel/traps.c
@@ -477,8 +477,6 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs)
 
 	die_if_kernel("Reserved instruction in kernel code", regs);
 
-	compute_return_era(regs);
-
 	if (unlikely(get_user(opcode, era) < 0)) {
 		status = SIGSEGV;
 		current->thread.error_code = 1;
-- 
2.31.1


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

* Re: [PATCH v3] LoongArch: Fixup do_ri csr_era
  2022-09-26 12:27 [PATCH v3] LoongArch: Fixup do_ri csr_era Jun Yi
@ 2022-09-26 23:41 ` Guo Ren
  2022-09-27  3:10   ` Jun Yi
  0 siblings, 1 reply; 4+ messages in thread
From: Guo Ren @ 2022-09-26 23:41 UTC (permalink / raw)
  To: Jun Yi
  Cc: Huacai Chen, WANG Xuerui, Tiezhu Yang, Jiaxun Yang, Qing Zhang,
	Mao Bibo, Jianmin Lv, loongarch, linux-kernel

On Mon, Sep 26, 2022 at 8:27 PM Jun Yi <yijun@loongson.cn> wrote:
>
> csr_era of pt_regs in do_ri should not add 4 to point to the
> next instruction.
The comment does not make sense. I think it wants to skip some
instructions, but your patch broke that.

>
> Signed-off-by: Jun Yi <yijun@loongson.cn>
> ---
>  arch/loongarch/kernel/traps.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
> index aa1c95aaf595..ec888eda3d45 100644
> --- a/arch/loongarch/kernel/traps.c
> +++ b/arch/loongarch/kernel/traps.c
> @@ -477,8 +477,6 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs)
>
>         die_if_kernel("Reserved instruction in kernel code", regs);
>
> -       compute_return_era(regs);
> -
>         if (unlikely(get_user(opcode, era) < 0)) {
>                 status = SIGSEGV;
>                 current->thread.error_code = 1;
> --
> 2.31.1
>


-- 
Best Regards
 Guo Ren

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

* Re: [PATCH v3] LoongArch: Fixup do_ri csr_era
  2022-09-26 23:41 ` Guo Ren
@ 2022-09-27  3:10   ` Jun Yi
  2022-09-27  5:03     ` Huacai Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Jun Yi @ 2022-09-27  3:10 UTC (permalink / raw)
  To: Guo Ren
  Cc: Huacai Chen, WANG Xuerui, Tiezhu Yang, Jiaxun Yang, Qing Zhang,
	Mao Bibo, Jianmin Lv, loongarch, linux-kernel

do_ri is porting from mips, mipsr6 use do_ri to emulate some fp 
instructions, but Loongarch do not need to emulate these instructions.

And the regs->csr_era be always recovered to ths old_era = 
regs->csr_era, so the compute_return_era is useless.

On 9/27/22 07:41, Guo Ren wrote:
> On Mon, Sep 26, 2022 at 8:27 PM Jun Yi <yijun@loongson.cn> wrote:
>>
>> csr_era of pt_regs in do_ri should not add 4 to point to the
>> next instruction.
> The comment does not make sense. I think it wants to skip some
> instructions, but your patch broke that.
> 
>>
>> Signed-off-by: Jun Yi <yijun@loongson.cn>
>> ---
>>   arch/loongarch/kernel/traps.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
>> index aa1c95aaf595..ec888eda3d45 100644
>> --- a/arch/loongarch/kernel/traps.c
>> +++ b/arch/loongarch/kernel/traps.c
>> @@ -477,8 +477,6 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs)
>>
>>          die_if_kernel("Reserved instruction in kernel code", regs);
>>
>> -       compute_return_era(regs);
>> -
>>          if (unlikely(get_user(opcode, era) < 0)) {
>>                  status = SIGSEGV;
>>                  current->thread.error_code = 1;
>> --
>> 2.31.1
>>
> 
> 


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

* Re: [PATCH v3] LoongArch: Fixup do_ri csr_era
  2022-09-27  3:10   ` Jun Yi
@ 2022-09-27  5:03     ` Huacai Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2022-09-27  5:03 UTC (permalink / raw)
  To: Jun Yi
  Cc: Guo Ren, WANG Xuerui, Tiezhu Yang, Jiaxun Yang, Qing Zhang,
	Mao Bibo, Jianmin Lv, loongarch, linux-kernel

Hi, all,

I clean up do_ri() further based on this patch [1], thanks.

[1] https://lore.kernel.org/loongarch/20220927045820.2770062-1-chenhuacai@loongson.cn/T/#u


On Tue, Sep 27, 2022 at 11:10 AM Jun Yi <yijun@loongson.cn> wrote:
>
> do_ri is porting from mips, mipsr6 use do_ri to emulate some fp
> instructions, but Loongarch do not need to emulate these instructions.
>
> And the regs->csr_era be always recovered to ths old_era =
> regs->csr_era, so the compute_return_era is useless.
>
> On 9/27/22 07:41, Guo Ren wrote:
> > On Mon, Sep 26, 2022 at 8:27 PM Jun Yi <yijun@loongson.cn> wrote:
> >>
> >> csr_era of pt_regs in do_ri should not add 4 to point to the
> >> next instruction.
> > The comment does not make sense. I think it wants to skip some
> > instructions, but your patch broke that.
> >
> >>
> >> Signed-off-by: Jun Yi <yijun@loongson.cn>
> >> ---
> >>   arch/loongarch/kernel/traps.c | 2 --
> >>   1 file changed, 2 deletions(-)
> >>
> >> diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
> >> index aa1c95aaf595..ec888eda3d45 100644
> >> --- a/arch/loongarch/kernel/traps.c
> >> +++ b/arch/loongarch/kernel/traps.c
> >> @@ -477,8 +477,6 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs)
> >>
> >>          die_if_kernel("Reserved instruction in kernel code", regs);
> >>
> >> -       compute_return_era(regs);
> >> -
> >>          if (unlikely(get_user(opcode, era) < 0)) {
> >>                  status = SIGSEGV;
> >>                  current->thread.error_code = 1;
> >> --
> >> 2.31.1
> >>
> >
> >
>

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

end of thread, other threads:[~2022-09-27  5:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 12:27 [PATCH v3] LoongArch: Fixup do_ri csr_era Jun Yi
2022-09-26 23:41 ` Guo Ren
2022-09-27  3:10   ` Jun Yi
2022-09-27  5:03     ` Huacai Chen

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).