public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]
@ 2020-05-11 10:12 Florian Weimer
  2020-05-11 14:04 ` Paul E Murphy
  2020-05-11 14:08 ` Lucas A. M. Magalhaes
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Weimer @ 2020-05-11 10:12 UTC (permalink / raw)
  To: libc-alpha

Sandipan Das reported that,

"The Power ISA mandates that all writes to the Authority
Mask Register (AMR) must always be preceded as well as
succeeded by a context-synchronizing instruction. This
applies to both the privileged and unprivileged variants
of the Move To AMR instruction.

This [requirement] is from Table 6 of Chapter 11 in page 1134 of Power
ISA 3.0B. The document can be found here:
<https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv>
"

See this kernel patch submission:

<https://lore.kernel.org/linuxppc-dev/5f65cf37be993760de8112a88da194e3ccbb2bf8.1588959697.git.sandipan@linux.ibm.com/>

Tested on powerpc64le-linux-gnu on a POWER9 system with disable_radix
and a compatible kernel (kernel-4.18.0-193.el8.ppc64le).

-----
 sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
index 623b073d5a..25d080c9a6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
@@ -37,7 +37,7 @@ pkey_read (void)
 static inline void
 pkey_write (unsigned long int value)
 {
-  __asm__ volatile ("mtspr 13, %0" : : "r" (value));
+  __asm__ volatile ("isync; mtspr 13, %0; isync" : : "r" (value));
 }
 
 /* Number of the largest supported key.  This depends on the width of


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

* Re: [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]
  2020-05-11 10:12 [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954] Florian Weimer
@ 2020-05-11 14:04 ` Paul E Murphy
  2020-05-11 14:08 ` Lucas A. M. Magalhaes
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E Murphy @ 2020-05-11 14:04 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha



On 5/11/20 5:12 AM, Florian Weimer via Libc-alpha wrote:

> @@ -37,7 +37,7 @@ pkey_read (void)
>   static inline void
>   pkey_write (unsigned long int value)
>   {
> -  __asm__ volatile ("mtspr 13, %0" : : "r" (value));
> +  __asm__ volatile ("isync; mtspr 13, %0; isync" : : "r" (value));
>   }
> 
>   /* Number of the largest supported key.  This depends on the width of

LGTM.

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

* Re: [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]
  2020-05-11 10:12 [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954] Florian Weimer
  2020-05-11 14:04 ` Paul E Murphy
@ 2020-05-11 14:08 ` Lucas A. M. Magalhaes
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas A. M. Magalhaes @ 2020-05-11 14:08 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha

Thanks Florian.

LGTM

---
Lucas A. M. Magalhães

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 10:12 [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954] Florian Weimer
2020-05-11 14:04 ` Paul E Murphy
2020-05-11 14:08 ` Lucas A. M. Magalhaes

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 read-only IMAP folder(s) and NNTP newsgroup(s).