* [PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes
@ 2020-05-08 17:49 Sandipan Das
2020-05-08 17:49 ` [PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions Sandipan Das
2020-05-08 17:49 ` [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates Sandipan Das
0 siblings, 2 replies; 6+ messages in thread
From: Sandipan Das @ 2020-05-08 17:49 UTC (permalink / raw)
To: akpm
Cc: linux-mm, linux-kselftest, linuxppc-dev, linuxram, aneesh.kumar,
bauerman, mpe, fweimer
Some fixes for the powerpc bits w.r.t to the way the pkey
access rights are defined and how the permission register
is updated.
Sandipan Das (2):
selftests: vm: pkeys: Fix powerpc access right definitions
selftests: vm: pkeys: Fix powerpc access right updates
tools/testing/selftests/vm/pkey-powerpc.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions
2020-05-08 17:49 [PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes Sandipan Das
@ 2020-05-08 17:49 ` Sandipan Das
2020-05-08 17:49 ` [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates Sandipan Das
1 sibling, 0 replies; 6+ messages in thread
From: Sandipan Das @ 2020-05-08 17:49 UTC (permalink / raw)
To: akpm
Cc: linux-mm, linux-kselftest, linuxppc-dev, linuxram, aneesh.kumar,
bauerman, mpe, fweimer
For powerpc, PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS are
redefined only if the system headers already define them.
Otherwise, the test fails to compile due to their absence.
This makes sure that they are always defined irrespective of
them being present in the system headers.
Fixes: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support")
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
tools/testing/selftests/vm/pkey-powerpc.h | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h
index 3a761e51a587..eb5077de8f1e 100644
--- a/tools/testing/selftests/vm/pkey-powerpc.h
+++ b/tools/testing/selftests/vm/pkey-powerpc.h
@@ -16,15 +16,11 @@
#define fpregs fp_regs
#define si_pkey_offset 0x20
-#ifdef PKEY_DISABLE_ACCESS
#undef PKEY_DISABLE_ACCESS
-# define PKEY_DISABLE_ACCESS 0x3 /* disable read and write */
-#endif
+#define PKEY_DISABLE_ACCESS 0x3 /* disable read and write */
-#ifdef PKEY_DISABLE_WRITE
#undef PKEY_DISABLE_WRITE
-# define PKEY_DISABLE_WRITE 0x2
-#endif
+#define PKEY_DISABLE_WRITE 0x2
#define NR_PKEYS 32
#define NR_RESERVED_PKEYS_4K 27 /* pkey-0, pkey-1, exec-only-pkey
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
2020-05-08 17:49 [PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes Sandipan Das
2020-05-08 17:49 ` [PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions Sandipan Das
@ 2020-05-08 17:49 ` Sandipan Das
2020-05-08 18:01 ` Florian Weimer
1 sibling, 1 reply; 6+ messages in thread
From: Sandipan Das @ 2020-05-08 17:49 UTC (permalink / raw)
To: akpm
Cc: linux-mm, linux-kselftest, linuxppc-dev, linuxram, aneesh.kumar,
bauerman, mpe, fweimer
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.
Fixes: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support")
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
tools/testing/selftests/vm/pkey-powerpc.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h
index eb5077de8f1e..1ebb586b2fbc 100644
--- a/tools/testing/selftests/vm/pkey-powerpc.h
+++ b/tools/testing/selftests/vm/pkey-powerpc.h
@@ -55,7 +55,8 @@ static inline void __write_pkey_reg(u64 pkey_reg)
dprintf4("%s() changing %016llx to %016llx\n",
__func__, __read_pkey_reg(), pkey_reg);
- asm volatile("mtspr 0xd, %0" : : "r" ((unsigned long)(amr)) : "memory");
+ asm volatile("isync; mtspr 0xd, %0; isync"
+ : : "r" ((unsigned long)(amr)) : "memory");
dprintf4("%s() pkey register after changing %016llx to %016llx\n",
__func__, __read_pkey_reg(), pkey_reg);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
2020-05-08 17:49 ` [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates Sandipan Das
@ 2020-05-08 18:01 ` Florian Weimer
2020-05-08 19:54 ` Sandipan Das
0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2020-05-08 18:01 UTC (permalink / raw)
To: Sandipan Das
Cc: akpm, linux-mm, linux-kselftest, linuxppc-dev, linuxram,
aneesh.kumar, bauerman, mpe
* Sandipan Das:
> 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.
Ugh. Do you have a reference for that?
We need to fix this in glibc.
Thanks,
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
2020-05-08 18:01 ` Florian Weimer
@ 2020-05-08 19:54 ` Sandipan Das
2020-05-08 20:03 ` Florian Weimer
0 siblings, 1 reply; 6+ messages in thread
From: Sandipan Das @ 2020-05-08 19:54 UTC (permalink / raw)
To: Florian Weimer
Cc: akpm, linux-mm, linux-kselftest, linuxppc-dev, linuxram,
aneesh.kumar, bauerman, mpe
Hi Florian,
On 08/05/20 11:31 pm, Florian Weimer wrote:
> * Sandipan Das:
>
>> 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.
>
> Ugh. Do you have a reference for that?
>
> We need to fix this in glibc.
>
This 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
- Sandipan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
2020-05-08 19:54 ` Sandipan Das
@ 2020-05-08 20:03 ` Florian Weimer
0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2020-05-08 20:03 UTC (permalink / raw)
To: Sandipan Das
Cc: akpm, linux-mm, linux-kselftest, linuxppc-dev, linuxram,
aneesh.kumar, bauerman, mpe
* Sandipan Das:
> Hi Florian,
>
> On 08/05/20 11:31 pm, Florian Weimer wrote:
>> * Sandipan Das:
>>
>>> 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.
>>
>> Ugh. Do you have a reference for that?
>>
>> We need to fix this in glibc.
>>
>
> This 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
Thanks a lot! I filed:
<https://sourceware.org/bugzilla/show_bug.cgi?id=25954>
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-08 20:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 17:49 [PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes Sandipan Das
2020-05-08 17:49 ` [PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions Sandipan Das
2020-05-08 17:49 ` [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates Sandipan Das
2020-05-08 18:01 ` Florian Weimer
2020-05-08 19:54 ` Sandipan Das
2020-05-08 20:03 ` Florian Weimer
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).