Message ID | 20200526143249.68202-1-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM: mm: Simplify act_mm macro | expand |
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.
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
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
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(-)