linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: mm: Simplify act_mm macro
@ 2020-05-26 14:32 Linus Walleij
  2020-05-26 14:37 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2020-05-26 14:32 UTC (permalink / raw)
  To: Russell King; +Cc: Linus Walleij, linux-arm-kernel

The act_mm assembly macro is actually partly reimplementing
get_thread_info so let's just use that.

Suggested-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mm/proc-macros.S | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 60ac7c5999a9..65eaea85d3d6 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -5,7 +5,6 @@
  *  VMA_VM_FLAGS
  *  VM_EXEC
  */
-#include <linux/const.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 
@@ -31,9 +30,7 @@
  * act_mm - get current->active_mm
  */
 	.macro	act_mm, rd
-	bic	\rd, sp, #(THREAD_SIZE - 1) & ~63
-	bic	\rd, \rd, #63
-	ldr	\rd, [\rd, #TI_TASK]
+	get_thread_info \rd
 	.if (TSK_ACTIVE_MM > IMM12_MASK)
 	add	\rd, \rd, #TSK_ACTIVE_MM & ~IMM12_MASK
 	.endif
-- 
2.25.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: mm: Simplify act_mm macro
  2020-05-26 14:32 [PATCH] ARM: mm: Simplify act_mm macro Linus Walleij
@ 2020-05-26 14:37 ` Russell King - ARM Linux admin
  2020-05-26 18:08   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2020-05-26 14:37 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-arm-kernel

On Tue, May 26, 2020 at 04:32:49PM +0200, Linus Walleij wrote:
> The act_mm assembly macro is actually partly reimplementing
> get_thread_info so let's just use that.
> 
> Suggested-by: Russell King <linux@armlinux.org.uk>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mm/proc-macros.S | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index 60ac7c5999a9..65eaea85d3d6 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -5,7 +5,6 @@
>   *  VMA_VM_FLAGS
>   *  VM_EXEC
>   */
> -#include <linux/const.h>
>  #include <asm/asm-offsets.h>
>  #include <asm/thread_info.h>
>  
> @@ -31,9 +30,7 @@
>   * act_mm - get current->active_mm
>   */
>  	.macro	act_mm, rd
> -	bic	\rd, sp, #(THREAD_SIZE - 1) & ~63
> -	bic	\rd, \rd, #63
> -	ldr	\rd, [\rd, #TI_TASK]
> +	get_thread_info \rd

This is not quite the same thing.

get_thread_info loads into \rd the address of the thread_info structure.
That's what the two bic instructions are doing.  The LDR is then loading
the address of the task_struct into \rd.

>  	.if (TSK_ACTIVE_MM > IMM12_MASK)
>  	add	\rd, \rd, #TSK_ACTIVE_MM & ~IMM12_MASK
>  	.endif

So this change alters which structure \rd is pointing to.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: mm: Simplify act_mm macro
  2020-05-26 14:37 ` Russell King - ARM Linux admin
@ 2020-05-26 18:08   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-05-26 18:08 UTC (permalink / raw)
  To: Russell King - ARM Linux admin; +Cc: Linux ARM

On Tue, May 26, 2020 at 4:37 PM Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
> On Tue, May 26, 2020 at 04:32:49PM +0200, Linus Walleij wrote:
> > The act_mm assembly macro is actually partly reimplementing
> > get_thread_info so let's just use that.
> >
> > Suggested-by: Russell King <linux@armlinux.org.uk>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> >  arch/arm/mm/proc-macros.S | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index 60ac7c5999a9..65eaea85d3d6 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -5,7 +5,6 @@
> >   *  VMA_VM_FLAGS
> >   *  VM_EXEC
> >   */
> > -#include <linux/const.h>
> >  #include <asm/asm-offsets.h>
> >  #include <asm/thread_info.h>
> >
> > @@ -31,9 +30,7 @@
> >   * act_mm - get current->active_mm
> >   */
> >       .macro  act_mm, rd
> > -     bic     \rd, sp, #(THREAD_SIZE - 1) & ~63
> > -     bic     \rd, \rd, #63
> > -     ldr     \rd, [\rd, #TI_TASK]
> > +     get_thread_info \rd
>
> This is not quite the same thing.
>
> get_thread_info loads into \rd the address of the thread_info structure.
> That's what the two bic instructions are doing.  The LDR is then loading
> the address of the task_struct into \rd.
>
> >       .if (TSK_ACTIVE_MM > IMM12_MASK)
> >       add     \rd, \rd, #TSK_ACTIVE_MM & ~IMM12_MASK
> >       .endif
>
> So this change alters which structure \rd is pointing to.

Oh I see it. I need to keep the last ldr     \rd, [\rd, #TI_TASK].

Strange that it wasn't crashing on me, I guess I was lucky.

I'll respin, thanks!

(The plan is to also make a patch to get_thread_info to use
bic like you pointed out, I'm just slow with my assembly.)

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-05-26 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-26 14:32 [PATCH] ARM: mm: Simplify act_mm macro Linus Walleij
2020-05-26 14:37 ` Russell King - ARM Linux admin
2020-05-26 18:08   ` Linus Walleij

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