Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()

2020-05-28 Thread yuanjunqing
sorry!

在 2020/5/28 下午8:35, YuanJunQing 写道:
>  Register "a1" is unsaved in this function,
>  when CONFIG_TRACE_IRQFLAGS is enabled,
>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
>  and this may change register "a1".
>  The changed register "a1" as argument will be send
>  to do_fpe() and do_msa_fpe().
>
> Signed-off-by: YuanJunQing 
> ---
>  arch/mips/kernel/genex.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
> index 8236fb291e3f..a1b966f3578e 100644
> --- a/arch/mips/kernel/genex.S
> +++ b/arch/mips/kernel/genex.S
> @@ -476,20 +476,20 @@ NESTED(nmi_handler, PT_SIZE, sp)
>   .endm
>  
>   .macro  __build_clear_fpe
> + CLI
> + TRACE_IRQS_OFF
>   .setpush
>   /* gas fails to assemble cfc1 for some archs (octeon).*/ \
>   .setmips1
>   SET_HARDFLOAT
>   cfc1a1, fcr31
>   .setpop
> - CLI
> - TRACE_IRQS_OFF
>   .endm
>  
>   .macro  __build_clear_msa_fpe
> - _cfcmsa a1, MSA_CSR
>   CLI
>   TRACE_IRQS_OFF
> + _cfcmsa a1, MSA_CSR
>   .endm
>  
>   .macro  __build_clear_ade



[PATCH] MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()

2020-05-28 Thread YuanJunQing
 Register "a1" is unsaved in this function,
 when CONFIG_TRACE_IRQFLAGS is enabled,
 the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
 and this may change register "a1".
 The changed register "a1" as argument will be send
 to do_fpe() and do_msa_fpe().

Signed-off-by: YuanJunQing 
---
 arch/mips/kernel/genex.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8236fb291e3f..a1b966f3578e 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -476,20 +476,20 @@ NESTED(nmi_handler, PT_SIZE, sp)
.endm
 
.macro  __build_clear_fpe
+   CLI
+   TRACE_IRQS_OFF
.setpush
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.setmips1
SET_HARDFLOAT
cfc1a1, fcr31
.setpop
-   CLI
-   TRACE_IRQS_OFF
.endm
 
.macro  __build_clear_msa_fpe
-   _cfcmsa a1, MSA_CSR
CLI
TRACE_IRQS_OFF
+   _cfcmsa a1, MSA_CSR
.endm
 
.macro  __build_clear_ade
-- 
2.17.1



Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()

2020-05-27 Thread Thomas Bogendoerfer
On Wed, May 27, 2020 at 02:11:30PM +0800, YuanJunQing wrote:
>  Register "a1" is unsaved in this function,
>  when CONFIG_TRACE_IRQFLAGS is enabled,
>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
>  and this may change register "a1".
>  The changed register "a1" as argument will be send
>  to do_fpe() and do_msa_fpe().
> 
> Signed-off-by: YuanJunQing 
> ---
>  arch/mips/kernel/genex.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


[PATCH] MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()

2020-05-27 Thread YuanJunQing
 Register "a1" is unsaved in this function,
 when CONFIG_TRACE_IRQFLAGS is enabled,
 the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
 and this may change register "a1".
 The changed register "a1" as argument will be send
 to do_fpe() and do_msa_fpe().

Signed-off-by: YuanJunQing 
---
 arch/mips/kernel/genex.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8236fb291e3f..a1b966f3578e 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -476,20 +476,20 @@ NESTED(nmi_handler, PT_SIZE, sp)
.endm
 
.macro  __build_clear_fpe
+   CLI
+   TRACE_IRQS_OFF
.setpush
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.setmips1
SET_HARDFLOAT
cfc1a1, fcr31
.setpop
-   CLI
-   TRACE_IRQS_OFF
.endm
 
.macro  __build_clear_msa_fpe
-   _cfcmsa a1, MSA_CSR
CLI
TRACE_IRQS_OFF
+   _cfcmsa a1, MSA_CSR
.endm
 
.macro  __build_clear_ade
-- 
2.17.1



Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-26 Thread yuanjunqing
yes, I will re-send email for this patch.

在 2020/5/26 下午9:04, Thomas Bogendoerfer 写道:
> On Tue, May 26, 2020 at 03:07:16PM +0800, yuanjunqing wrote:
>> 在 2020/5/25 下午4:42, Thomas Bogendoerfer 写道:
>>> On Mon, May 25, 2020 at 11:31:23AM +0800, YuanJunQing wrote:
  Register "a1" is unsaved in this function,
  when CONFIG_TRACE_IRQFLAGS is enabled,
  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
  and this may change register "a1".
  The variment of register "a1" may send SIGFPE signal
  to task when call do_fpe(),and this may kill the task.

 Signed-off-by: YuanJunQing 
 ---
  arch/mips/kernel/genex.S | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
 index 8236fb291e3f..956a76429773 100644
 --- a/arch/mips/kernel/genex.S
 +++ b/arch/mips/kernel/genex.S
 @@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.setmips1
SET_HARDFLOAT
 -  cfc1a1, fcr31
 +  cfc1s0, fcr31
.setpop
CLI
TRACE_IRQS_OFF
 +  movea1,s0
.endm
>>> do we realy need to read fcr31 that early ? Wouldn't it work to
>>> just move the cfc1 below TRACE_IRQS_OFF ?
>>>
>>  yes, it can work when we just move the cfc1 below TRACE_IRQS_OFF,
>>  and the code is written as follows.
>>
>>  CLI
>>  TRACE_IRQS_OFF
>>  .setmips1
>>  SET_HARDFLOAT
>>  cfc1a1, fcr31
>>  .setpop
>>    .endm
> good, could we do the same with _cfcmsa   a1, MSA_CSR in the msa case ?
>
> Thomas.
>



Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-26 Thread Thomas Bogendoerfer
On Tue, May 26, 2020 at 03:07:16PM +0800, yuanjunqing wrote:
> 
> 在 2020/5/25 下午4:42, Thomas Bogendoerfer 写道:
> > On Mon, May 25, 2020 at 11:31:23AM +0800, YuanJunQing wrote:
> >>  Register "a1" is unsaved in this function,
> >>  when CONFIG_TRACE_IRQFLAGS is enabled,
> >>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
> >>  and this may change register "a1".
> >>  The variment of register "a1" may send SIGFPE signal
> >>  to task when call do_fpe(),and this may kill the task.
> >>
> >> Signed-off-by: YuanJunQing 
> >> ---
> >>  arch/mips/kernel/genex.S | 6 --
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
> >> index 8236fb291e3f..956a76429773 100644
> >> --- a/arch/mips/kernel/genex.S
> >> +++ b/arch/mips/kernel/genex.S
> >> @@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
> >>/* gas fails to assemble cfc1 for some archs (octeon).*/ \
> >>.setmips1
> >>SET_HARDFLOAT
> >> -  cfc1a1, fcr31
> >> +  cfc1s0, fcr31
> >>.setpop
> >>CLI
> >>TRACE_IRQS_OFF
> >> +  movea1,s0
> >>.endm
> > do we realy need to read fcr31 that early ? Wouldn't it work to
> > just move the cfc1 below TRACE_IRQS_OFF ?
> >
> 
>  yes, it can work when we just move the cfc1 below TRACE_IRQS_OFF,
>  and the code is written as follows.
> 
>   CLI
>   TRACE_IRQS_OFF
>   .setmips1
>   SET_HARDFLOAT
>   cfc1a1, fcr31
>   .setpop
>    .endm

good, could we do the same with _cfcmsa a1, MSA_CSR in the msa case ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-26 Thread Thomas Bogendoerfer
On Tue, May 26, 2020 at 02:03:14PM +0800, Lichao Liu wrote:
> From: YuanJunQing 
> 
> Register "a1" is unsaved in this function,
>  when CONFIG_TRACE_IRQFLAGS is enabled,
>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
>  and this may change register "a1".
>  The variment of register "a1" may send SIGFPE signal
>  to task when call do_fpe(),and this may kill the task.
> 
> Signed-off-by: YuanJunQing 

if you send patches from other people, please add your
Signed-off-by.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-26 Thread yuanjunqing


在 2020/5/25 下午4:42, Thomas Bogendoerfer 写道:
> On Mon, May 25, 2020 at 11:31:23AM +0800, YuanJunQing wrote:
>>  Register "a1" is unsaved in this function,
>>  when CONFIG_TRACE_IRQFLAGS is enabled,
>>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
>>  and this may change register "a1".
>>  The variment of register "a1" may send SIGFPE signal
>>  to task when call do_fpe(),and this may kill the task.
>>
>> Signed-off-by: YuanJunQing 
>> ---
>>  arch/mips/kernel/genex.S | 6 --
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
>> index 8236fb291e3f..956a76429773 100644
>> --- a/arch/mips/kernel/genex.S
>> +++ b/arch/mips/kernel/genex.S
>> @@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
>>  /* gas fails to assemble cfc1 for some archs (octeon).*/ \
>>  .setmips1
>>  SET_HARDFLOAT
>> -cfc1a1, fcr31
>> +cfc1s0, fcr31
>>  .setpop
>>  CLI
>>  TRACE_IRQS_OFF
>> +movea1,s0
>>  .endm
> do we realy need to read fcr31 that early ? Wouldn't it work to
> just move the cfc1 below TRACE_IRQS_OFF ?
>
> Thomas.


 yes, it can work when we just move the cfc1 below TRACE_IRQS_OFF,
 and the code is written as follows.

CLI
TRACE_IRQS_OFF
.setmips1
SET_HARDFLOAT
cfc1a1, fcr31
.setpop
   .endm




Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-25 Thread Thomas Bogendoerfer
On Mon, May 25, 2020 at 11:31:23AM +0800, YuanJunQing wrote:
>  Register "a1" is unsaved in this function,
>  when CONFIG_TRACE_IRQFLAGS is enabled,
>  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
>  and this may change register "a1".
>  The variment of register "a1" may send SIGFPE signal
>  to task when call do_fpe(),and this may kill the task.
> 
> Signed-off-by: YuanJunQing 
> ---
>  arch/mips/kernel/genex.S | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
> index 8236fb291e3f..956a76429773 100644
> --- a/arch/mips/kernel/genex.S
> +++ b/arch/mips/kernel/genex.S
> @@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
>   /* gas fails to assemble cfc1 for some archs (octeon).*/ \
>   .setmips1
>   SET_HARDFLOAT
> - cfc1a1, fcr31
> + cfc1s0, fcr31
>   .setpop
>   CLI
>   TRACE_IRQS_OFF
> + movea1,s0
>   .endm

do we realy need to read fcr31 that early ? Wouldn't it work to
just move the cfc1 below TRACE_IRQS_OFF ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-25 Thread Sergei Shtylyov

Hello!

On 25.05.2020 6:31, YuanJunQing wrote:


  Register "a1" is unsaved in this function,
  when CONFIG_TRACE_IRQFLAGS is enabled,
  the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
  and this may change register "a1".
  The variment of register "a1" may send SIGFPE signal


   Variment?


  to task when call do_fpe(),and this may kill the task.


   Need space after comma.


Signed-off-by: YuanJunQing 
---
  arch/mips/kernel/genex.S | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8236fb291e3f..956a76429773 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.setmips1
SET_HARDFLOAT
-   cfc1a1, fcr31
+   cfc1s0, fcr31
.setpop
CLI
TRACE_IRQS_OFF
+   movea1,s0


   Need space after comma.


.endm
  
  	.macro	__build_clear_msa_fpe

-   _cfcmsa a1, MSA_CSR
+   _cfcmsa s0, MSA_CSR
CLI
TRACE_IRQS_OFF
+   movea1,s0


   Ditto.

[...]

MBR, Sergei


[PATCH] MIPS: Fix IRQ tracing when call handle_fpe()

2020-05-24 Thread YuanJunQing
 Register "a1" is unsaved in this function,
 when CONFIG_TRACE_IRQFLAGS is enabled,
 the TRACE_IRQS_OFF macro will call trace_hardirqs_off(),
 and this may change register "a1".
 The variment of register "a1" may send SIGFPE signal
 to task when call do_fpe(),and this may kill the task.

Signed-off-by: YuanJunQing 
---
 arch/mips/kernel/genex.S | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8236fb291e3f..956a76429773 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -480,16 +480,18 @@ NESTED(nmi_handler, PT_SIZE, sp)
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.setmips1
SET_HARDFLOAT
-   cfc1a1, fcr31
+   cfc1s0, fcr31
.setpop
CLI
TRACE_IRQS_OFF
+   movea1,s0
.endm
 
.macro  __build_clear_msa_fpe
-   _cfcmsa a1, MSA_CSR
+   _cfcmsa s0, MSA_CSR
CLI
TRACE_IRQS_OFF
+   movea1,s0
.endm
 
.macro  __build_clear_ade
-- 
2.17.1