Re: [PATCH v2] powerpc/32: Don't use a struct based type for pte_t

2021-09-17 Thread Michael Ellerman
Christophe Leroy writes: > Long time ago we had a config item called STRICT_MM_TYPECHECKS > to build the kernel with pte_t defined as a structure in order > to perform additional build checks or build it with pte_t > defined as a simple type in order to get simpler generated code. > > Commit

[PATCH] powerpc/8xx: Simplify TLB handling

2021-09-17 Thread Christophe Leroy
In the old days, TLB handling for 8xx was using tlbie and tlbia instructions directly as much as possible. But commit f048aace29e0 ("powerpc/mm: Add SMP support to no-hash TLB handling") broke that by introducing out-of-line unnecessary complex functions for booke/smp which don't have tlbie/tlbia

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Roman Skakun
Hi, Christoph I use Xen PV display. In my case, PV display backend(Dom0) allocates contiguous buffer via DMA-API to to implement zero-copy between Dom0 and DomU. When I start Weston under DomU, I got the next log in Dom0: ``` [ 112.554471] CPU: 0 PID: 367 Comm: weston Tainted: G O

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Robin Murphy
On 2021-09-17 10:36, Roman Skakun wrote: Hi, Christoph I use Xen PV display. In my case, PV display backend(Dom0) allocates contiguous buffer via DMA-API to to implement zero-copy between Dom0 and DomU. Well, something's gone badly wrong there - if you have to shadow the entire thing in a

[PATCH] powerpc/32: Don't use a struct based type for pte_t

2021-09-17 Thread Christophe Leroy
Long time ago we had a config item called STRICT_MM_TYPECHECKS to build the kernel with pte_t defined as a structure in order to perform additional build checks or build it with pte_t defined as a simple type in order to get simpler generated code. Commit 670eea924198 ("powerpc/mm: Always use

Re: [PATCH] powerpc/mce: check if event info is valid

2021-09-17 Thread Ganesh
On 8/6/21 6:53 PM, Ganesh Goudar wrote: Check if the event info is valid before printing the event information. When a fwnmi enabled nested kvm guest hits a machine check exception L0 and L2 would generate machine check event info, But L1 would not generate any machine check event info as it

[powerpc:merge] BUILD SUCCESS a0175bcd45a4dd0de301dca8fd17d74fcb3ce240

2021-09-17 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge branch HEAD: a0175bcd45a4dd0de301dca8fd17d74fcb3ce240 powerpc/ci: Switch GCC 4.9.4 builds to 5.5.0 elapsed time: 1069m configs tested: 105 configs skipped: 3 The following configs have been built

Re: [PATCH v2] powerpc/mce: Fix access error in mce handler

2021-09-17 Thread Ganesh
On 9/17/21 12:09 PM, Daniel Axtens wrote: Hi Ganesh, We queue an irq work for deferred processing of mce event in realmode mce handler, where translation is disabled. Queuing of the work may result in accessing memory outside RMO region, such access needs the translation to be enabled for an

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Roman Skakun
Hi Jan, >>> In order to be sure to catch all uses like this one (including ones >>> which make it upstream in parallel to yours), I think you will want >>> to rename the original IO_TLB_SEGSIZE to e.g. IO_TLB_DEFAULT_SEGSIZE. >> >> I don't understand your point. Can you clarify this? > >

[PATCH v5 5/5] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-17 Thread Christophe Leroy
Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- v5: Added missing __user flag when calling unsafe_copy_siginfo_to_user()

[PATCH v5 2/5] powerpc/signal: Include the new stack frame inside the user access block

2021-09-17 Thread Christophe Leroy
Include the new stack frame inside the user access block and set it up using unsafe_put_user(). On an mpc 8321 (book3s/32) the improvment is about 4% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 29 +

[PATCH v5 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-17 Thread Christophe Leroy
In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_siginfo_to_user() in order to use it within user access blocks. For that, also add an 'unsafe' version of clear_user(). This commit adds the generic fallback for

Re: [PATCH v1 1/2] powerpc/64s: system call rfscv workaround for TM bugs

2021-09-17 Thread Daniel Axtens
Nicholas Piggin writes: > The rfscv instruction does not work correctly with the fake-suspend mode > in POWER9, which can end up with the hypervisor restoring an incorrect > checkpoint. If I understand correctly from commit 4bb3c7a0208f ("KVM: PPC: Book3S HV: Work around transactional memory

Re: [PATCH v5 6/6] sched/fair: Consider SMT in ASYM_PACKING load balance

2021-09-17 Thread Vincent Guittot
On Fri, 17 Sept 2021 at 03:01, Ricardo Neri wrote: > > On Wed, Sep 15, 2021 at 05:43:44PM +0200, Vincent Guittot wrote: > > On Sat, 11 Sept 2021 at 03:19, Ricardo Neri > > wrote: > > > > > > When deciding to pull tasks in ASYM_PACKING, it is necessary not only to > > > check for the idle state

[PATCH v5 1/5] powerpc/signal64: Access function descriptor with user access block

2021-09-17 Thread Christophe Leroy
Access the function descriptor of the handler within a user access block. Signed-off-by: Christophe Leroy --- v3: Flatten the change to avoid nested gotos. --- arch/powerpc/kernel/signal_64.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git

[PATCH v5 4/5] powerpc/uaccess: Add unsafe_clear_user()

2021-09-17 Thread Christophe Leroy
Implement unsafe_clear_user() for powerpc. It's a copy/paste of unsafe_copy_to_user() with value 0 as source. It may be improved in a later patch by using 'dcbz' instruction to zeroize full cache lines at once. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 20

Re: [PATCH v2] powerpc/mce: Fix access error in mce handler

2021-09-17 Thread Daniel Axtens
Hi Ganesh, > We queue an irq work for deferred processing of mce event > in realmode mce handler, where translation is disabled. > Queuing of the work may result in accessing memory outside > RMO region, such access needs the translation to be enabled > for an LPAR running with hash mmu else the

[PATCH v2] powerpc/32: Don't use a struct based type for pte_t

2021-09-17 Thread Christophe Leroy
Long time ago we had a config item called STRICT_MM_TYPECHECKS to build the kernel with pte_t defined as a structure in order to perform additional build checks or build it with pte_t defined as a simple type in order to get simpler generated code. Commit 670eea924198 ("powerpc/mm: Always use

RE: [PATCH v2] powerpc/32: Don't use a struct based type for pte_t

2021-09-17 Thread David Laight
From: Christophe Leroy > Sent: 17 September 2021 14:58 > > Long time ago we had a config item called STRICT_MM_TYPECHECKS > to build the kernel with pte_t defined as a structure in order > to perform additional build checks or build it with pte_t > defined as a simple type in order to get simpler

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Jan Beulich
On 17.09.2021 11:36, Roman Skakun wrote: > I use Xen PV display. In my case, PV display backend(Dom0) allocates > contiguous buffer via DMA-API to > to implement zero-copy between Dom0 and DomU. Why does the buffer need to be allocated by Dom0? If it was allocated by DomU, it could use grants to

Re: [PATCH] powerpc: warn on emulation of dcbz instruction

2021-09-17 Thread Benjamin Herrenschmidt
On Thu, 2021-09-16 at 14:36 +, David Laight wrote: > > Does userspace accesses non-cached memory directly ? > > > It probably can if a driver mmaps PCI space directly into user space. > > That certainly works on x86-64. The posterchild for that is Xorg Cheers, Ben.

[PATCH v2] powerpc/8xx: Simplify TLB handling

2021-09-17 Thread Christophe Leroy
In the old days, TLB handling for 8xx was using tlbie and tlbia instructions directly as much as possible. But commit f048aace29e0 ("powerpc/mm: Add SMP support to no-hash TLB handling") broke that by introducing out-of-line unnecessary complex functions for booke/smp which don't have tlbie/tlbia

Re: [PATCH v5 6/6] sched/fair: Consider SMT in ASYM_PACKING load balance

2021-09-17 Thread Vincent Guittot
On Fri, 17 Sept 2021 at 03:01, Ricardo Neri wrote: > > On Wed, Sep 15, 2021 at 05:43:44PM +0200, Vincent Guittot wrote: > > On Sat, 11 Sept 2021 at 03:19, Ricardo Neri > > wrote: > > > > > > When deciding to pull tasks in ASYM_PACKING, it is necessary not only to > > > check for the idle state

Re: [PATCH v5 2/6] sched/topology: Introduce sched_group::flags

2021-09-17 Thread Vincent Guittot
On Sat, 11 Sept 2021 at 03:19, Ricardo Neri wrote: > > There exist situations in which the load balance needs to know the > properties of the CPUs in a scheduling group. When using asymmetric > packing, for instance, the load balancer needs to know not only the > state of dst_cpu but also of its

[PATCH v2 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler

2021-09-17 Thread Hari Bathini
Patch #1 & #2 are simple cleanup patches. Patch #3 refactors JIT compiler code with the aim to simplify adding BPF_PROBE_MEM support. Patch #4 introduces PPC_RAW_BRANCH() macro instead of open coding branch instruction. Patch #5 & #7 add BPF_PROBE_MEM support for PPC64 & PPC32 JIT compilers

[PATCH v2 6/8] bpf ppc64: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria On PPC64 with KUAP enabled, any kernel code which wants to access userspace needs to be surrounded by disable-enable KUAP. But that is not happening for BPF_PROBE_MEM load instruction. So, when BPF program tries to access invalid userspace address, page-fault handler

[PATCH v2 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria BPF load instruction with BPF_PROBE_MEM mode can cause a fault inside kernel. Append exception table for such instructions within BPF program. Unlike other archs which uses extable 'fixup' field to pass dest_reg and nip, BPF exception table on PowerPC follows the generic

Re: [PATCH v2 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria Reviewed-by: Christophe Leroy --- * No changes in v2. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file

Re: [PATCH v2 3/8] bpf powerpc: refactor JIT compiler code

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : Refactor powerpc JITing. This simplifies adding BPF_PROBE_MEM support. Could you describe a bit more what you are refactoring exactly ? Signed-off-by: Hari Bathini --- Changes in v2: * New patch to refactor a bit of JITing code.

Re: [PATCH v2 3/8] bpf powerpc: refactor JIT compiler code

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : Refactor powerpc JITing. This simplifies adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to refactor a bit of JITing code. arch/powerpc/net/bpf_jit_comp32.c | 50 +++-

Re: [PATCH v5 4/6] sched/fair: Provide update_sg_lb_stats() with sched domain statistics

2021-09-17 Thread Vincent Guittot
On Sat, 11 Sept 2021 at 03:19, Ricardo Neri wrote: > > Before deciding to pull tasks when using asymmetric packing of tasks, > on some architectures (e.g., x86) it is necessary to know not only the > state of dst_cpu but also of its SMT siblings. The decision to classify > a candidate busiest

Re: [PATCH v5 3/6] sched/fair: Optimize checking for group_asym_packing

2021-09-17 Thread Vincent Guittot
On Sat, 11 Sept 2021 at 03:19, Ricardo Neri wrote: > > sched_asmy_prefer() always returns false when called on the local group. By > checking local_group, we can avoid additional checks and invoking > sched_asmy_prefer() when it is not needed. No functional changes are > introduced. > > Cc:

[PATCH v2 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-09-17 Thread Hari Bathini
Define and use PPC_RAW_BRANCH() macro instead of open coding it. This macro is used while adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to introduce PPC_RAW_BRANCH() macro. arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h

[PATCH v2 3/8] bpf powerpc: refactor JIT compiler code

2021-09-17 Thread Hari Bathini
Refactor powerpc JITing. This simplifies adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to refactor a bit of JITing code. arch/powerpc/net/bpf_jit_comp32.c | 50 +++- arch/powerpc/net/bpf_jit_comp64.c | 76

Re: [PATCH v2 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : From: Ravi Bangoria BPF load instruction with BPF_PROBE_MEM mode can cause a fault inside kernel. Append exception table for such instructions within BPF program. Unlike other archs which uses extable 'fixup' field to pass dest_reg and nip, BPF

Re: [PATCH v5 5/6] sched/fair: Carve out logic to mark a group for asymmetric packing

2021-09-17 Thread Vincent Guittot
On Sat, 11 Sept 2021 at 03:19, Ricardo Neri wrote: > > Create a separate function, sched_asym(). A subsequent changeset will > introduce logic to deal with SMT in conjunction with asmymmetric > packing. Such logic will need the statistics of the scheduling > group provided as argument. Update

[PATCH v2 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria In case of extra_pass, usual JIT passes are always skipped. So, extra_pass is always false while calling bpf_jit_build_body() and thus it can be removed. Signed-off-by: Ravi Bangoria --- Changes in v2: * Updated the changelog wording a bit. arch/powerpc/net/bpf_jit.h

[PATCH v2 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria --- * No changes in v2. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/net/bpf_jit.h

[PATCH v2 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Hari Bathini
BPF load instruction with BPF_PROBE_MEM mode can cause a fault inside kernel. Append exception table for such instructions within BPF program. Unlike other archs which uses extable 'fixup' field to pass dest_reg and nip, BPF exception table on PowerPC follows the generic PowerPC exception table

[PATCH v2 8/8] bpf ppc32: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Hari Bathini
With KUAP enabled, any kernel code which wants to access userspace needs to be surrounded by disable-enable KUAP. But that is not happening for BPF_PROBE_MEM load instruction. Though PPC32 does not support read protection, considering the fact that PTR_TO_BTF_ID (which uses BPF_PROBE_MEM mode)

Re: [PATCH v2 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-09-17 Thread LEROY Christophe
Le 17/09/2021 à 17:30, Hari Bathini a écrit : > Define and use PPC_RAW_BRANCH() macro instead of open coding it. This > macro is used while adding BPF_PROBE_MEM support. > > Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy > --- > > Changes in v2: > * New patch to introduce

[PATCH 3/3] powerpc/inst: Define ppc_inst_t as u32 on PPC32

2021-09-17 Thread Christophe Leroy
Unlike PPC64 ABI, PPC32 uses the stack to pass a parameter defined as a struct, even when the struct has a single simple element. To avoid that, define ppc_inst_t as u32 on PPC32. Keep it as 'struct ppc_inst' when __CHECKER__ is defined so that sparse can perform type checking. Signed-off-by:

[PATCH 1/3] powerpc/inst: Refactor ___get_user_instr()

2021-09-17 Thread Christophe Leroy
PPC64 version of ___get_user_instr() can be used for PPC32 as well, by simply disabling the suffix part with IS_ENABLED(CONFIG_PPC64). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/inst.h | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git

[PATCH 2/3] powerpc/inst: Define ppc_inst_t

2021-09-17 Thread Christophe Leroy
In order to stop using 'struct ppc_inst' on PPC32, define a ppc_inst_t typedef. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/code-patching.h | 18 +++ arch/powerpc/include/asm/hw_breakpoint.h | 4 +- arch/powerpc/include/asm/inst.h | 34 ++--

Re: [PATCH v5 6/6] sched/fair: Consider SMT in ASYM_PACKING load balance

2021-09-17 Thread Peter Zijlstra
On Fri, Sep 17, 2021 at 05:25:02PM +0200, Vincent Guittot wrote: > With the removal of the condition !sds->local_stat.sum_nr_running > which seems useless because dst_cpu is idle and not SMT, this patch > looks good to me I've made it look like this. Thanks! --- Subject: sched/fair: Consider

Re: [PATCH v2 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : BPF load instruction with BPF_PROBE_MEM mode can cause a fault inside kernel. Append exception table for such instructions within BPF program. Unlike other archs which uses extable 'fixup' field to pass dest_reg and nip, BPF exception table on

Re: [PATCH v2 8/8] bpf ppc32: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : With KUAP enabled, any kernel code which wants to access userspace needs to be surrounded by disable-enable KUAP. But that is not happening for BPF_PROBE_MEM load instruction. Though PPC32 does not support read protection, considering the fact

Re: [PATCH v2 6/8] bpf ppc64: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Christophe Leroy
Le 17/09/2021 à 17:30, Hari Bathini a écrit : From: Ravi Bangoria On PPC64 with KUAP enabled, any kernel code which wants to access userspace needs to be surrounded by disable-enable KUAP. But that is not happening for BPF_PROBE_MEM load instruction. So, when BPF program tries to access

[powerpc:fixes-test] BUILD SUCCESS c006a06508db4841d256d82f42da392d6391f3d9

2021-09-17 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: c006a06508db4841d256d82f42da392d6391f3d9 powerpc/xics: Set the IRQ chip data for the ICS native backend elapsed time: 1508m configs tested: 138 configs skipped: 3 The following configs have