Re: [PATCH v2 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-05-26 Thread Sandipan Das
gt; LGTM. Reviewed-by: Sandipan Das

[PATCH v2] powerpc/powernv/memtrace: Fix dcache flushing

2021-05-01 Thread Sandipan Das
Kumar K.V Signed-off-by: Sandipan Das --- Previous versions can be found at: v1: https://lore.kernel.org/linuxppc-dev/20210430075557.893819-1-sandi...@linux.ibm.com/ Changes in v2: - Added review tag from Aneesh. - Used pfn_to_kaddr() based on Christophe's suggestion. --- arch/powerpc/pl

Re: [PATCH] powerpc/powernv/memtrace: Fix dcache flushing

2021-05-01 Thread Sandipan Das
On 30/04/21 2:12 pm, Christophe Leroy wrote: > > > Le 30/04/2021 à 09:55, Sandipan Das a écrit : >> Trace memory is cleared and the corresponding dcache lines >> are flushed after allocation. However, this should not be >> done using the PFN. This adds th

[PATCH] powerpc/powernv/memtrace: Fix dcache flushing

2021-04-30 Thread Sandipan Das
Trace memory is cleared and the corresponding dcache lines are flushed after allocation. However, this should not be done using the PFN. This adds the missing __va() conversion. Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.") Signed-off-by: Sandipan Das

Re: [PATCH v4] powerpc/uprobes: Validation for prefixed instruction

2021-03-07 Thread Sandipan Das
ango...@linux.ibm.com > v3->v4: > - CONFIG_PPC64 check was not required, remove it. > - Use SZ_ macros instead of hardcoded numbers. > Acked-by: Sandipan Das

[PATCH v4 2/2] powerpc: sstep: Fix darn emulation

2021-02-04 Thread Sandipan Das
3987ef267a ("powerpc: sstep: Add support for darn instruction") Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 11f14b209d7f..683f7c20f74b 100644 --- a/arch

[PATCH v4 1/2] powerpc: sstep: Fix load-store and update emulation

2021-02-04 Thread Sandipan Das
em as unknown. The kernel can then fallback to executing such instructions on hardware. Fixes: 0016a4cf5582 ("powerpc: Emulate most Book I instructions in emulate_step()") Signed-off-by: Sandipan Das --- Previous versions can be found at: v3: https://lore.kernel.org/linuxppc-dev/202102

Re: [PATCH v3 1/2] powerpc: sstep: Fix load-store and update emulation

2021-02-03 Thread Sandipan Das
On 04/02/21 1:09 pm, Naveen N. Rao wrote: > [...] > > I'm afraid there is one more thing. scripts/checkpatch.pl reports: > > WARNING: 'an userspace' may be misspelled - perhaps 'a userspace'? > #52: > While an userspace program having an instruction word like > > > ERROR: swit

Re: [PATCH v3 1/2] powerpc: sstep: Fix load-store and update emulation

2021-02-03 Thread Sandipan Das
On 04/02/21 12:44 pm, Sandipan Das wrote: > The Power ISA says that the fixed-point load and update > instructions must neither use R0 for the base address (RA) > nor have the destination (RT) and the base address (RA) as > the same register. Similarly, for fixed-point stores an

[PATCH v3 2/2] powerpc: sstep: Fix darn emulation

2021-02-03 Thread Sandipan Das
3987ef267a ("powerpc: sstep: Add support for darn instruction") Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 9138967eb82e..e7e8bc974c0f 100644 --- a/arch

[PATCH v3 1/2] powerpc: sstep: Fix load-store and update emulation

2021-02-03 Thread Sandipan Das
em as unknown. The kernel can then fallback to executing such instructions on hardware. Fixes: 0016a4cf5582 ("powerpc: Emulate most Book I instructions in emulate_step()") Signed-off-by: Sandipan Das --- Previous versions can be found at: v2: https://lore.kernel.org/linuxppc-dev/202102

Re: [PATCH v2 1/3] powerpc: sstep: Fix load and update emulation

2021-02-03 Thread Sandipan Das
On 03/02/21 3:19 pm, Naveen N. Rao wrote: > [...] > > Wouldn't it be easier to just do the below at the end? Or, am I missing > something? > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > index ede093e9623472..a2d726d2a5e9d1 100644 > --- a/arch/powerpc/lib/sstep.c > +++ b

Re: [PATCH v2 1/3] powerpc: sstep: Fix load and update emulation

2021-02-03 Thread Sandipan Das
On 03/02/21 3:19 pm, Naveen N. Rao wrote: > [...] > > Wouldn't it be easier to just do the below at the end? Or, am I missing > something? > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > index ede093e9623472..a2d726d2a5e9d1 100644 > --- a/arch/powerpc/lib/sstep.c > +++ b/a

[PATCH v2 3/3] powerpc: sstep: Fix darn emulation

2021-02-02 Thread Sandipan Das
3987ef267a ("powerpc: sstep: Add support for darn instruction") Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 230d1ae77ef5..9ea6822f4c55 100644 --- a/arch

[PATCH v2 2/3] powerpc: sstep: Fix store and update emulation

2021-02-02 Thread Sandipan Das
d-by: Ravi Bangoria Signed-off-by: Sandipan Das --- Previous versions can be found at: v1: https://lore.kernel.org/linuxppc-dev/20201119054139.244083-2-sandi...@linux.ibm.com/ Changes in v2: - Jump to unknown_opcode instead of returning -1 for invalid instruction forms. --- arch/powerpc/lib/ss

[PATCH v2 1/3] powerpc: sstep: Fix load and update emulation

2021-02-02 Thread Sandipan Das
ated as unknown by the emulation infrastructure when RA = 0 or RA = RT. The kernel will then fallback to executing the instruction on hardware. Fixes: 0016a4cf5582 ("powerpc: Emulate most Book I instructions in emulate_step()") Reviewed-by: Ravi Bangoria Signed-off-by: Sandipan Das ---

[PATCH] powerpc/pkeys: Remove unused code

2021-02-02 Thread Sandipan Das
et userspace AMR correctly on exec") commit 48a8ab4eeb82 ("powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode") Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/mmu_context.h | 3 --- arch/powerpc/include/asm/pkeys.h | 6 -- 2 files changed

Re: [PATCH] lib/sstep: Fix incorrect return from analyze_instr()

2021-01-21 Thread Sandipan Das
9 > +- > 1 file changed, 27 insertions(+), 22 deletions(-) > Thanks for fixing this. Reviewed-by: Sandipan Das

Re: [PATCH v3] [PATCH] powerpc/sstep: Check ISA 3.0 instruction validity before emulation

2021-01-20 Thread Sandipan Das
s on scv and addpcis > [v2] Fixed description > > arch/powerpc/lib/sstep.c | 46 > -- > 1 file changed, 44 insertions(+), 2 deletions(-) > Reviewed-by: Sandipan Das

[PATCH] selftests/powerpc: Fix exit status of pkey tests

2021-01-18 Thread Sandipan Das
tests/powerpc: Add test for execute-disabled pkeys") Fixes: c27f2fd1705a ("selftests/powerpc: Add test for pkey siginfo verification") Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/pkey_exec_prot.c | 2 +- tools/testing/selftests/powerpc/mm/pkey_siginfo.c | 2

Re: [PATCH 1/2] powerpc: sstep: Fix load and update instructions

2020-11-26 Thread Sandipan Das
Hi, On 25/11/20 3:39 pm, Ravi Bangoria wrote: > >> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c >> index 855457ed09b5..25a5436be6c6 100644 >> --- a/arch/powerpc/lib/sstep.c >> +++ b/arch/powerpc/lib/sstep.c >> @@ -2157,11 +2157,15 @@ int analyse_instr(struct instruction_op *op

[PATCH 1/2] powerpc: sstep: Fix load and update instructions

2020-11-18 Thread Sandipan Das
ated as unknown by the emulation infrastructure when RA = 0 or RA = RT. The kernel will then fallback to executing the instruction on hardware. Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/powerpc/lib

[PATCH 2/2] powerpc: sstep: Fix store and update instructions

2020-11-18 Thread Sandipan Das
aforementioned instructions to make sure that they are treated as unknown by the emulation infrastructure when RA = 0. The kernel will then fallback to executing the instruction on hardware. Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 16 1 file changed, 16

Re: [PATCH v5 21/23] powerpc/book3s64/hash/kuep: Enable KUEP on hash

2020-10-17 Thread Sandipan Das
On 27/08/20 9:39 am, Aneesh Kumar K.V wrote: > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/mm/book3s64/pkeys.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 20/23] powerpc/book3s64/hash/kuap: Enable kuap on hash

2020-10-17 Thread Sandipan Das
On 27/08/20 9:39 am, Aneesh Kumar K.V wrote: > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/mm/book3s64/pkeys.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 19/23] powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.

2020-10-17 Thread Sandipan Das
On 27/08/20 9:39 am, Aneesh Kumar K.V wrote: > Radix use IAMR Key 0 and hash translation use IAMR key 3. > > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/kup.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 18/23] powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.

2020-10-17 Thread Sandipan Das
On 27/08/20 9:39 am, Aneesh Kumar K.V wrote: > Radix use AMR Key 0 and hash translation use AMR key 3. > > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/kup.h | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 16/23] powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR

2020-10-17 Thread Sandipan Das
chieve the same. > > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/kup.h | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 15/23] powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.

2020-10-17 Thread Sandipan Das
, 61 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 12/23] powerpc/book3s64/pkeys: Inherit correctly on fork.

2020-10-17 Thread Sandipan Das
-by: Aneesh Kumar K.V > --- > arch/powerpc/kernel/process.c | 9 + > 1 file changed, 9 insertions(+) > Reviewed-by: Sandipan Das

Re: [PATCH v5 13/23] powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec

2020-10-17 Thread Sandipan Das
off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/pkeys.h | 2 ++ > arch/powerpc/kernel/process.c | 6 +- > arch/powerpc/mm/book3s64/pkeys.c | 16 ++-- > 3 files changed, 9 insertions(+), 15 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 11/23] powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel

2020-10-17 Thread Sandipan Das
powerpc/kernel/asm-offsets.c| 2 + > arch/powerpc/kernel/entry_64.S | 6 +- > arch/powerpc/kernel/exceptions-64s.S | 4 +- > arch/powerpc/kernel/syscall_64.c | 30 +++- > 6 files changed, 192 insertions(+), 31 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 09/23] powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation

2020-10-17 Thread Sandipan Das
bpage.c | 2 +- > arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- > arch/powerpc/mm/book3s64/hash_utils.c | 10 > arch/powerpc/mm/book3s64/pkeys.c | 4 > 11 files changed, 37 insertions(+), 18 deletions(-) > Reviewed-by: Sandipan Das

Re: [PATCH v5 1/5] powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set

2020-10-11 Thread Sandipan Das
return -1; > + > prefix_r = GET_PREFIX_R(word); > ra = GET_PREFIX_RA(suffix); > op->update_reg = ra; > LGTM Reviewed-by: Sandipan Das

[PATCH v4] selftests/powerpc: Fix pkey syscall redefinitions

2020-08-04 Thread Sandipan Das
ned-off-by: Sandipan Das --- Previous versions can be found at: v3: https://lore.kernel.org/linuxppc-dev/1bb744b0c7ed3985a5b73289f4de629ac0aeaf7c.1596453627.git.sandi...@linux.ibm.com/ v2: https://lore.kernel.org/linuxppc-dev/566dde119ce71f00f9642807ba30ceb7f54c9bfa.1596441105.git.sandi...@linux.i

Re: [merge] Build failure selftest/powerpc/mm/pkey_exec_prot

2020-08-04 Thread Sandipan Das
On 04/08/20 5:53 pm, Michael Ellerman wrote: > Sandipan Das writes: >> On 04/08/20 6:38 am, Michael Ellerman wrote: >>> Sandipan Das writes: >>>> On 03/08/20 4:32 pm, Michael Ellerman wrote: >>>>> Sachin Sant writes: >>>>>

Re: [merge] Build failure selftest/powerpc/mm/pkey_exec_prot

2020-08-03 Thread Sandipan Das
Hi Michael, On 04/08/20 6:38 am, Michael Ellerman wrote: > Sandipan Das writes: >> On 03/08/20 4:32 pm, Michael Ellerman wrote: >>> Sachin Sant writes: >>>>> On 02-Aug-2020, at 10:58 PM, Sandipan Das wrote: >>>>> On 02/08/20 4:45 pm, Sachin Sant

Re: [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions

2020-08-03 Thread Sandipan Das
On 03/08/20 4:34 pm, Michael Ellerman wrote: > Sandipan Das writes: >> On some distros, there are conflicts w.r.t to redefinition >> of pkey syscall numbers which cause build failures. This >> fixes them. >> >> Reported-by: Sachin Sant >> Signed-o

Re: [merge] Build failure selftest/powerpc/mm/pkey_exec_prot

2020-08-03 Thread Sandipan Das
Hi Michael, On 03/08/20 4:32 pm, Michael Ellerman wrote: > Sachin Sant writes: >>> On 02-Aug-2020, at 10:58 PM, Sandipan Das wrote: >>> On 02/08/20 4:45 pm, Sachin Sant wrote: >>>> pkey_exec_prot test from linuxppc merge branch (3f68564f1f5a) fails to

[PATCH v3] selftests/powerpc: Fix pkey syscall redefinitions

2020-08-03 Thread Sandipan Das
On some distros, there are conflicts w.r.t to redefinition of pkey syscall numbers which cause build failures. This fixes them. Reported-by: Sachin Sant Signed-off-by: Sandipan Das --- Previous versions can be found at: v2: https://lore.kernel.org/linuxppc-dev

[PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions

2020-08-03 Thread Sandipan Das
On some distros, there are conflicts w.r.t to redefinition of pkey syscall numbers which cause build failures. This fixes them. Reported-by: Sachin Sant Signed-off-by: Sandipan Das --- Previous versions can be found at: v1: https://lore.kernel.org/linuxppc-dev/20200803074043.466809-1-sandi

[PATCH] selftests/powerpc: Fix pkey syscall redefinitions

2020-08-03 Thread Sandipan Das
CALL(__NR_pkey_alloc, sys_pkey_alloc) /usr/include/asm-generic/unistd.h:732:__SYSCALL(__NR_pkey_free, sys_pkey_free) Reported-by: Sachin Sant Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/include/pkeys.h | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/testi

Re: [merge] Build failure selftest/powerpc/mm/pkey_exec_prot

2020-08-02 Thread Sandipan Das
Hi Sachin, On 02/08/20 4:45 pm, Sachin Sant wrote: > pkey_exec_prot test from linuxppc merge branch (3f68564f1f5a) fails to > build due to following error: > > gcc -std=gnu99 -O2 -Wall -Werror > -DGIT_VERSION='"v5.8-rc7-1276-g3f68564f1f5a"' > -I/home/sachin/linux/tools/testing/selftests/powerpc

[PATCH v3] selftests: powerpc: Fix online CPU selection

2020-07-29 Thread Sandipan Das
CPUs as reported by get_nprocs_conf(). Fixes: 3752e453f6ba ("selftests/powerpc: Add tests of PMU EBBs") Reported-by: Shirisha Ganta Signed-off-by: Sandipan Das Reviewed-by: Kamalesh Babulal --- Previous versions can be found at: v2: https://lore.kernel.org/linuxppc-dev/2020060907373

Re: [PATCH v2] selftests: powerpc: Fix online CPU selection

2020-07-29 Thread Sandipan Das
Hi Srikar, Michael, On 29/07/20 9:33 pm, Srikar Dronamraju wrote: > * Sandipan Das [2020-06-09 13:07:33]: > >> The size of the CPU affinity mask must be large enough for >> systems with a very large number of CPUs. Otherwise, tests >> which try to determine the fir

[PATCH v2 6/6] selftests/powerpc: Add test for pkey siginfo verification

2020-07-26 Thread Sandipan Das
the other restrictive, attempt to protect a common page at the same time. This adds a test to detect the bug. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/.gitignore | 1 + tools/testing/selftests/powerpc/mm/Makefile | 5 +- .../selftests/powerpc/mm/pkey_siginfo.c

[PATCH v2 4/6] selftests/powerpc: Add helper to exit on failure

2020-07-26 Thread Sandipan Das
This adds a helper similar to FAIL_IF() which lets a program exit with code 1 (to indicate failure) when the given condition is true. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/include/utils.h | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/testing

[PATCH v2 3/6] selftests/powerpc: Harden test for execute-disabled pkeys

2020-07-26 Thread Sandipan Das
check the behaviour of pkeys with read, write but no execute rights and all the rights, in favour of checking all the possible combinations of read, write and execute rights to be able to detect bugs like the one mentioned above. Signed-off-by: Sandipan Das --- .../selftests/powerpc/mm/pkey_exec_prot.

[PATCH v2 5/6] selftests/powerpc: Add wrapper for gettid

2020-07-26 Thread Sandipan Das
The gettid() syscall wrapper was first introduced in glibc 2.30. This adds a wrapper for use in distros running older versions. Suggested-by: Christophe Leroy Suggested-by: Michael Ellerman Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/include/utils.h | 10 ++ 1 file

[PATCH v2 2/6] selftests/powerpc: Add pkey helpers for rights

2020-07-26 Thread Sandipan Das
This adds some new pkey-related helper to print access rights of a pkey in the "rwx" format and to generate different valid combinations of pkey rights starting from a given combination. Signed-off-by: Sandipan Das --- .../testing/selftests/powerpc/include/pk

[PATCH v2 1/6] selftests/powerpc: Move pkey helpers to headers

2020-07-26 Thread Sandipan Das
This moves all the pkey-related helpers to a new header file and also a helper to print error messages in signal handlers to the existing utils header file. Signed-off-by: Sandipan Das --- .../testing/selftests/powerpc/include/pkeys.h | 108 ++ .../testing/selftests/powerpc

[PATCH v2 0/6] Improvements to pkey tests

2020-07-26 Thread Sandipan Das
/linuxppc-dev/cover.1594897099.git.sandi...@linux.ibm.com/ Changes in v2: - Added a wrapper for the gettid syscall based on suggestions from Michael and Christophe. Sandipan Das (6): selftests/powerpc: Move pkey helpers to headers selftests/powerpc: Add pkey helpers for rights selftests/powerpc

Re: [PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification

2020-07-26 Thread Sandipan Das
On 27/07/20 5:22 am, Michael Ellerman wrote: > Christophe Leroy writes: >> Michael Ellerman a écrit : >>> Sandipan Das writes: >>>> diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>>> b/tools/testing/selftests/powerpc/mm/pkey_sigi

[PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification

2020-07-16 Thread Sandipan Das
the other restrictive, attempt to protect a common page at the same time. This adds a test to detect the bug. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/.gitignore | 1 + tools/testing/selftests/powerpc/mm/Makefile | 5 +- .../selftests/powerpc/mm/pkey_siginfo.c

[PATCH 4/5] selftests/powerpc: Add helper to exit on failure

2020-07-16 Thread Sandipan Das
This adds a helper similar to FAIL_IF() which lets a program exit with code 1 (to indicate failure) when the given condition is true. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/include/utils.h | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/testing

[PATCH 3/5] selftests/powerpc: Harden test for execute-disabled pkeys

2020-07-16 Thread Sandipan Das
check the behaviour of pkeys with read, write but no execute rights and all the rights, in favour of checking all the possible combinations of read, write and execute rights to be able to detect bugs like the one mentioned above. Signed-off-by: Sandipan Das --- .../selftests/powerpc/mm/pkey_exec_prot.

[PATCH 2/5] selftests/powerpc: Add pkey helpers for rights

2020-07-16 Thread Sandipan Das
This adds some new pkey-related helper to print access rights of a pkey in the "rwx" format and to generate different valid combinations of pkey rights starting from a given combination. Signed-off-by: Sandipan Das --- .../testing/selftests/powerpc/include/pk

[PATCH 1/5] selftests/powerpc: Move pkey helpers to headers

2020-07-16 Thread Sandipan Das
This moves all the pkey-related helpers to a new header file and also a helper to print error messages in signal handlers to the existing utils header file. Signed-off-by: Sandipan Das --- .../testing/selftests/powerpc/include/pkeys.h | 108 ++ .../testing/selftests/powerpc

[PATCH 0/5] Improvements to pkey tests

2020-07-16 Thread Sandipan Das
Based on recent bugs found in the pkey infrastructure, this improves the test for execute-disabled pkeys and adds a new test for detecting inconsistencies with the pkey reported by the signal information upon getting a fault. Sandipan Das (5): selftests/powerpc: Move pkey helpers to headers

Re: [PATCH 3/6] powerpc test_emulate_step: enhancement to test negative scenarios

2020-06-22 Thread Sandipan Das
Hi Bala, On 22/06/20 12:39 pm, Balamuruhan S wrote: > add provision to declare test is a negative scenario, verify > whether emulation fails and avoid executing it. > > Signed-off-by: Balamuruhan S > --- > arch/powerpc/lib/test_emulate_step.c | 46 ++-- > 1 file changed,

Re: [PATCH 2/6] powerpc/ppc-opcode: move ppc instruction encoding from test_emulate_step

2020-06-09 Thread Sandipan Das
e/asm/ppc-opcode.h | 35 ++ > arch/powerpc/lib/test_emulate_step.c | 155 ++ > 2 files changed, 91 insertions(+), 99 deletions(-) > [...] > Acked-by: Sandipan Das

Re: [PATCH 4/6] powerpc/ppc-opcode: consolidate powerpc instructions from bpf_jit.h

2020-06-09 Thread Sandipan Das
- > arch/powerpc/net/bpf_jit_comp.c | 132 ++-- > arch/powerpc/net/bpf_jit_comp64.c | 278 +- > 6 files changed, 378 insertions(+), 373 deletions(-) > [...] > Acked-by: Sandipan Das

Re: [PATCH 3/6] powerpc/bpf_jit: reuse instruction macros from ppc-opcode.h

2020-06-09 Thread Sandipan Das
et/bpf_jit.h| 18 +- > arch/powerpc/net/bpf_jit32.h | 10 +- > arch/powerpc/net/bpf_jit64.h | 4 ++-- > arch/powerpc/net/bpf_jit_comp.c | 2 +- > arch/powerpc/net/bpf_jit_comp64.c | 20 ++-- > 5 files changed, 19 insertions(+), 35 deletions(-) > [...] > Acked-by: Sandipan Das

[PATCH v2] selftests: powerpc: Fix online CPU selection

2020-06-09 Thread Sandipan Das
CPUs as reported by get_nprocs(). Fixes: 3752e453f6ba ("selftests/powerpc: Add tests of PMU EBBs") Reported-by: Shirisha Ganta Signed-off-by: Sandipan Das Reviewed-by: Kamalesh Babulal --- Previous versions can be found at: v1: https://lore.kernel.org/linuxppc-dev/20200608144212.9851

Re: [PATCH] selftests: powerpc: Fix online CPU selection

2020-06-09 Thread Sandipan Das
On 08/06/20 8:12 pm, Sandipan Das wrote: > The size of the cpu set must be large enough for systems > with a very large number of CPUs. Otherwise, tests which > try to determine the first online CPU by calling > sched_getaffinity() will fail. This makes sure that the > size of th

Re: [PATCH] selftests: powerpc: Fix online CPU selection

2020-06-09 Thread Sandipan Das
On 08/06/20 8:12 pm, Sandipan Das wrote: > The size of the cpu set must be large enough for systems > with a very large number of CPUs. Otherwise, tests which > try to determine the first online CPU by calling > sched_getaffinity() will fail. This makes sure that the > size of th

[PATCH] selftests: powerpc: Fix online CPU selection

2020-06-08 Thread Sandipan Das
get_nprocs(). Fixes: 3752e453f6ba ("selftests/powerpc: Add tests of PMU EBBs") Reported-by: Shirisha Ganta Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/utils.c | 33 - 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/too

[PATCH v3 1/3] selftests: powerpc: Fix pkey access right updates

2020-06-04 Thread 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 makes sure that the tests follow this requirement when attempting to update a pkey's access rights. Signed-off-by: Sandipa

[PATCH v3 3/3] selftests: powerpc: Add test for execute-disabled pkeys

2020-06-04 Thread Sandipan Das
Apart from read and write access, memory protection keys can also be used for restricting execute permission of pages on powerpc. This adds a test to verify if the feature works as expected. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/.gitignore | 1 + tools/testing

[PATCH v3 2/3] selftests: powerpc: Move Hash MMU check to utilities

2020-06-04 Thread Sandipan Das
This moves a function to test if the MMU is in Hash mode under the generic test utilities. Signed-off-by: Sandipan Das --- .../testing/selftests/powerpc/include/utils.h | 1 + tools/testing/selftests/powerpc/mm/Makefile | 2 +- .../selftests/powerpc/mm/bad_accesses.c | 28

[PATCH v3 0/3] selftests: powerpc: Fixes and execute-disable test for pkeys

2020-06-04 Thread Sandipan Das
v2: - Added .gitignore entry for test binary. - Fixed builds for older distros where siginfo_t might not have si_pkey as a formal member based on discussion with Michael. Sandipan Das (3): selftests: powerpc: Fix pkey access right updates selftests: powerpc: Move Hash MMU check to utilities

Re: [PATCH v2] selftests: powerpc: Add test for execute-disabled pkeys

2020-05-31 Thread Sandipan Das
Hi Michael, On 01/06/20 7:29 am, Sandipan Das wrote: > Hi Michael, > > Thanks for your suggestions. I had a few questions regarding some > of them. > > On 29/05/20 7:18 am, Michael Ellerman wrote: >>> [...] >>> + >>> +static void pkeyreg_set(un

Re: [PATCH v2] selftests: powerpc: Add test for execute-disabled pkeys

2020-05-31 Thread Sandipan Das
Hi Michael, Thanks for your suggestions. I had a few questions regarding some of them. On 29/05/20 7:18 am, Michael Ellerman wrote: >> [...] >> + >> +static void pkeyreg_set(unsigned long uamr) >> +{ >> +asm volatile("isync; mtspr 0xd, %0; isync;" : : "r"(uamr)); >> +} > > You can use m

[PATCH v2] selftests: powerpc: Add test for execute-disabled pkeys

2020-05-26 Thread Sandipan Das
Apart from read and write access, memory protection keys can also be used for restricting execute permission of pages on powerpc. This adds a test to verify if the feature works as expected. Signed-off-by: Sandipan Das --- Previous versions can be found at v1: https://lore.kernel.org/linuxppc

Re: [PATCH] selftests: powerpc: Add test for execute-disabled pkeys

2020-05-26 Thread Sandipan Das
Hi Michael, On 26/05/20 6:05 pm, Michael Ellerman wrote: > [...] >> + >> +/* Override definitions as they might be inconsistent */ >> +#undef PKEY_DISABLE_ACCESS >> +#define PKEY_DISABLE_ACCESS 0x3 > > Why would they be inconsistent? > The definition in sys/mman.h still uses the value specific

Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates

2020-05-08 Thread 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 >> appl

[PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates

2020-05-08 Thread Sandipan Das
pkeys: introduce powerpc support") Reported-by: Aneesh Kumar K.V Suggested-by: Aneesh Kumar K.V Signed-off-by: Sandipan Das --- 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/too

[PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions

2020-05-08 Thread Sandipan Das
: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support") Reported-by: Aneesh Kumar K.V Signed-off-by: Sandipan Das --- 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/too

[PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes

2020-05-08 Thread Sandipan Das
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

[PATCH] selftests: powerpc: Add test for execute-disabled pkeys

2020-05-08 Thread Sandipan Das
Apart from read and write access, memory protection keys can also be used for restricting execute permission of pages on powerpc. This adds a test to verify if the feature works as expected. Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/Makefile | 3 +- .../selftests

Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code

2020-04-27 Thread Sandipan Das
Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > On 4/27/20 10:25 AM, Mike Kravetz wrote: >> On 4/26/20 10:04 PM, Sandipan Das wrote: >>> On 18/04/20 12:20 am, Mike Kravetz wrote: >>>> Now that architectures provide arch_hugetlb_valid_size(), parsing >&g

Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code

2020-04-26 Thread Sandipan Das
Hi Mike, On 18/04/20 12:20 am, Mike Kravetz wrote: > Now that architectures provide arch_hugetlb_valid_size(), parsing > of "hugepagesz=" can be done in architecture independent code. > Create a single routine to handle hugepagesz= parsing and remove > all arch specific routines. We can also remo

[PATCH v19 24/24] selftests: vm: pkeys: Fix multilib builds for x86

2020-03-31 Thread Sandipan Das
This ensures that both 32-bit and 64-bit binaries are generated when this is built on a x86_64 system. Most of the changes have been borrowed from tools/testing/selftests/x86/Makefile. Signed-off-by: Sandipan Das Acked-by: Dave Hansen Tested-by: Dave Hansen --- tools/testing/selftests/vm

[PATCH v19 23/24] selftests: vm: pkeys: Use the correct page size on powerpc

2020-03-31 Thread Sandipan Das
function alignment on page size. Since this can only be done at build time, 64K is used as the alignment factor as that also ensures 4K alignment. Signed-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/pkey-powerpc.h| 2 +- tools/testing/selftests/vm/protection_keys.c | 5

[PATCH v19 22/24] selftests/vm/pkeys: Override access right definitions on powerpc

2020-03-31 Thread Sandipan Das
: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/pkey-powerpc.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h index d31665c48f5ed..02bd4dd7d467a 100644 --- a/tools

[PATCH v19 21/24] selftests/vm/pkeys: Test correct behaviour of pkey-0

2020-03-31 Thread Sandipan Das
From: Ram Pai Ensure that pkey-0 is allocated on start and that it can be attached dynamically in various modes, without failures. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/protection_keys.c

[PATCH v19 20/24] selftests/vm/pkeys: Introduce a sub-page allocator

2020-03-31 Thread Sandipan Das
From: Ram Pai This introduces a new allocator that allocates 4K hardware pages to back 64K linux pages. This allocator is available only on powerpc. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Signed-off-by: Sandipan Das Acked-by: Dave

[PATCH v19 19/24] selftests/vm/pkeys: Detect write violation on a mapped access-denied-key page

2020-03-31 Thread Sandipan Das
From: Ram Pai Detect write-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 13

[PATCH v19 18/24] selftests/vm/pkeys: Associate key on a mapped page and detect write violation

2020-03-31 Thread Sandipan Das
From: Ram Pai Detect write-violation on a page to which write-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 12

[PATCH v19 17/24] selftests/vm/pkeys: Associate key on a mapped page and detect access violation

2020-03-31 Thread Sandipan Das
From: Ram Pai Detect access-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 19

[PATCH v19 16/24] selftests/vm/pkeys: Improve checks to determine pkey support

2020-03-31 Thread Sandipan Das
From: Ram Pai For the pkeys subsystem to work, both the CPU and the kernel need to have support. So, additionally check if the kernel supports pkeys apart from the CPU feature checks. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das Acked-by: Dave Hansen

[PATCH v19 15/24] selftests/vm/pkeys: Fix assertion in test_pkey_alloc_exhaust()

2020-03-31 Thread Sandipan Das
-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/protection_keys.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index e6de078a9196f

[PATCH v19 14/24] selftests/vm/pkeys: Fix number of reserved powerpc pkeys

2020-03-31 Thread Sandipan Das
From: "Desnes A. Nunes do Rosario" The number of reserved pkeys in a PowerNV environment is different from that on PowerVM or KVM. Tested on PowerVM and PowerNV environments. Signed-off-by: "Desnes A. Nunes do Rosario" Signed-off-by: Ram Pai Signed-off-by: Sandipan Das A

[PATCH v19 13/24] selftests/vm/pkeys: Introduce powerpc support

2020-03-31 Thread Sandipan Das
(), all of its dependencies and other similar functions have been moved ahead of the signal handler. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/pkey-helpers.h| 2 + tools/testing/selftests/vm

[PATCH v19 12/24] selftests/vm/pkeys: Introduce generic pkey abstractions

2020-03-31 Thread Sandipan Das
From: Ram Pai This introduces some generic abstractions and provides the corresponding architecture-specfic implementations for these abstractions. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Signed-off-by: Sandipan Das Acked-by: Dave

[PATCH v19 10/24] selftests/vm/pkeys: Fix alloc_random_pkey() to make it really random

2020-03-31 Thread Sandipan Das
From: Ram Pai alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. This fixes it. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 3

[PATCH v19 11/24] selftests: vm: pkeys: Use the correct huge page size

2020-03-31 Thread Sandipan Das
The huge page size can vary across architectures. This will ensure that the correct huge page size is used when accessing the hugetlb controls under sysfs. Instead of using a hardcoded page size (i.e. 2MB), this now uses the HPAGE_SIZE macro which is arch-specific. Signed-off-by: Sandipan Das

[PATCH v19 09/24] selftests/vm/pkeys: Fix assertion in pkey_disable_set/clear()

2020-03-31 Thread Sandipan Das
Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/selftests/vm/protection_keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protecti

[PATCH v19 08/24] selftests/vm/pkeys: Fix pkey_disable_clear()

2020-03-31 Thread Sandipan Das
-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index bed9d4de12b48..4b1ddb526228d 100644 --- a/tools/testing

[PATCH v19 07/24] selftests: vm: pkeys: Add helpers for pkey bits

2020-03-31 Thread Sandipan Das
This introduces some functions that help with setting or clearing bits of a particular pkey. This also adds an abstraction for getting a pkey's bit position in the pkey register as this may vary across architectures. Signed-off-by: Sandipan Das Acked-by: Dave Hansen --- tools/testing/self

  1   2   3   4   >