[PATCH] powerpc: Use common STABS_DEBUG and DWARF_DEBUG and ELF_DETAILS macro

2020-11-26 Thread Youling Tang
Use the common STABS_DEBUG and DWARF_DEBUG and ELF_DETAILS macro rule for the linker script in an effort. Signed-off-by: Youling Tang --- arch/powerpc/kernel/vdso32/vdso32.lds.S | 42 - arch/powerpc/kernel/vdso64/vdso64.lds.S | 42

[PATCH] powerpc/numa: Fix a regression on memoryless node 0

2020-11-26 Thread Srikar Dronamraju
Commit e75130f20b1f ("powerpc/numa: Offline memoryless cpuless node 0") offlines node 0 and expects nodes to be subsequently onlined when CPUs or nodes are detected. Commit 6398eaa26816 ("powerpc/numa: Prefer node id queried from vphn") skips onlining node 0 when CPUs are associated with node 0.

[PATCH v7 17/22] powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.

2020-11-26 Thread Aneesh Kumar K.V
Radix use AMR Key 0 and hash translation use AMR key 3. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h

[PATCH v7 22/22] powerpc/book3s64/pkeys: Optimize KUAP and KUEP feature disabled case

2020-11-26 Thread Aneesh Kumar K.V
If FTR_BOOK3S_KUAP is disabled, kernel will continue to run with the same AMR value with which it was entered. Hence there is a high chance that we can return without restoring the AMR value. This also helps the case when applications are not using the pkey feature. In this case, different

[PATCH v7 21/22] powerpc/book3s64/hash/kup: Don't hardcode kup key

2020-11-26 Thread Aneesh Kumar K.V
Make KUAP/KUEP key a variable and also check whether the platform limit the max key such that we can't use the key for KUAP/KEUP. Signed-off-by: Aneesh Kumar K.V --- .../powerpc/include/asm/book3s/64/hash-pkey.h | 23 +-- arch/powerpc/include/asm/book3s/64/pkeys.h| 1 +

[PATCH v7 20/22] powerpc/book3s64/hash/kuep: Enable KUEP on hash

2020-11-26 Thread Aneesh Kumar K.V
Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index 9f01c86d2beb..4a3aeddbe0c7 100644 ---

[PATCH v7 19/22] powerpc/book3s64/hash/kuap: Enable kuap on hash

2020-11-26 Thread Aneesh Kumar K.V
Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index 8d1bf2f18ca4..9f01c86d2beb 100644 ---

[PATCH v7 18/22] powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.

2020-11-26 Thread Aneesh Kumar K.V
Radix use IAMR Key 0 and hash translation use IAMR key 3. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h

[PATCH v7 16/22] powerpc/book3s64/kuap: Improve error reporting with KUAP

2020-11-26 Thread Aneesh Kumar K.V
With hash translation use DSISR_KEYFAULT to identify a wrong access. With Radix we look at the AMR value and type of fault. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/32/kup.h | 4 +-- arch/powerpc/include/asm/book3s/64/kup.h | 27

[PATCH v7 15/22] powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR

2020-11-26 Thread Aneesh Kumar K.V
If an application has configured address protection such that read/write is denied using pkey even the kernel should receive a FAULT on accessing the same. This patch use user AMR value stored in pt_regs.amr to achieve the same. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V ---

[PATCH v7 13/22] powerpc/ptrace-view: Use pt_regs values instead of thread_struct based one.

2020-11-26 Thread Aneesh Kumar K.V
We will remove thread.amr/iamr/uamor in a later patch Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/ptrace/ptrace-view.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c

[PATCH v7 14/22] powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.

2020-11-26 Thread Aneesh Kumar K.V
Now that kernel correctly store/restore userspace AMR/IAMR values, avoid manipulating AMR and IAMR from the kernel on behalf of userspace. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 21 + arch/powerpc/include/asm/processor.h

[PATCH v7 12/22] powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec

2020-11-26 Thread Aneesh Kumar K.V
On fork, we inherit from the parent and on exec, we should switch to default_amr values. Also, avoid changing the AMR register value within the kernel. The kernel now runs with different AMR values. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V ---

[PATCH v7 11/22] powerpc/book3s64/pkeys: Inherit correctly on fork.

2020-11-26 Thread Aneesh Kumar K.V
Child thread.kuap value is inherited from the parent in copy_thread_tls. We still need to make sure when the child returns from a fork in the kernel we start with the kernel default AMR value. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/process.c | 10

[PATCH v7 10/22] powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel

2020-11-26 Thread Aneesh Kumar K.V
This prepare kernel to operate with a different value than userspace AMR/IAMR. For this, AMR/IAMR need to be saved and restored on entry and return from the kernel. With KUAP we modify kernel AMR when accessing user address from the kernel via copy_to/from_user interfaces. We don't need to modify

[PATCH v7 09/22] powerpc/exec: Set thread.regs early during exec

2020-11-26 Thread Aneesh Kumar K.V
In later patches during exec, we would like to access default regs.amr to control access to the user mapping. Having thread.regs set early makes the code changes simpler. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/thread_info.h | 2 -- arch/powerpc/kernel/process.c |

[PATCH v7 08/22] powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation

2020-11-26 Thread Aneesh Kumar K.V
This patch updates kernel hash page table entries to use storage key 3 for its mapping. This implies all kernel access will now use key 3 to control READ/WRITE. The patch also prevents the allocation of key 3 from userspace and UAMOR value is updated such that userspace cannot modify key 3.

[PATCH v7 07/22] powerpc/book3s64/kuap: Rename MMU_FTR_RADIX_KUAP and MMU_FTR_KUEP

2020-11-26 Thread Aneesh Kumar K.V
This is in preparation to adding support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Also move the feature bit closer to MMU_FTR_KUEP. MMU_FTR_KUEP is renamed to MMU_FTR_BOOK3S_KUEP to indicate the feature is only relevant to

[PATCH v7 06/22] powerpc/book3s64/kuep: Move KUEP related function outside radix

2020-11-26 Thread Aneesh Kumar K.V
The next set of patches adds support for kuep with hash translation. In preparation for that rename/move kuap related functions to non radix names. Also set MMU_FTR_KUEP and add the missing isync(). Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 1 +

[PATCH v7 05/22] powerpc/book3s64/kuap: Move KUAP related function outside radix

2020-11-26 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Signed-off-by: Aneesh Kumar K.V --- .../asm/book3s/64/{kup-radix.h => kup.h} | 6 ++--- arch/powerpc/include/asm/kup.h| 4

[PATCH v7 03/22] powerpc/book3s64/kuap/kuep: Add PPC_PKEY config on book3s64

2020-11-26 Thread Aneesh Kumar K.V
The config CONFIG_PPC_PKEY is used to select the base support that is required for PPC_MEM_KEYS, KUAP, and KUEP. Adding this dependency reduces the code complexity(in terms of #ifdefs) and enables us to move some of the initialization code to pkeys.c Signed-off-by: Aneesh Kumar K.V ---

[PATCH v7 04/22] powerpc/book3s64/kuap/kuep: Move uamor setup to pkey init

2020-11-26 Thread Aneesh Kumar K.V
This patch consolidates UAMOR update across pkey, kuap and kuep features. The boot cpu initialize UAMOR via pkey init and both radix/hash do the secondary cpu UAMOR init in early_init_mmu_secondary. We don't check for mmu_feature in radix secondary init because UAMOR is a supported SPRN with all

[PATCH v7 02/22] KVM: PPC: BOOK3S: PR: Ignore UAMOR SPR

2020-11-26 Thread Aneesh Kumar K.V
With power7 and above we expect the cpu to support keys. The number of keys are firmware controlled based on device tree. PR KVM do not expose key details via device tree. Hence when running with PR KVM we do run with MMU_FTR_KEY support disabled. But we can still get updates on UAMOR. Hence

[PATCH v7 00/22] Kernel userspace access/execution prevention with hash translation

2020-11-26 Thread Aneesh Kumar K.V
This patch series implements KUAP and KUEP with hash translation mode using memory keys. The kernel now uses memory protection key 3 to control access to the kernel. Kernel page table entries are now configured with key 3. Access to locations configured with any other key value is denied when in

[PATCH v7 01/22] powerpc: Add new macro to handle NESTED_IFCLR

2020-11-26 Thread Aneesh Kumar K.V
This will be used by the following patches Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/feature-fixups.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h index fbd406cd6916..5cdba929a8ae

[PATCH] powerpc: Allow relative pointers in bug table entries

2020-11-26 Thread Jordan Niethe
This enables GENERIC_BUG_RELATIVE_POINTERS on Power so that 32-bit offsets are stored in the bug entries rather than 64-bit pointers. Signed-off-by: Jordan Niethe --- arch/powerpc/Kconfig | 4 arch/powerpc/include/asm/bug.h | 37 --

[Bug 209733] Starting new KVM virtual machines on PPC64 starts to hang after box is up for a while

2020-11-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=209733 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added Status|RESOLVED|CLOSED ---

powerpc 5.10-rcN boot failures with RCU_SCALE_TEST=m

2020-11-26 Thread Daniel Axtens
Hi all, I'm having some difficulty tracking down a bug. Some configurations of the powerpc kernel since somewhere in the 5.10 merge window fail to boot on some ppc64 systems. They hang while trying to bring up SMP. It seems to depend on the RCU_SCALE/PERF_TEST option. (It was renamed in the 5.10

Re: [PATCH v3 3/3] powerpc/64s: feature: Work around inline asm issues

2020-11-26 Thread Michael Ellerman
Bill Wendling writes: > On Mon, Nov 23, 2020 at 7:44 PM Michael Ellerman wrote: >> Bill Wendling writes: >> > On Mon, Nov 23, 2020 at 12:10 PM Segher Boessenkool >> > wrote: >> >> On Mon, Nov 23, 2020 at 12:01:01PM -0800, Bill Wendling wrote: >> >> > On Mon, Nov 23, 2020 at 11:58 AM Segher

Re: [PATCH net 1/2] ibmvnic: Ensure that SCRQ entry reads are correctly ordered

2020-11-26 Thread Michael Ellerman
Thomas Falcon writes: > On 11/24/20 11:43 PM, Michael Ellerman wrote: >> Thomas Falcon writes: >>> Ensure that received Subordinate Command-Response Queue (SCRQ) >>> entries are properly read in order by the driver. These queues >>> are used in the ibmvnic device to process RX buffer and TX

[Bug 209733] Starting new KVM virtual machines on PPC64 starts to hang after box is up for a while

2020-11-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=209733 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added CC|

[RFC PATCH 14/14] samples/ftrace: Add powerpc support for ftrace direct samples

2020-11-26 Thread Naveen N. Rao
Add a simple powerpc trampoline to demonstrate use of ftrace direct on powerpc. Signed-off-by: Naveen N. Rao --- samples/Kconfig | 2 +- samples/ftrace/ftrace-direct-modify.c | 58 +++ samples/ftrace/ftrace-direct-too.c| 48

[RFC PATCH 11/14] powerpc/ftrace: Use GPR save/restore macros in ftrace_graph_caller()

2020-11-26 Thread Naveen N. Rao
Use SAVE_8GPRS(), REST_8GPRS() and _NIP(), along with using the standard SWITCH_FRAME_SIZE for the stack frame in ftrace_graph_caller() to simplify code. This increases the stack frame size, but it is unlikely to be an issue since ftrace_[regs_]caller() have just used a similar stack frame size,

[RFC PATCH 09/14] powerpc/ftrace: Use a hash table for tracking ftrace stubs

2020-11-26 Thread Naveen N. Rao
In preparation for having to deal with large number of ftrace stubs in support of ftrace direct calls, convert existing stubs to use a hash table. The hash table is key'ed off the target address for the stubs since there could be multiple stubs for the same target to cover the full kernel text.

[RFC PATCH 13/14] powerpc/ftrace: Add support for register_ftrace_direct() for MPROFILE_KERNEL

2020-11-26 Thread Naveen N. Rao
Add support for register_ftrace_direct() for MPROFILE_KERNEL, as it depends on DYNAMIC_FTRACE_WITH_REGS. Since powerpc only provides a branch range of 32MB, we set aside a 64k area within kernel text for creating stubs that can be used to branch to the provided trampoline, which can be located in

[RFC PATCH 10/14] powerpc/ftrace: Drop assumptions about ftrace trampoline target

2020-11-26 Thread Naveen N. Rao
We currently assume that ftrace locations are patched to go to either ftrace_caller or ftrace_regs_caller. Drop this assumption in preparation for supporting ftrace direct calls. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/trace/ftrace.c | 107 +++-- 1 file

[RFC PATCH 12/14] powerpc/ftrace: Drop saving LR to stack save area for -mprofile-kernel

2020-11-26 Thread Naveen N. Rao
In -mprofile-kernel variant of ftrace_graph_caller(), we save the optionally-updated LR address into the stack save area at the end. This is likely an offshoot of the initial -mprofile-kernel implementation in gcc emitting the same as part of the -mprofile-kernel instruction sequence. However,

[RFC PATCH 08/14] powerpc/ftrace: Use FTRACE_REGS_ADDR to identify the correct ftrace trampoline

2020-11-26 Thread Naveen N. Rao
Use FTRACE_REGS_ADDR instead of keying off CONFIG_DYNAMIC_FTRACE_WITH_REGS to identify the proper ftrace trampoline address to use. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/trace/ftrace.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git

[RFC PATCH 07/14] powerpc/ftrace: Remove dead code

2020-11-26 Thread Naveen N. Rao
ftrace_plt_tramps[] was intended to speed up skipping plt branches, but the code wasn't completed. It is also not significantly better than reading and decoding the instruction. Remove the same. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/trace/ftrace.c | 8 1 file changed, 8

[RFC PATCH 06/14] powerpc: Add support for CONFIG_HAVE_FUNCTION_ARG_ACCESS_API

2020-11-26 Thread Naveen N. Rao
Add register_get_kernel_argument() for a rudimentary way to access kernel function arguments. Signed-off-by: Naveen N. Rao --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/ptrace.h | 31 +++ 2 files changed, 32 insertions(+) diff --git

[RFC PATCH 05/14] ftrace: Add architectural helpers for [un]register_ftrace_direct()

2020-11-26 Thread Naveen N. Rao
Architectures may want to do some validation (such as to ensure that the trampoline code is reachable from the provided ftrace location) before accepting ftrace direct registration. Add helpers for the same. Signed-off-by: Naveen N. Rao --- include/linux/ftrace.h | 2 ++ kernel/trace/ftrace.c

[RFC PATCH 04/14] ftrace: Remove ftrace_find_direct_func()

2020-11-26 Thread Naveen N. Rao
This is a revert of commit 013bf0da047481 ("ftrace: Add ftrace_find_direct_func()") ftrace_find_direct_func() was meant for use in the function graph tracer by architecture specific code. However, commit ff205766dbbee0 ("ftrace: Fix function_graph tracer interaction with BPF trampoline") disabled

[RFC PATCH 03/14] ftrace: Fix cleanup in error path of register_ftrace_direct()

2020-11-26 Thread Naveen N. Rao
We need to remove hash entry if register_ftrace_function() fails. Consolidate the cleanup to be done after register_ftrace_function() at the end. Signed-off-by: Naveen N. Rao --- kernel/trace/ftrace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/trace/ftrace.c

[RFC PATCH 02/14] ftrace: Fix DYNAMIC_FTRACE_WITH_DIRECT_CALLS dependency

2020-11-26 Thread Naveen N. Rao
DYNAMIC_FTRACE_WITH_DIRECT_CALLS should depend on DYNAMIC_FTRACE_WITH_REGS since we need ftrace_regs_caller(). Fixes: 763e34e74bb7d5c ("ftrace: Add register_ftrace_direct()") Signed-off-by: Naveen N. Rao --- kernel/trace/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[RFC PATCH 01/14] ftrace: Fix updating FTRACE_FL_TRAMP

2020-11-26 Thread Naveen N. Rao
On powerpc, kprobe-direct.tc triggered FTRACE_WARN_ON() in ftrace_get_addr_new() followed by the below message: Bad trampoline accounting at: 4222522f (wake_up_process+0xc/0x20) (f001) The set of steps leading to this involved: - modprobe ftrace-direct-too - enable_probe - modprobe

[RFC PATCH 00/14] powerpc64: Add support for ftrace direct calls

2020-11-26 Thread Naveen N. Rao
This series adds support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS for powerpc64le. This is mostly working fine for me, except for a soft lockup I see with the ftrace direct selftest. It happens when irqsoff tracer is being tested with the ftrace direct modules. This appears to be an existing

Re: [PATCH 2/2] powerpc/ps3: make system bus's remove and shutdown callbacks return void

2020-11-26 Thread Uwe Kleine-König
[dropped a few lists from Cc: that are off-topic for this mail] Hello, while creating this patch series I looked at ps3_system_bus_shutdown(). I think the BUG_ON(!drv) in (now) line 422 can be easily triggered when there is a device without driver. (Try unbinding via sysfs before shutdown.)

[Bug 209733] Starting new KVM virtual machines on PPC64 starts to hang after box is up for a while

2020-11-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=209733 Cameron (c...@neo-zeon.de) changed: What|Removed |Added Status|NEW |RESOLVED

[Bug 209733] Starting new KVM virtual machines on PPC64 starts to hang after box is up for a while

2020-11-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=209733 --- Comment #4 from Cameron (c...@neo-zeon.de) --- After enough testing, I feel confident that this issue was fixed in 5.9.9. However, I encountered issues with XFS with 5.9.9 and 5.9.10 (mainly on POWER, but to a lesser extent they seemed to

[PATCH 1/2] ALSA: ppc: drop if block with always false condition

2020-11-26 Thread Uwe Kleine-König
The remove callback is only called for devices that were probed successfully before. As the matching probe function cannot complete without error if dev->match_id != PS3_MATCH_ID_SOUND, we don't have to check this here. Signed-off-by: Uwe Kleine-König --- sound/ppc/snd_ps3.c | 2 -- 1 file

[PATCH 2/2] powerpc/ps3: make system bus's remove and shutdown callbacks return void

2020-11-26 Thread Uwe Kleine-König
The driver core ignores the return value of struct device_driver::remove because there is only little that can be done. For the shutdown callback it's ps3_system_bus_shutdown() which ignores the return value. To simplify the quest to make struct device_driver::remove return void, let struct

[PATCH V2 4/7] powerpc/perf: Add generic and cache event list for power10 DD1

2020-11-26 Thread Athira Rajeev
There are event code updates for some of the generic events and cache events for power10. Inorder to maintain the current event codes work with DD1 also, create a new array of generic_events, cache_events and pmu_attr_groups with suffix _dd1, example, power10_events_attr_dd1. So that further

[PATCH V2 7/7] powerpc/perf: MMCR0 control for PMU registers under PMCC=00

2020-11-26 Thread Athira Rajeev
PowerISA v3.1 introduces new control bit (PMCCEXT) for restricting access to group B PMU registers in problem state when MMCR0 PMCC=0b00. In problem state and when MMCR0 PMCC=0b00, setting the Monitor Mode Control Register bit 54 (MMCR0 PMCCEXT), will restrict read permission on Group B

[PATCH V2 6/7] powerpc/perf: Fix to update cache events with l2l3 events in power10

2020-11-26 Thread Athira Rajeev
Export l2l3 events (PM_L2_ST_MISS and PM_L2_ST) and LLC-prefetches (PM_L3_PF_MISS_L3) via sysfs, and also add these to list of cache_events. Signed-off-by: Athira Rajeev --- arch/powerpc/perf/power10-events-list.h | 6 ++ arch/powerpc/perf/power10-pmu.c | 12 +--- 2 files

[PATCH V2 5/7] powerpc/perf: Fix to update generic event codes for power10

2020-11-26 Thread Athira Rajeev
Fix the event code for events: branch-instructions (to PM_BR_FIN), branch-misses (to PM_MPRED_BR_FIN) and cache-misses (to PM_LD_DEMAND_MISS_L1_FIN) for power10 PMU. Update the list of generic events with this modified event code. Signed-off-by: Athira Rajeev ---

[PATCH V2 3/7] powerpc/perf: Fix the PMU group constraints for threshold events in power10

2020-11-26 Thread Athira Rajeev
The PMU group constraints mask for threshold events covers all thresholding bits which includes threshold control value (start/stop), select value as well as thresh_cmp value (MMCRA[9:18]. In power9, thresh_cmp bits were part of the event code. But in case of power10, thresh_cmp bits are not part

[PATCH V2 0/7] powerpc/perf: Fixes for power10 PMU

2020-11-26 Thread Athira Rajeev
Patchset contains PMU fixes for power10. This patchset contains 7 patches. Patch1 includes fix to update event code with radix_scope_qual bit in power10. Patch2 and Patch3 updates the event group constraints for L2/L3 and threshold events in power10. Patch4, patch5 and patch6 includes the event

[PATCH V2 2/7] powerpc/perf: Update the PMU group constraints for l2l3 events in power10

2020-11-26 Thread Athira Rajeev
In Power9, L2/L3 bus events are always available as a "bank" of 4 events. To obtain the counts for any of the l2/l3 bus events in a given bank, the user will have to program PMC4 with corresponding l2/l3 bus event for that bank. Commit 59029136d750 ("powerpc/perf: Add constraints for power9 l2/l3

[PATCH V2 1/7] powerpc/perf: Fix to update radix_scope_qual in power10

2020-11-26 Thread Athira Rajeev
power10 uses bit 9 of the raw event code as RADIX_SCOPE_QUAL. This bit is used for enabling the radix process events. Patch fixes the PMU counter support functions to program bit 18 of MMCR1 ( Monitor Mode Control Register1 ) with the RADIX_SCOPE_QUAL bit value. Since this field is not per-pmc,

Re: [PATCH v2 4/6] arm64/mm: Implement pXX_leaf_size() support

2020-11-26 Thread Will Deacon
On Thu, Nov 26, 2020 at 01:57:47PM +0100, Peter Zijlstra wrote: > > Now with pmd_cont() defined... > > --- > Subject: arm64/mm: Implement pXX_leaf_size() support > From: Peter Zijlstra > Date: Fri Nov 13 11:46:06 CET 2020 > > ARM64 has non-pagetable aligned large page support with PTE_CONT,

[PATCH 8/8] net: ethernet: ibm: ibmvnic: Fix some kernel-doc issues

2020-11-26 Thread Lee Jones
Fixes the following W=1 kernel build warning(s): from drivers/net/ethernet/ibm/ibmvnic.c:35: inlined from ‘handle_vpd_rsp’ at drivers/net/ethernet/ibm/ibmvnic.c:4124:3: drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'hdr_data' not described in 'build_hdr_data'

[PATCH 6/8] net: ethernet: toshiba: ps3_gelic_net: Fix some kernel-doc misdemeanours

2020-11-26 Thread Lee Jones
Fixes the following W=1 kernel build warning(s): drivers/net/ethernet/toshiba/ps3_gelic_net.c:1107: warning: Function parameter or member 'irq' not described in 'gelic_card_interrupt' drivers/net/ethernet/toshiba/ps3_gelic_net.c:1107: warning: Function parameter or member 'ptr' not described

[PATCH 5/8] net: ethernet: ibm: ibmvnic: Fix some kernel-doc misdemeanours

2020-11-26 Thread Lee Jones
Fixes the following W=1 kernel build warning(s): from drivers/net/ethernet/ibm/ibmvnic.c:35: inlined from ‘handle_vpd_rsp’ at drivers/net/ethernet/ibm/ibmvnic.c:4124:3: drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'hdr_field' not described in 'build_hdr_data'

[PATCH 0/8] Rid W=1 warnings in Net

2020-11-26 Thread Lee Jones
Resending the stragglers. This set is part of a larger effort attempting to clean-up W=1 kernel builds, which are currently overwhelmingly riddled with niggly little warnings. Lee Jones (8): net: ethernet: smsc: smc91x: Demote non-conformant kernel function header net: xen-netback:

Re: [PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 02:06:19PM +0100, Peter Zijlstra wrote: > On Thu, Nov 26, 2020 at 12:56:06PM +, Matthew Wilcox wrote: > > On Thu, Nov 26, 2020 at 01:42:07PM +0100, Peter Zijlstra wrote: > > > + pgdp = pgd_offset(mm, addr); > > > + pgd = READ_ONCE(*pgdp); > > > > I forget how

Re: [PATCH v4 2/2] lkdtm/powerpc: Add SLB multihit test

2020-11-26 Thread Ganesh
On 10/19/20 6:45 PM, Michal Suchánek wrote: On Mon, Oct 19, 2020 at 09:59:57PM +1100, Michael Ellerman wrote: Hi Ganesh, Some comments below ... Ganesh Goudar writes: To check machine check handling, add support to inject slb multihit errors. Cc: Kees Cook Reviewed-by: Michal Suchánek

Re: [PATCH v14 8/9] powerpc/vdso: Switch VDSO to generic C implementation.

2020-11-26 Thread Christophe Leroy
Le 26/11/2020 à 14:10, Michael Ellerman a écrit : From: Christophe Leroy For VDSO32 on PPC64, we create a fake 32 bits config, on the same principle as MIPS architecture, in order to get the correct parts of the different asm header files. The above is not done anymore since v13.

[PATCH v14 9/9] powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy Provides __kernel_clock_gettime64() on vdso32. This is the 64 bits version of __kernel_clock_gettime() which is y2038 compliant. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link:

[PATCH v14 8/9] powerpc/vdso: Switch VDSO to generic C implementation.

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy For VDSO32 on PPC64, we create a fake 32 bits config, on the same principle as MIPS architecture, in order to get the correct parts of the different asm header files. With the C VDSO, the performance is slightly lower, but it is worth it as it will ease maintenance and

[PATCH v14 7/9] powerpc/vdso: Save and restore TOC pointer on PPC64

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy On PPC64, the TOC pointer needs to be saved and restored. Suggested-by: Michael Ellerman Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/bf21fd9762a124ce3afec34a8e403a44dfdf2f84.1604426550.git.christophe.le...@csgroup.eu

[PATCH v14 6/9] powerpc/vdso: Prepare for switching VDSO to generic C implementation.

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy Prepare for switching VDSO to generic C implementation in following patch. Here, we: - Prepare the helpers to call the C VDSO functions - Prepare the required callbacks for the C VDSO functions - Prepare the clocksource.h files to define VDSO_ARCH_CLOCKMODES - Add the C

[PATCH v14 5/9] powerpc/barrier: Use CONFIG_PPC64 for barrier selection

2020-11-26 Thread Michael Ellerman
Currently we use ifdef __powerpc64__ in barrier.h to decide if we should use lwsync or eieio for SMPWMB which is then used by __smp_wmb(). That means when we are building the compat VDSO we will use eieio, because it's 32-bit code, even though we're building a 64-bit kernel for a 64-bit CPU.

[PATCH v14 4/9] powerpc/time: Fix mftb()/get_tb() for use with the compat VDSO

2020-11-26 Thread Michael Ellerman
When we're building the compat VDSO we are building 32-bit code but in the context of a 64-bit kernel configuration. To make this work we need to be careful in some places when using ifdefs to differentiate between CONFIG_PPC64 and __powerpc64__. CONFIG_PPC64 indicates the kernel we're building

[PATCH v14 3/9] powerpc/time: Move timebase functions into new asm/vdso/timebase.h

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy In order to easily use get_tb() from C VDSO, move timebase functions into a new header named asm/vdso/timebase.h Signed-off-by: Christophe Leroy [mpe: Move into asm/vdso, drop dubious historical authorship comments, move mftb() etc. also] Signed-off-by: Michael

[PATCH v14 2/9] powerpc/processor: Move cpu_relax() into asm/vdso/processor.h

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy cpu_relax() need to be in asm/vdso/processor.h to be used by the C VDSO generic library. Move it there. Signed-off-by: Christophe Leroy [mpe: Tweak include guards to match our usual formatting] Signed-off-by: Michael Ellerman Link:

[PATCH v14 1/9] powerpc/feature: Use CONFIG_PPC64 instead of __powerpc64__ to define possible features

2020-11-26 Thread Michael Ellerman
From: Christophe Leroy In order to build VDSO32 for PPC64, we need to have CPU_FTRS_POSSIBLE and CPU_FTRS_ALWAYS independant of whether we are building the 32 bits VDSO or the 64 bits VDSO. Use #ifdef CONFIG_PPC64 instead of #ifdef __powerpc64__ Signed-off-by: Christophe Leroy Signed-off-by:

Re: [PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Peter Zijlstra
On Thu, Nov 26, 2020 at 12:56:06PM +, Matthew Wilcox wrote: > On Thu, Nov 26, 2020 at 01:42:07PM +0100, Peter Zijlstra wrote: > > + pgdp = pgd_offset(mm, addr); > > + pgd = READ_ONCE(*pgdp); > > I forget how x86-32-PAE maps to Linux's PGD/P4D/PUD/PMD scheme, but > according to volume 3,

Re: [PATCH v2 1/6] mm/gup: Provide gup_get_pte() more generic

2020-11-26 Thread Peter Zijlstra
On Thu, Nov 26, 2020 at 12:43:00PM +, Matthew Wilcox wrote: > On Thu, Nov 26, 2020 at 01:01:15PM +0100, Peter Zijlstra wrote: > > +#ifdef CONFIG_GUP_GET_PTE_LOW_HIGH > > +/* > > + * WARNING: only to be used in the get_user_pages_fast() implementation. > > + * With get_user_pages_fast(), we

Re: [PATCH v2 4/6] arm64/mm: Implement pXX_leaf_size() support

2020-11-26 Thread Peter Zijlstra
Now with pmd_cont() defined... --- Subject: arm64/mm: Implement pXX_leaf_size() support From: Peter Zijlstra Date: Fri Nov 13 11:46:06 CET 2020 ARM64 has non-pagetable aligned large page support with PTE_CONT, when this bit is set the page is part of a super-page. Match the hugetlb code and

Re: [PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 01:42:07PM +0100, Peter Zijlstra wrote: > + pgdp = pgd_offset(mm, addr); > + pgd = READ_ONCE(*pgdp); I forget how x86-32-PAE maps to Linux's PGD/P4D/PUD/PMD scheme, but according to volume 3, section 4.4.2, PAE paging uses a 64-bit PDE, so whether a PDE is a PGD or

Re: [PATCH v2 2/6] mm: Introduce pXX_leaf_size()

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 01:01:16PM +0100, Peter Zijlstra wrote: > A number of architectures have non-pagetable aligned huge/large pages. > For such architectures a leaf can actually be part of a larger entry. > > Provide generic helpers to determine the size of a page-table leaf. > >

Re: [PATCH v2 1/6] mm/gup: Provide gup_get_pte() more generic

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 01:01:15PM +0100, Peter Zijlstra wrote: > +#ifdef CONFIG_GUP_GET_PTE_LOW_HIGH > +/* > + * WARNING: only to be used in the get_user_pages_fast() implementation. > + * With get_user_pages_fast(), we walk down the pagetables without taking any > + * locks. For this we would

Re: [PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Peter Zijlstra
On Thu, Nov 26, 2020 at 12:34:58PM +, Matthew Wilcox wrote: > On Thu, Nov 26, 2020 at 01:01:17PM +0100, Peter Zijlstra wrote: > > The (new) page-table walker in arch_perf_get_page_size() is broken in > > various ways. Specifically while it is used in a lockless manner, it > > doesn't depend on

Re: [PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 01:01:17PM +0100, Peter Zijlstra wrote: > The (new) page-table walker in arch_perf_get_page_size() is broken in > various ways. Specifically while it is used in a lockless manner, it > doesn't depend on CONFIG_HAVE_FAST_GUP nor uses the proper _lockless > offset methods,

[PATCH v2 1/6] mm/gup: Provide gup_get_pte() more generic

2020-11-26 Thread Peter Zijlstra
In order to write another lockless page-table walker, we need gup_get_pte() exposed. While doing that, rename it to ptep_get_lockless() to match the existing ptep_get() naming. Signed-off-by: Peter Zijlstra (Intel) --- include/linux/pgtable.h | 55 +

[PATCH v2 0/6] perf/mm: Fix PERF_SAMPLE_*_PAGE_SIZE

2020-11-26 Thread Peter Zijlstra
Hi, These patches provide generic infrastructure to determine TLB page size from page table entries alone. Perf will use this (for either data or code address) to aid in profiling TLB issues. While most architectures only have page table aligned large pages, some (notably ARM64, Sparc64 and

[PATCH v2 4/6] arm64/mm: Implement pXX_leaf_size() support

2020-11-26 Thread Peter Zijlstra
ARM64 has non-pagetable aligned large page support with PTE_CONT, when this bit is set the page is part of a super-page. Match the hugetlb code and support these super pages for PTE and PMD levels. This enables PERF_SAMPLE_{DATA,CODE}_PAGE_SIZE to report accurate pagetable leaf sizes.

[PATCH v2 3/6] perf/core: Fix arch_perf_get_page_size()

2020-11-26 Thread Peter Zijlstra
The (new) page-table walker in arch_perf_get_page_size() is broken in various ways. Specifically while it is used in a lockless manner, it doesn't depend on CONFIG_HAVE_FAST_GUP nor uses the proper _lockless offset methods, nor is careful to only read each entry only once. Also the hugetlb

[PATCH v2 5/6] sparc64/mm: Implement pXX_leaf_size() support

2020-11-26 Thread Peter Zijlstra
Sparc64 has non-pagetable aligned large page support; wire up the pXX_leaf_size() functions to report the correct pagetable page size. This enables PERF_SAMPLE_{DATA,CODE}_PAGE_SIZE to report accurate pagetable leaf sizes. Signed-off-by: Peter Zijlstra (Intel) ---

[PATCH v2 6/6] powerpc/8xx: Implement pXX_leaf_size() support

2020-11-26 Thread Peter Zijlstra
Christophe Leroy wrote: > I can help with powerpc 8xx. It is a 32 bits powerpc. The PGD has 1024 > entries, that means each entry maps 4M. > > Page sizes are 4k, 16k, 512k and 8M. > > For the 8M pages we use hugepd with a single entry. The two related PGD > entries point to the same hugepd. > >

[PATCH v2 2/6] mm: Introduce pXX_leaf_size()

2020-11-26 Thread Peter Zijlstra
A number of architectures have non-pagetable aligned huge/large pages. For such architectures a leaf can actually be part of a larger entry. Provide generic helpers to determine the size of a page-table leaf. Signed-off-by: Peter Zijlstra (Intel) --- include/linux/pgtable.h | 16

Re: [PATCH 0/5] perf/mm: Fix PERF_SAMPLE_*_PAGE_SIZE

2020-11-26 Thread Peter Zijlstra
On Fri, Nov 20, 2020 at 01:20:04PM +0100, Peter Zijlstra wrote: > > > I can help with powerpc 8xx. It is a 32 bits powerpc. The PGD has 1024 > > > entries, that means each entry maps 4M. > > > > > > Page sizes are 4k, 16k, 512k and 8M. > > > > > > For the 8M pages we use hugepd with a single

Re: [PATCH v6 16/22] powerpc/book3s64/kuap: Improve error reporting with KUAP

2020-11-26 Thread Christophe Leroy
Le 26/11/2020 à 10:29, Michael Ellerman a écrit : "Aneesh Kumar K.V" writes: Christophe Leroy writes: Le 25/11/2020 à 06:16, Aneesh Kumar K.V a écrit : With hash translation use DSISR_KEYFAULT to identify a wrong access. With Radix we look at the AMR value and type of fault.

Re: [PATCH 0/4] powerpc/64s: Fix for radix TLB invalidation bug

2020-11-26 Thread Aneesh Kumar K.V
Nicholas Piggin writes: > This fixes a tricky bug that was noticed by TLB multi-hits in a guest > stress testing CPU hotplug, but TLB invalidation means any kind of > data corruption is possible. > > Thanks, > Nick > > Nicholas Piggin (4): > powerpc/64s: Fix hash ISA v3.0 TLBIEL instruction

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

2020-11-26 Thread Ravi Bangoria
On 11/19/20 11:11 AM, 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. In these cases, the instruction is invalid. This applies

[PATCH 4/4] powerpc/64s: Trim offlined CPUs from mm_cpumasks

2020-11-26 Thread Nicholas Piggin
When offlining a CPU, powerpc/64s does not flush TLBs, rather it just leaves the CPU set in mm_cpumasks, so it continues to receive TLBIEs to manage its TLBs. However the exit_flush_lazy_tlbs() function expects that after returning, all CPUs (except self) have flushed TLBs for that mm, in which

[PATCH 3/4] kernel/cpu: add arch override for clear_tasks_mm_cpumask() mm handling

2020-11-26 Thread Nicholas Piggin
powerpc/64s keeps a counter in the mm which counts bits set in mm_cpumask as well as other things. This means it can't use generic code to clear bits out of the mask and doesn't adjust the arch specific counter. Add an arch override that allows powerpc/64s to use clear_tasks_mm_cpumask().

[PATCH 2/4] powerpc/64s/pseries: Fix hash tlbiel_all_isa300 for guest kernels

2020-11-26 Thread Nicholas Piggin
tlbiel_all() can not be usable in !HVMODE when running hash presently, remove HV privileged flushes when running in guest to make it usable. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_native.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-)

[PATCH 1/4] powerpc/64s: Fix hash ISA v3.0 TLBIEL instruction generation

2020-11-26 Thread Nicholas Piggin
A typo has the R field of the instruction assigned by lucky dip a la register allocator. Fixes: d4748276ae14c ("powerpc/64s: Improve local TLB flush for boot and MCE on POWER9") Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_native.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 0/4] powerpc/64s: Fix for radix TLB invalidation bug

2020-11-26 Thread Nicholas Piggin
This fixes a tricky bug that was noticed by TLB multi-hits in a guest stress testing CPU hotplug, but TLB invalidation means any kind of data corruption is possible. Thanks, Nick Nicholas Piggin (4): powerpc/64s: Fix hash ISA v3.0 TLBIEL instruction generation powerpc/64s/pseries: Fix hash

  1   2   >