Re: [PATCH v2 2/4] powerpc/interrupt: Refactor prep_irq_for_user_exit()

2021-06-16 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of June 15, 2021 6:37 pm:
> 
> 
> Le 11/06/2021 à 04:30, Nicholas Piggin a écrit :
>> Excerpts from Christophe Leroy's message of June 5, 2021 12:56 am:
>>> prep_irq_for_user_exit() is a superset of
>>> prep_irq_for_kernel_enabled_exit().
>>>
>>> Refactor it.
>> 
>> I like the refactoring, but now prep_irq_for_user_exit() is calling
>> prep_irq_for_kernel_enabled_exit(), which seems like the wrong naming.
>> 
>> You could re-name prep_irq_for_kernel_enabled_exit() to
>> prep_irq_for_enabled_exit() maybe? Or it could be
>> __prep_irq_for_enabled_exit() then prep_irq_for_kernel_enabled_exit()
>> and prep_irq_for_user_exit() would both call it.
> 
> I renamed it prep_irq_for_enabled_exit().
> 
> And I realised that after patch 4, prep_irq_for_enabled_exit() has become a 
> trivial function used 
> only once.
> 
> So I swapped patches 1/2 with patches 3/4 and added a 5th one to squash 
> prep_irq_for_enabled_exit() 
> into its caller.
> 
> You didn't have any comment on patch 4 (that is now patch 2) ?

I think it's okay, just trying to hunt down some apparent big-endian bug 
with my series. I can't see any problems with yours though, thanks for
rebasing them, I'll take a better look when I can.

Thanks,
Nick


Re: [PATCH v2 2/4] powerpc/interrupt: Refactor prep_irq_for_user_exit()

2021-06-15 Thread Christophe Leroy




Le 11/06/2021 à 04:30, Nicholas Piggin a écrit :

Excerpts from Christophe Leroy's message of June 5, 2021 12:56 am:

prep_irq_for_user_exit() is a superset of
prep_irq_for_kernel_enabled_exit().

Refactor it.


I like the refactoring, but now prep_irq_for_user_exit() is calling
prep_irq_for_kernel_enabled_exit(), which seems like the wrong naming.

You could re-name prep_irq_for_kernel_enabled_exit() to
prep_irq_for_enabled_exit() maybe? Or it could be
__prep_irq_for_enabled_exit() then prep_irq_for_kernel_enabled_exit()
and prep_irq_for_user_exit() would both call it.


I renamed it prep_irq_for_enabled_exit().

And I realised that after patch 4, prep_irq_for_enabled_exit() has become a trivial function used 
only once.


So I swapped patches 1/2 with patches 3/4 and added a 5th one to squash prep_irq_for_enabled_exit() 
into its caller.


You didn't have any comment on patch 4 (that is now patch 2) ?

Thanks for the review
Christophe


Re: [PATCH v2 2/4] powerpc/interrupt: Refactor prep_irq_for_user_exit()

2021-06-10 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of June 5, 2021 12:56 am:
> prep_irq_for_user_exit() is a superset of
> prep_irq_for_kernel_enabled_exit().
> 
> Refactor it.

I like the refactoring, but now prep_irq_for_user_exit() is calling 
prep_irq_for_kernel_enabled_exit(), which seems like the wrong naming.

You could re-name prep_irq_for_kernel_enabled_exit() to
prep_irq_for_enabled_exit() maybe? Or it could be 
__prep_irq_for_enabled_exit() then prep_irq_for_kernel_enabled_exit()
and prep_irq_for_user_exit() would both call it.

Otherwise

Reviewed-by: Nicholas Piggin 

> 
> Signed-off-by: Christophe Leroy 
> ---
>  arch/powerpc/kernel/interrupt.c | 25 +
>  1 file changed, 5 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 539455c62c5b..b6aa80930733 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -78,29 +78,14 @@ static notrace __always_inline bool 
> prep_irq_for_kernel_enabled_exit(bool restar
>   */
>  static notrace __always_inline bool prep_irq_for_user_exit(void)
>  {
> - user_enter_irqoff();
> - /* This must be done with RI=1 because tracing may touch vmaps */
> - trace_hardirqs_on();
> -
> -#ifdef CONFIG_PPC32
> - __hard_EE_RI_disable();
> -#else
> - if (exit_must_hard_disable())
> - __hard_EE_RI_disable();
> + bool ret;
>  
> - /* This pattern matches prep_irq_for_idle */
> - if (unlikely(lazy_irq_pending_nocheck())) {
> - if (exit_must_hard_disable()) {
> - local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
> - __hard_RI_enable();
> - }
> - trace_hardirqs_off();
> + user_enter_irqoff();
> + ret = prep_irq_for_kernel_enabled_exit(true);
> + if (!ret)
>   user_exit_irqoff();
>  
> - return false;
> - }
> -#endif
> - return true;
> + return ret;
>  }
>  
>  /* Has to run notrace because it is entered not completely "reconciled" */
> -- 
> 2.25.0
> 
> 


[PATCH v2 2/4] powerpc/interrupt: Refactor prep_irq_for_user_exit()

2021-06-04 Thread Christophe Leroy
prep_irq_for_user_exit() is a superset of
prep_irq_for_kernel_enabled_exit().

Refactor it.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/kernel/interrupt.c | 25 +
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 539455c62c5b..b6aa80930733 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -78,29 +78,14 @@ static notrace __always_inline bool 
prep_irq_for_kernel_enabled_exit(bool restar
  */
 static notrace __always_inline bool prep_irq_for_user_exit(void)
 {
-   user_enter_irqoff();
-   /* This must be done with RI=1 because tracing may touch vmaps */
-   trace_hardirqs_on();
-
-#ifdef CONFIG_PPC32
-   __hard_EE_RI_disable();
-#else
-   if (exit_must_hard_disable())
-   __hard_EE_RI_disable();
+   bool ret;
 
-   /* This pattern matches prep_irq_for_idle */
-   if (unlikely(lazy_irq_pending_nocheck())) {
-   if (exit_must_hard_disable()) {
-   local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
-   __hard_RI_enable();
-   }
-   trace_hardirqs_off();
+   user_enter_irqoff();
+   ret = prep_irq_for_kernel_enabled_exit(true);
+   if (!ret)
user_exit_irqoff();
 
-   return false;
-   }
-#endif
-   return true;
+   return ret;
 }
 
 /* Has to run notrace because it is entered not completely "reconciled" */
-- 
2.25.0