* [PATCH] powerpc/32s: Speed up likely path of kuap_update_sr()
@ 2021-05-06 13:27 ` Christophe Leroy
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2021-05-06 13:27 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linux-kernel, linuxppc-dev
In most cases, kuap_update_sr() will update a single segment
register.
We know that first update will always be done, if there is no
segment register to update at all, kuap_update_sr() is not
called.
Avoid recurring calculations and tests in that case.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/book3s/32/kup.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/include/asm/book3s/32/kup.h
index 1670dfe9d4f1..c1f7c2e625a6 100644
--- a/arch/powerpc/include/asm/book3s/32/kup.h
+++ b/arch/powerpc/include/asm/book3s/32/kup.h
@@ -15,11 +15,13 @@ static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
{
addr &= 0xf0000000; /* align addr to start of segment */
barrier(); /* make sure thread.kuap is updated before playing with SRs */
- while (addr < end) {
+ for (;;) {
mtsr(sr, addr);
+ addr += 0x10000000; /* address of next segment */
+ if (addr >= end)
+ break;
sr += 0x111; /* next VSID */
sr &= 0xf0ffffff; /* clear VSID overflow */
- addr += 0x10000000; /* address of next segment */
}
isync(); /* Context sync required after mtsr() */
}
--
2.25.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] powerpc/32s: Speed up likely path of kuap_update_sr()
@ 2021-05-06 13:27 ` Christophe Leroy
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2021-05-06 13:27 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In most cases, kuap_update_sr() will update a single segment
register.
We know that first update will always be done, if there is no
segment register to update at all, kuap_update_sr() is not
called.
Avoid recurring calculations and tests in that case.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/book3s/32/kup.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/include/asm/book3s/32/kup.h
index 1670dfe9d4f1..c1f7c2e625a6 100644
--- a/arch/powerpc/include/asm/book3s/32/kup.h
+++ b/arch/powerpc/include/asm/book3s/32/kup.h
@@ -15,11 +15,13 @@ static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
{
addr &= 0xf0000000; /* align addr to start of segment */
barrier(); /* make sure thread.kuap is updated before playing with SRs */
- while (addr < end) {
+ for (;;) {
mtsr(sr, addr);
+ addr += 0x10000000; /* address of next segment */
+ if (addr >= end)
+ break;
sr += 0x111; /* next VSID */
sr &= 0xf0ffffff; /* clear VSID overflow */
- addr += 0x10000000; /* address of next segment */
}
isync(); /* Context sync required after mtsr() */
}
--
2.25.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/32s: Speed up likely path of kuap_update_sr()
2021-05-06 13:27 ` Christophe Leroy
(?)
@ 2021-06-06 12:08 ` Michael Ellerman
-1 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-06-06 12:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Christophe Leroy, Michael Ellerman,
Paul Mackerras
Cc: linuxppc-dev, linux-kernel
On Thu, 6 May 2021 13:27:31 +0000 (UTC), Christophe Leroy wrote:
> In most cases, kuap_update_sr() will update a single segment
> register.
>
> We know that first update will always be done, if there is no
> segment register to update at all, kuap_update_sr() is not
> called.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/32s: Speed up likely path of kuap_update_sr()
https://git.kernel.org/powerpc/c/8af8d72dc58e90dc945ca627b24968400e0f21b6
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-06 12:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 13:27 [PATCH] powerpc/32s: Speed up likely path of kuap_update_sr() Christophe Leroy
2021-05-06 13:27 ` Christophe Leroy
2021-06-06 12:08 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.