[PATCH v2 04/37] powerpc/64s: remove KVM SKIP test from instruction breakpoint handler

2021-02-25 Thread Nicholas Piggin
The code being executed in KVM_GUEST_MODE_SKIP is hypervisor code with MSR[IR]=0, so the faults of concern are the d-side ones caused by access to guest context by the hypervisor. Instruction breakpoint interrupts are not a concern here. It's unlikely any good would come of causing breaks in this

[PATCH v2 03/37] powerpc/64s: Remove KVM handler support from CBE_RAS interrupts

2021-02-25 Thread Nicholas Piggin
Cell does not support KVM. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 60d3051a8bc8..a027600beeb1

[PATCH v2 02/37] KVM: PPC: Book3S HV: Fix CONFIG_SPAPR_TCE_IOMMU=n default hcalls

2021-02-25 Thread Nicholas Piggin
This config option causes the warning in init_default_hcalls to fire because the TCE handlers are in the default hcall list but not implemented. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c

[PATCH v2 14/37] KVM: PPC: Book3S HV P9: implement kvmppc_xive_pull_vcpu in C

2021-02-25 Thread Nicholas Piggin
This is more symmetric with kvmppc_xive_push_vcpu. The extra test in the asm will go away in a later change. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_ppc.h | 2 ++ arch/powerpc/kvm/book3s_hv.c| 2 ++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 5

[PATCH v2 13/37] KVM: PPC: Book3S HV P9: Move radix MMU switching instructions together

2021-02-25 Thread Nicholas Piggin
Switching the MMU from radix<->radix mode is tricky particularly as the MMU can remain enabled and requires a certain sequence of SPR updates. Move these together into their own functions. This also includes the radix TLB check / flush because it's tied in to MMU switching due to tlbiel getting

[PATCH v2 30/37] KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU

2021-02-25 Thread Nicholas Piggin
Rather than partition the guest PID space and catch and flush a rogue guest, instead work around this issue by ensuring the MMU is always disabled in HV mode while the guest MMU context is switched in. This may be a bit less efficient, but it is a lot less complicated and allows the P9 path to

[PATCH v2 29/37] KVM: PPC: Book3S HV P9: Switch to guest MMU context as late as possible

2021-02-25 Thread Nicholas Piggin
Move WARN_ON traps early so they are less likely to get tangled on CPU switching to guest. Move MMU context switch as late as reasonably possible to minimise code running with guest context switched in. This becomes more important when this code may run in real-mode, with later changes.

[PATCH v2 28/37] KVM: PPC: Book3S HV P9: Add helpers for OS SPR handling

2021-02-25 Thread Nicholas Piggin
This is a first step to wrapping supervisor and user SPR saving and loading up into helpers, which will then be called independently in bare metal and nested HV cases in order to optimise SPR access. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 131

[PATCH v2 23/37] KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C

2021-02-25 Thread Nicholas Piggin
Almost all logic is moved to C, by introducing a new in_guest mode that selects and branches very early in the interrupt handler to the P9 exit code. The remaining assembly is only about 160 lines of low level stack setup, with VCPU vs host register save and restore, plus a small shim to the

[PATCH v2 24/37] KVM: PPC: Book3S HV P9: inline kvmhv_load_hv_regs_and_go into __kvmhv_vcpu_entry_p9

2021-02-25 Thread Nicholas Piggin
Now the initial C implementation is done, inline more HV code to make rearranging things easier. And rename __kvmhv_vcpu_entry_p9 to drop the leading underscores as it's now C, and is now a more complete vcpu entry. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_book3s_64.h |

[PATCH v2 22/37] KVM: PPC: Book3S HV P9: Reduce irq_work vs guest decrementer races

2021-02-25 Thread Nicholas Piggin
irq_work's use of the DEC SPR is racy with guest<->host switch and guest entry which flips the DEC interrupt to guest, which could lose a host work interrupt. This patch closes one race, and attempts to comment several others. (XXX: should think a bit harder about this) Signed-off-by: Nicholas

Re: [RFC PATCH 5/8] poweprc/lib/quad: Provide macros for lq/stq

2021-02-25 Thread Segher Boessenkool
On Thu, Feb 25, 2021 at 02:10:03PM +1100, Daniel Axtens wrote: > +#define PPC_RAW_LQ(t, a, dq) (0xe000 | ___PPC_RT(t) | > ___PPC_RA(a) | (((dq) & 0xfff) << 3)) Please keep the operand order the same as for the assembler insns? So t,dq,a here. It should be ((dq) & 0x0fff) << 4) .

[PATCH] perf bench numa: Fix the condition checks for max number of numa nodes

2021-02-25 Thread Athira Rajeev
In systems having higher node numbers available like node 255, perf numa bench will fail with SIGABORT. <<>> perf: bench/numa.c:1416: init: Assertion `!(g->p.nr_nodes > 64 || g->p.nr_nodes < 0)' failed. Aborted (core dumped) <<>> Snippet from 'numactl -H' below on a powerpc system where the

[PATCH v2 33/37] KVM: PPC: Book3S HV: small pseries_do_hcall cleanup

2021-02-25 Thread Nicholas Piggin
Functionality should not be changed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 1f27187ff1e7..9d2fa21201c1

[PATCH v2 32/37] KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path

2021-02-25 Thread Nicholas Piggin
The P9 path will run all supported radix guest combinations now, so remove support from the old path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 65 ++--- 1 file changed, 3 insertions(+), 62 deletions(-) diff --git

[PATCH v2 31/37] KVM: PPC: Book3S HV: Remove support for dependent threads mode on P9

2021-02-25 Thread Nicholas Piggin
Radix guest support will be removed from the P7/8 path, so disallow dependent threads mode on P9. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_host.h | 1 - arch/powerpc/kvm/book3s_hv.c| 27 +-- 2 files changed, 5 insertions(+), 23

[PATCH v2 00/37] KVM: PPC: Book3S: C-ify the P9 entry/exit code

2021-02-25 Thread Nicholas Piggin
Since last posting, fixed a bunch of bugs, tidied things up, and ironed out a few issues with XIVE. I also got HPT guest and also host working on the new P9 path, which allows major simplifications to the old path and moving P9 off it completely, so I think that is really worth posting (I thought

[PATCH v2 01/37] KVM: PPC: Book3S 64: remove unused kvmppc_h_protect argument

2021-02-25 Thread Nicholas Piggin
The va argument is not used in the function or set by its asm caller, so remove it to be safe. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_ppc.h | 3 +-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git

[PATCH v2 21/37] powerpc: add set_dec_or_work API for safely updating decrementer

2021-02-25 Thread Nicholas Piggin
Decrementer updates must always check for new irq work to avoid an irq work decrementer interrupt being lost. Add an API for this in the timer code so callers don't have to care about details. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 9 +

[PATCH v2 20/37] KVM: PPC: Book3S HV P9: Reduce mftb per guest entry/exit

2021-02-25 Thread Nicholas Piggin
mftb is serialising (dispatch next-to-complete) so it is heavy weight for a mfspr. Avoid reading it multiple times in the entry or exit paths. A small number of cycles delay to timers is tolerable. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 file changed, 2

Re: [PATCH v2 16/37] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path

2021-02-25 Thread Cédric Le Goater
On 2/25/21 2:46 PM, Nicholas Piggin wrote: > In the interest of minimising the amount of code that is run in > "real-mode", don't handle hcalls in real mode in the P9 path. > > POWER8 and earlier are much more expensive to exit from HV real mode > and switch to host mode, because on those

[PATCH v2 06/37] KVM: PPC: Book3S 64: move KVM interrupt entry to a common entry point

2021-02-25 Thread Nicholas Piggin
Rather than bifurcate the call depending on whether or not HV is possible, and have the HV entry test for PR, just make a single common point which does the demultiplexing. This makes it simpler to add another type of exit handler. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin ---

[PATCH v2 07/37] KVM: PPC: Book3S 64: Move GUEST_MODE_SKIP test into KVM

2021-02-25 Thread Nicholas Piggin
Move the GUEST_MODE_SKIP logic into KVM code. This is quite a KVM internal detail that has no real need to be in common handlers. Also add a comment explaining why this thing exists. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 60

[PATCH v2 05/37] KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR

2021-02-25 Thread Nicholas Piggin
Rather than add the ME bit to the MSR when the guest is entered, make it clear that the hypervisor does not allow the guest to clear the bit. The ME addition is kept in the code for now, but a future patch will warn if it's not present. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin

[PATCH v2 25/37] KVM: PPC: Book3S HV P9: Read machine check registers while MSR[RI] is 0

2021-02-25 Thread Nicholas Piggin
SRR0/1, DAR, DSISR must all be protected from machine check which can clobber them. Ensure MSR[RI] is clear while they are live. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 5 +++-- arch/powerpc/kvm/book3s_hv_interrupt.c | 26 +++---

[PATCH v2 27/37] KVM: PPC: Book3S HV P9: Move SPR loading after expiry time check

2021-02-25 Thread Nicholas Piggin
This is wasted work if the time limit is exceeded. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_interrupt.c | 38 -- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c

[PATCH v2 26/37] KVM: PPC: Book3S HV P9: Improve exit timing accounting coverage

2021-02-25 Thread Nicholas Piggin
The C conversion caused exit timing to become a bit cramped. Expand it to cover more of the entry and exit code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_interrupt.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

Re: [PATCH v2] vio: make remove callback return void

2021-02-25 Thread Arnd Bergmann
On Thu, Feb 25, 2021 at 12:52 PM Michael Ellerman wrote: > > Uwe Kleine-König writes: > > The driver core ignores the return value of struct bus_type::remove() > > because there is only little that can be done. To simplify the quest to > > make this function return void, let struct

[PATCH v2 08/37] KVM: PPC: Book3S 64: add hcall interrupt handler

2021-02-25 Thread Nicholas Piggin
Add a separate hcall entry point. This can be used to deal with the different calling convention. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- arch/powerpc/kvm/book3s_64_entry.S | 6 +- 2 files changed, 7 insertions(+), 3

[PATCH v2 09/37] KVM: PPC: Book3S 64: Move hcall early register setup to KVM

2021-02-25 Thread Nicholas Piggin
System calls / hcalls have a different calling convention than other interrupts, so there is code in the KVMTEST to massage these into the same form as other interrupt handlers. Move this work into the KVM hcall handler. This means teaching KVM a little more about the low level interrupt handler

[PATCH v2 19/37] KVM: PPC: Book3S HV P9: Use host timer accounting to avoid decrementer read

2021-02-25 Thread Nicholas Piggin
There is no need to save away the host DEC value, as it is derived from the host timer subsystem, which maintains the next timer time. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 5 + arch/powerpc/kvm/book3s_hv.c| 12 ++-- 2 files changed, 11

[PATCH v2 18/37] KVM: PPC: Book3S HV P9: Use large decrementer for HDEC

2021-02-25 Thread Nicholas Piggin
On processors that don't suppress the HDEC exceptions when LPCR[HDICE]=0, this could help reduce needless guest exits due to leftover exceptions on entering the guest. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 2 ++ arch/powerpc/kvm/book3s_hv.c| 3 ++- 2 files

[PATCH v2 37/37] KVM: PPC: Book3S HV: remove POWER9 support from P7/8 paths

2021-02-25 Thread Nicholas Piggin
This is dead code now. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 27 +- arch/powerpc/kvm/book3s_hv_interrupts.S | 9 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 404 +--- arch/powerpc/platforms/powernv/idle.c | 52 +-- 4 files

[PATCH v2 36/37] KVM: PPC: Book3S HV P9: implement hash host / hash guest support

2021-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 2 +- arch/powerpc/kvm/book3s_hv_interrupt.c | 75 -- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index

[PATCH v2 16/37] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path

2021-02-25 Thread Nicholas Piggin
In the interest of minimising the amount of code that is run in "real-mode", don't handle hcalls in real mode in the P9 path. POWER8 and earlier are much more expensive to exit from HV real mode and switch to host mode, because on those processors HV interrupts get to the hypervisor with the MMU

[PATCH v2 15/37] KVM: PPC: Book3S HV P9: Move xive vcpu context management into kvmhv_p9_guest_entry

2021-02-25 Thread Nicholas Piggin
Move the xive management up so the low level register switching can be pushed further down in a later patch. XIVE MMIO CI operations can run in higher level code with machine checks, tracing, etc., available. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 7 +++ 1 file

[PATCH v2 17/37] KVM: PPC: Book3S HV P9: Move setting HDEC after switching to guest LPCR

2021-02-25 Thread Nicholas Piggin
LPCR[HDICE]=0 suppresses hypervisor decrementer exceptions on some processors, so it must be enabled before HDEC is set. Rather than set it in the host LPCR then setting HDEC, move the HDEC update to after the guest MMU context (including LPCR) is loaded. There shouldn't be much concern with

[PATCH v2 35/37] KVM: PPC: Book3S HV P9: implement hash guest support

2021-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 20 ++-- arch/powerpc/kvm/book3s_hv_interrupt.c | 123 +--- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 4 + arch/powerpc/kvm/book3s_hv_rmhandlers.S | 14 +-- 4 files changed, 109 insertions(+),

[PATCH v2 34/37] KVM: PPC: Book3S HV: add virtual mode handlers for HPT hcalls and page faults

2021-02-25 Thread Nicholas Piggin
In order to support hash guests in the P9 path (which does not do real mode hcalls or page fault handling), these real-mode hash specific interrupts need to be implemented in virt mode. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 118 +-- 1

Re: [RFC PATCH 4/8] powerpc/ppc_asm: use plain numbers for registers

2021-02-25 Thread Segher Boessenkool
On Thu, Feb 25, 2021 at 02:10:02PM +1100, Daniel Axtens wrote: > This is dumb but makes the llvm integrated assembler happy. > https://github.com/ClangBuiltLinux/linux/issues/764 > -#define r0 %r0 > +#define r0 0 This is a big step back (compare 9a13a524ba37). If you use a

Re: [RFC PATCH 7/8] powerpc/purgatory: drop .machine specifier

2021-02-25 Thread Segher Boessenkool
On Thu, Feb 25, 2021 at 02:10:05PM +1100, Daniel Axtens wrote: > It's ignored by future versions of llvm's integrated assembler (by not -11). > I'm not sure what it does for us in gas. It enables all insns that exist on 620 (the first 64-bit PowerPC CPU). > ---

Re: [RFC PATCH 8/8] powerpc/64/asm: don't reassign labels

2021-02-25 Thread Segher Boessenkool
On Thu, Feb 25, 2021 at 02:10:06PM +1100, Daniel Axtens wrote: > The assembler really does not like us reassigning things to the same > label: > > :7:9: error: invalid reassignment of non-absolute variable > 'fs_label' > > This happens across a bunch of platforms: >

[PATCH v2 10/37] KVM: PPC: Book3S 64: Move interrupt early register setup to KVM

2021-02-25 Thread Nicholas Piggin
Like the earlier patch for hcalls, KVM interrupt entry requires a different calling convention than the Linux interrupt handlers set up. Move the code that converts from one to the other into KVM. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 126

[PATCH v2 12/37] KVM: PPC: Book3S 64: Minimise hcall handler calling convention differences

2021-02-25 Thread Nicholas Piggin
This sets up the same calling convention from interrupt entry to KVM interrupt handler for system calls as exists for other interrupt types. This is a better API, it uses a save area rather than SPR, and it has more registers free to use. Using a single common API helps maintain it, and it

[PATCH v2 11/37] KVM: PPC: Book3S 64: move bad_host_intr check to HV handler

2021-02-25 Thread Nicholas Piggin
This is not used by PR KVM. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_entry.S | 3 --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++- arch/powerpc/kvm/book3s_segment.S | 7 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git

[PATCH v1 07/15] powerpc/uaccess: Remove __unsafe_put_user_goto()

2021-02-25 Thread Christophe Leroy
__unsafe_put_user_goto() is just an intermediate layer to __put_user_size_goto() without added value other than doing the __user pointer type checking. Do the __user pointer type checking in __put_user_size_goto() and remove __unsafe_put_user_goto(). Signed-off-by: Christophe Leroy ---

[PATCH v1 02/15] powerpc/uaccess: Define ___get_user_instr() for ppc32

2021-02-25 Thread Christophe Leroy
Define simple ___get_user_instr() for ppc32 instead of defining ppc32 versions of the three get_user_instr() helpers. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git

[PATCH v1 05/15] powerpc/align: Don't use __get_user_instr() on kernel addresses

2021-02-25 Thread Christophe Leroy
In the old days, when we didn't have kernel userspace access protection and had set_fs(), it was wise to use __get_user() and friends to read kernel memory. Nowadays, get_user() is granting userspace access and is exclusively for userspace access. In alignment exception handler, use

[PATCH v1 06/15] powerpc/uaccess: Call might_fault() inconditionaly

2021-02-25 Thread Christophe Leroy
Commit 6bfd93c32a50 ("powerpc: Fix incorrect might_sleep in __get_user/__put_user on kernel addresses") added a check to not call might_sleep() on kernel addresses. This was to enable the use of __get_user() in the alignment exception handler for any address. Then commit 95156f0051cb ("lockdep,

[PATCH next v3 11/15] printk: kmsg_dumper: remove @active field

2021-02-25 Thread John Ogness
All 6 kmsg_dumpers do not benefit from the @active flag: (provide their own synchronization) - arch/powerpc/kernel/nvram_64.c - arch/um/kernel/kmsg_dump.c - drivers/mtd/mtdoops.c - fs/pstore/platform.c (only dump on KMSG_DUMP_PANIC, which does not require synchronization) -

[PATCH next v3 14/15] printk: kmsg_dump: remove _nolock() variants

2021-02-25 Thread John Ogness
kmsg_dump_rewind() and kmsg_dump_get_line() are lockless, so there is no need for _nolock() variants. Remove these functions and switch all callers of the _nolock() variants. The functions without _nolock() were chosen because they are already exported to kernel modules. Signed-off-by: John

[PATCH next v3 00/15] printk: remove logbuf_lock

2021-02-25 Thread John Ogness
the kmsg_dump semantics in general. This series is based on next-20210225. Changes since v2: - use get_maintainer.pl to get the full list of developers that should at least see the changes in their respective areas - do not disable interrupts in arch/um kmsg_dumper (because there is no need

Re: [PATCH] docs: powerpc: Fix tables in syscall64-abi.rst

2021-02-25 Thread Jonathan Corbet
Andrew Donnellan writes: > Commit 209b44c804c ("docs: powerpc: syscall64-abi.rst: fix a malformed > table") attempted to fix the formatting of tables in syscall64-abi.rst, but > inadvertently changed some register names. > > Redo the tables with the correct register names, and while we're here,

[PATCH next v3 12/15] printk: introduce a kmsg_dump iterator

2021-02-25 Thread John Ogness
Rather than storing the iterator information in the registered kmsg_dumper structure, create a separate iterator structure. The kmsg_dump_iter structure can reside on the stack of the caller, thus allowing lockless use of the kmsg_dump functions. This change also means that the kmsg_dumper dump()

[PATCH v2 2/5] ibmvfc: fix invalid sub-CRQ handles after hard reset

2021-02-25 Thread Tyrel Datwyler
A hard reset results in a complete transport disconnect such that the CRQ connection with the partner VIOS is broken. This has the side effect of also invalidating the associated sub-CRQs. The current code assumes that the sub-CRQs are perserved resulting in a protocol violation after trying to

[PATCH v2 1/5] ibmvfc: simplify handling of sub-CRQ initialization

2021-02-25 Thread Tyrel Datwyler
If ibmvfc_init_sub_crqs() fails ibmvfc_probe() simply parrots registration failure reported elsewhere, and futher vhost->scsi_scrq.scrq == NULL is indication enough to the driver that it has no sub-CRQs available. The mq_enabled check can also be moved into ibmvfc_init_sub_crqs() such that each

[PATCH v2 4/5] ibmvfc: store return code of H_FREE_SUB_CRQ during cleanup

2021-02-25 Thread Tyrel Datwyler
The H_FREE_SUB_CRQ hypercall can return a retry delay return code that indicates the call needs to be retried after a specific amount of time delay. The error path to free a sub-CRQ in case of a failure during channel registration fails to capture the return code of H_FREE_SUB_CRQ which will

[PATCH v2 0/5] ibmvfc: hard reset fixes

2021-02-25 Thread Tyrel Datwyler
This series contains a minor simplification of ibmvfc_init_sub_crqs() followed by a couple fixes for sub-CRQ handling which effect hard reset of the client/host adapter CRQ pair. changes in v2: * added Reviewed-by tags for patches 1-3 * Patch 4: use rtas_busy_delay to test rc and delay correct

Freeing page tables through RCU

2021-02-25 Thread Matthew Wilcox
In order to walk the page tables without the mmap semaphore, it must be possible to prevent them from being freed and reused (eg if munmap() races with viewing /proc/$pid/smaps). There is various commentary within the mm on how to prevent this. One way is to disable interrupts, relying on that

Re: [PATCH v2 5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM

2021-02-25 Thread Brian King
On 2/25/21 2:48 PM, Tyrel Datwyler wrote: > A live partition migration (LPM) results in a CRQ disconnect similar to > a hard reset. In this LPM case the hypervisor moslty perserves the CRQ > transport such that it simply needs to be reenabled. However, the > capabilities may have changed such as

[PATCH v1 00/15] powerpc: Cleanup of uaccess.h

2021-02-25 Thread Christophe Leroy
This series cleans up uaccess.h Christophe Leroy (15): powerpc/uaccess: Remove __get_user_allowed() and unsafe_op_wrap() powerpc/uaccess: Define ___get_user_instr() for ppc32 powerpc/uaccess: Remove __get/put_user_inatomic() powerpc/uaccess: Move get_user_instr helpers in asm/inst.h

[PATCH v1 03/15] powerpc/uaccess: Remove __get/put_user_inatomic()

2021-02-25 Thread Christophe Leroy
Since commit 662bbcb2747c ("mm, sched: Allow uaccess in atomic with pagefault_disable()"), __get/put_user() can be used in atomic parts of the code, therefore the __get/put_user_inatomic() introduced by commit e68c825bb016 ("[POWERPC] Add inatomic versions of __get_user and __put_user") have

[PATCH v1 04/15] powerpc/uaccess: Move get_user_instr helpers in asm/inst.h

2021-02-25 Thread Christophe Leroy
Those helpers use get_user helpers but they don't participate in their implementation, so they do not belong to asm/uaccess.h Move them in asm/inst.h Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/inst.h| 34 ++ arch/powerpc/include/asm/uaccess.h |

[PATCH v1 01/15] powerpc/uaccess: Remove __get_user_allowed() and unsafe_op_wrap()

2021-02-25 Thread Christophe Leroy
Those two macros have only one user which is unsafe_get_user(). Put everything in one place and remove them. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h

Re: [PATCH v2 5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM

2021-02-25 Thread Tyrel Datwyler
On 2/25/21 12:48 PM, Tyrel Datwyler wrote: > A live partition migration (LPM) results in a CRQ disconnect similar to > a hard reset. In this LPM case the hypervisor moslty perserves the CRQ > transport such that it simply needs to be reenabled. However, the > capabilities may have changed such as

[PATCH v1 13/15] powerpc/uaccess: Swap clear_user() and __clear_user()

2021-02-25 Thread Christophe Leroy
It is clear_user() which is expected to call __clear_user(), not the reverse. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h

[PATCH v1 15/15] powerpc/uaccess: Move copy_mc_xxx() functions down

2021-02-25 Thread Christophe Leroy
copy_mc_xxx() functions are in the middle of raw_copy functions. For clarity, move them out of the raw_copy functions block. They are using access_ok, so they need to be after the general functions in order to eventually allow the inclusion of asm-generic/uaccess.h in some future.

Re: [PATCH v2 4/5] ibmvfc: store return code of H_FREE_SUB_CRQ during cleanup

2021-02-25 Thread Brian King
Reviewed-by: Brian King -- Brian King Power Linux I/O IBM Linux Technology Center

[PATCH v1 09/15] powerpc/uaccess: Remove calls to __get_user_bad() and __put_user_bad()

2021-02-25 Thread Christophe Leroy
__get_user_bad() and __put_user_bad() are functions that are declared but not defined, in order to make the build fails in case they are called. Nowadays, we have BUILD_BUG() and BUILD_BUG_ON() for that. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 11 +++ 1

[PATCH v1 10/15] powerpc/uaccess: Split out __get_user_nocheck()

2021-02-25 Thread Christophe Leroy
One part of __get_user_nocheck() is used for __get_user(), the other part for unsafe_get_user(). Move the part dedicated to unsafe_get_user() in it. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 22 -- 1 file changed, 12 insertions(+), 10

[PATCH v1 11/15] powerpc/uaccess: Rename __get/put_user_check/nocheck

2021-02-25 Thread Christophe Leroy
__get_user_check() becomes get_user() __put_user_check() becomes put_user() __get_user_nocheck() becomes __get_user() __put_user_nocheck() becomes __put_user() Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 30 ++ 1 file changed, 10

[PATCH v1 08/15] powerpc/uaccess: Remove __chk_user_ptr() in __get/put_user

2021-02-25 Thread Christophe Leroy
Commit d02f6b7dab82 ("powerpc/uaccess: Evaluate macro arguments once, before user access is allowed") changed the __chk_user_ptr() argument from the passed ptr pointer to the locally declared __gu_addr. But __gu_addr is locally defined as __user so the check is pointless. During kernel build

[PATCH v1 14/15] powerpc/uaccess: Also perform 64 bits copies in unsafe_copy_to_user() on ppc32

2021-02-25 Thread Christophe Leroy
ppc32 has an efficiant 64 bits __put_user(), so also use it in order to unroll loops more. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h

[PATCH v1 12/15] powerpc/uaccess: Refactor get/put_user() and __get/put_user()

2021-02-25 Thread Christophe Leroy
Make get_user() do the access_ok() check then call __get_user(). Make put_user() do the access_ok() check then call __put_user(). Then embed __get_user_size() and __put_user_size() in __get_user() and __put_user(). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 66

[PATCH v2 5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM

2021-02-25 Thread Tyrel Datwyler
A live partition migration (LPM) results in a CRQ disconnect similar to a hard reset. In this LPM case the hypervisor moslty perserves the CRQ transport such that it simply needs to be reenabled. However, the capabilities may have changed such as fewer channels, or no channels at all. Further, its

[PATCH v2 3/5] ibmvfc: treat H_CLOSED as success during sub-CRQ registration

2021-02-25 Thread Tyrel Datwyler
A non-zero return code for H_REG_SUB_CRQ is currently treated as a failure resulting in failing sub-CRQ setup. The case of H_CLOSED should not be treated as a failure. This return code translates to a successful sub-CRQ registration by the hypervisor, and is meant to communicate back that there is

Re: [PATCH v2 04/37] powerpc/64s: remove KVM SKIP test from instruction breakpoint handler

2021-02-25 Thread Daniel Axtens
Nicholas Piggin writes: > The code being executed in KVM_GUEST_MODE_SKIP is hypervisor code with > MSR[IR]=0, so the faults of concern are the d-side ones caused by access > to guest context by the hypervisor. > > Instruction breakpoint interrupts are not a concern here. It's unlikely > any good

Re: [PATCH v2 01/37] KVM: PPC: Book3S 64: remove unused kvmppc_h_protect argument

2021-02-25 Thread Daniel Axtens
Hi Nick, > The va argument is not used in the function or set by its asm caller, > so remove it to be safe. Huh, so it isn't. I tracked the original implementation down to commit a8606e20e41a ("KVM: PPC: Handle some PAPR hcalls in the kernel") where paulus first added the ability to handle it in

Re: [PATCH v4 12/14] swiotlb: Add restricted DMA alloc/free support.

2021-02-25 Thread Christoph Hellwig
On Fri, Feb 26, 2021 at 12:17:50PM +0800, Claire Chang wrote: > Do you think I should fix this and rebase on the latest linux-next > now? I wonder if there are more factor and clean up coming and I > should wait after that. Here is my preferred plan: 1) wait for my series to support the min

[PATCH v3 2/5] ibmvfc: fix invalid sub-CRQ handles after hard reset

2021-02-25 Thread Tyrel Datwyler
A hard reset results in a complete transport disconnect such that the CRQ connection with the partner VIOS is broken. This has the side effect of also invalidating the associated sub-CRQs. The current code assumes that the sub-CRQs are perserved resulting in a protocol violation after trying to

[PATCH v3 1/5] ibmvfc: simplify handling of sub-CRQ initialization

2021-02-25 Thread Tyrel Datwyler
If ibmvfc_init_sub_crqs() fails ibmvfc_probe() simply parrots registration failure reported elsewhere, and futher vhost->scsi_scrq.scrq == NULL is indication enough to the driver that it has no sub-CRQs available. The mq_enabled check can also be moved into ibmvfc_init_sub_crqs() such that each

Re: [RFC PATCH 5/8] poweprc/lib/quad: Provide macros for lq/stq

2021-02-25 Thread Daniel Axtens
Segher Boessenkool writes: > On Thu, Feb 25, 2021 at 02:10:03PM +1100, Daniel Axtens wrote: >> +#define PPC_RAW_LQ(t, a, dq)(0xe000 | ___PPC_RT(t) | >> ___PPC_RA(a) | (((dq) & 0xfff) << 3)) > > Please keep the operand order the same as for the assembler insns? So > t,dq,a

Re: [RFC PATCH 7/8] powerpc/purgatory: drop .machine specifier

2021-02-25 Thread Daniel Axtens
Segher Boessenkool writes: > On Thu, Feb 25, 2021 at 02:10:05PM +1100, Daniel Axtens wrote: >> It's ignored by future versions of llvm's integrated assembler (by not -11). >> I'm not sure what it does for us in gas. > > It enables all insns that exist on 620 (the first 64-bit PowerPC CPU). > >>

Re: [PATCH v2 02/37] KVM: PPC: Book3S HV: Fix CONFIG_SPAPR_TCE_IOMMU=n default hcalls

2021-02-25 Thread Daniel Axtens
Hi Nick, > This config option causes the warning in init_default_hcalls to fire > because the TCE handlers are in the default hcall list but not > implemented. I checked that the TCE handlers are indeed not defined unless CONFIG_SPAPR_TCE_IOMMU=y, and so I can see how you would hit the warning.

[PATCH V2 1/2] powerpc/perf: Infrastructure to support checking of attr.config*

2021-02-25 Thread Madhavan Srinivasan
Introduce code to support the checking of attr.config* for values which are reserved for a given platform. Performance Monitoring Unit (PMU) configuration registers have fields that are reserved and specific value to bit field as reserved. For ex., MMCRA[61:62] is Randome Sampling Mode (SM) and

[PATCH V2 2/2] powerpc/perf: Add platform specific check_attr_config

2021-02-25 Thread Madhavan Srinivasan
Add platform specific attr.config value checks. Patch includes checks for both power9 and power10. Signed-off-by: Madhavan Srinivasan --- Changelog v1: - No changes. arch/powerpc/perf/isa207-common.c | 41 +++ arch/powerpc/perf/isa207-common.h | 2 ++

Re: [PATCH v4 12/14] swiotlb: Add restricted DMA alloc/free support.

2021-02-25 Thread Claire Chang
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index fd9c1bd183ac..8b77fd64199e 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c > @@ -836,6 +836,40 @@ late_initcall(swiotlb_create_default_debugfs); > #endif > > #ifdef CONFIG_DMA_RESTRICTED_POOL > +struct page

Re: [PATCH v2 05/37] KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR

2021-02-25 Thread Daniel Axtens
Hi Nick, > void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) > { > + /* > + * Guest must always run with machine check interrupt > + * enabled. > + */ > + if (!(msr & MSR_ME)) > + msr |= MSR_ME; This 'if' is technically redundant but you mention a future

Re: [PATCH next v3 12/15] printk: introduce a kmsg_dump iterator

2021-02-25 Thread John Ogness
team. But most likely we will just re-instate the dumper parameter in the callback. I apologize for the lack of care on my part. John Ogness On 2021-02-26, kernel test robot wrote: > Hi John, > > I love your patch! Yet something to improve: > > [auto build test ERROR on next-20

[PATCH v3 3/5] ibmvfc: treat H_CLOSED as success during sub-CRQ registration

2021-02-25 Thread Tyrel Datwyler
A non-zero return code for H_REG_SUB_CRQ is currently treated as a failure resulting in failing sub-CRQ setup. The case of H_CLOSED should not be treated as a failure. This return code translates to a successful sub-CRQ registration by the hypervisor, and is meant to communicate back that there is

[PATCH v3 0/5] ibmvfc: hard reset fixes

2021-02-25 Thread Tyrel Datwyler
This series contains a minor simplification of ibmvfc_init_sub_crqs() followed by a couple fixes for sub-CRQ handling which effect hard reset of the client/host adapter CRQ pair. changes in v3: * Patch 1 & 5: moved ibmvfc_init_sub_crqs out of locked patch changes in v2: * added Reviewed-by tags

[PATCH v4 3/5] ibmvfc: treat H_CLOSED as success during sub-CRQ registration

2021-02-25 Thread Tyrel Datwyler
A non-zero return code for H_REG_SUB_CRQ is currently treated as a failure resulting in failing sub-CRQ setup. The case of H_CLOSED should not be treated as a failure. This return code translates to a successful sub-CRQ registration by the hypervisor, and is meant to communicate back that there is

[PATCH v4 0/5] ibmvfc: hard reset fixes

2021-02-25 Thread Tyrel Datwyler
This series contains a minor simplification of ibmvfc_init_sub_crqs() followed by a couple fixes for sub-CRQ handling which effect hard reset of the client/host adapter CRQ pair. changes in v4: Patch 2: dropped Reviewed-by tag and moved sub-crq init to after locked region Patch 5: moved sub-crq

[PATCH v4 4/5] ibmvfc: store return code of H_FREE_SUB_CRQ during cleanup

2021-02-25 Thread Tyrel Datwyler
The H_FREE_SUB_CRQ hypercall can return a retry delay return code that indicates the call needs to be retried after a specific amount of time delay. The error path to free a sub-CRQ in case of a failure during channel registration fails to capture the return code of H_FREE_SUB_CRQ which will

[PATCH v2] vio: make remove callback return void

2021-02-25 Thread Uwe Kleine-König
The driver core ignores the return value of struct bus_type::remove() because there is only little that can be done. To simplify the quest to make this function return void, let struct vio_driver::remove() return void, too. All users already unconditionally return 0, this commit makes it obvious

[PATCH v1] powerpc: low_i2c: change @lock to raw_spinlock_t

2021-02-25 Thread John Ogness
i2c transfers are occurring with local interrupts disabled: smp_core99_give_timebase() local_irq_save(); smp_core99_cypress_tb_freeze() pmac_i2c_xfer() kw_i2c_xfer() spin_lock_irqsave(>lock, flags) This is a problem because with PREEMPT_RT a spinlock_t can sleep, causing

Re: [RFC PATCH 4/8] powerpc/ppc_asm: use plain numbers for registers

2021-02-25 Thread Daniel Axtens
Segher Boessenkool writes: > On Thu, Feb 25, 2021 at 02:10:02PM +1100, Daniel Axtens wrote: >> This is dumb but makes the llvm integrated assembler happy. >> https://github.com/ClangBuiltLinux/linux/issues/764 > >> -#define r0 %r0 > >> +#define r0 0 > > This is a big step back

[PATCH v3 5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM

2021-02-25 Thread Tyrel Datwyler
A live partition migration (LPM) results in a CRQ disconnect similar to a hard reset. In this LPM case the hypervisor moslty perserves the CRQ transport such that it simply needs to be reenabled. However, the capabilities may have changed such as fewer channels, or no channels at all. Further, its

[PATCH v3 4/5] ibmvfc: store return code of H_FREE_SUB_CRQ during cleanup

2021-02-25 Thread Tyrel Datwyler
The H_FREE_SUB_CRQ hypercall can return a retry delay return code that indicates the call needs to be retried after a specific amount of time delay. The error path to free a sub-CRQ in case of a failure during channel registration fails to capture the return code of H_FREE_SUB_CRQ which will

[PATCH v4 1/5] ibmvfc: simplify handling of sub-CRQ initialization

2021-02-25 Thread Tyrel Datwyler
If ibmvfc_init_sub_crqs() fails ibmvfc_probe() simply parrots registration failure reported elsewhere, and futher vhost->scsi_scrq.scrq == NULL is indication enough to the driver that it has no sub-CRQs available. The mq_enabled check can also be moved into ibmvfc_init_sub_crqs() such that each

  1   2   >