Re: [PATCH v3] powerpc/32: Add support for out-of-line static calls

2021-09-01 Thread Peter Zijlstra
On Wed, Sep 01, 2021 at 08:30:21AM +, Christophe Leroy wrote: > Add support for out-of-line static calls on PPC32. This change > improve performance of calls to global function pointers by > using direct calls instead of indirect calls. > > The trampoline is initialy populated with a 'blr' or

Re: [PATCH] powerpc/bug: Cast to unsigned long before passing to inline asm

2021-09-01 Thread Michael Ellerman
Segher Boessenkool writes: > On Tue, Aug 31, 2021 at 11:27:20PM +1000, Michael Ellerman wrote: >> Nathan filed an LLVM bug [2], in which Eli Friedman explained that "if >> you pass a value of a type that's narrower than a register to an inline >> asm, the high bits are undefined". In this case we

[PATCH kernel] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST

2021-09-01 Thread Alexey Kardashevskiy
H_COPY_TOFROM_GUEST is an hcall for an upper level VM to access its nested VMs memory. The userspace can trigger WARN_ON_ONCE(!(gfp & __GFP_NOWARN)) in __alloc_pages() by constructing a tiny VM which only does H_COPY_TOFROM_GUEST with a too big GPR9 (number of bytes to copy). This silences the

[PATCH kernel] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots

2021-09-01 Thread Alexey Kardashevskiy
The userspace can trigger "vmalloc size %lu allocation failure: exceeds total pages" via the KVM_SET_USER_MEMORY_REGION ioctl. This silences the warning by checking the limit before calling vzalloc() and returns ENOMEM if failed. This does not call underlying valloc helpers as __vmalloc_node()

[PATCH v3] powerpc/32: Add support for out-of-line static calls

2021-09-01 Thread Christophe Leroy
Add support for out-of-line static calls on PPC32. This change improve performance of calls to global function pointers by using direct calls instead of indirect calls. The trampoline is initialy populated with a 'blr' or branch to target, followed by an unreachable long jump sequence. In order

Re: [PATCH kernel] KVM: PPC: Book3S HV: Make unique debugfs nodename

2021-09-01 Thread Alexey Kardashevskiy
On 24/08/2021 18:37, Alexey Kardashevskiy wrote: On 18/08/2021 08:20, Fabiano Rosas wrote: Alexey Kardashevskiy writes: On 07/07/2021 14:13, Alexey Kardashevskiy wrote: alternatively move this debugfs stuff under the platform-independent directory, how about that? That's a good

[next-20210827][ppc][multipathd] INFO: task hung in dm_table_add_target

2021-09-01 Thread Abdul Haleem
Greeting's multiple task hung while adding the vfc disk back to the multipath on my powerpc box running linux-next kernel Test: $ multipathd -k"remove path sde" $ multipathd -k"add path sde" After above command multipathd task hung with continuous call traces on console, it requires reboot

[PATCH v2] powerpc/bug: Cast to unsigned long before passing to inline asm

2021-09-01 Thread Michael Ellerman
In commit 1e688dd2a3d6 ("powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto") we changed WARN_ON(). Previously it would take the warning condition, x, and double negate it before converting the result to int, and passing that int to the underlying inline asm. ie:

Re: [PATCH v2 3/3] powerpc/numa: Fill distance_lookup_table for offline nodes

2021-09-01 Thread Srikar Dronamraju
* Michael Ellerman [2021-08-26 23:36:53]: > Srikar Dronamraju writes: > > Scheduler expects unique number of node distances to be available at > > boot. > > I think it needs "the number of unique node distances" ? > > > It uses node distance to calculate this unique node distances. > > It

Re: [next-20210820][ppc][nvme/raid] pci unbind WARNS at fs/kernfs/dir.c:1524 kernfs_remove_by_name_ns+

2021-09-01 Thread Abdul Haleem
Thanks Christoph, The problem is fixed with below commit and tested on next-20210823 Tested-by: Abdul Haleem On 8/26/21 10:00 PM, Christoph Hellwig wrote: Are you sure this is the very latest linux-next? This should hav been fixed by: "block: add back the bd_holder_dir reference in

[PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-01 Thread Nicholas Piggin
If a system call is made with a transaction active, the kernel immediately aborts it and returns. scv system calls disable irqs even earlier in their interrupt handler, and tabort_syscall does not fix this up. This can result in irq soft-mask state being messed up on the next kernel entry, and

[PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Nicholas Piggin
The basic TM vs syscall test code hard codes an sc instruction for the system call, which fails to cover scv even when the userspace libc has support for it. Duplicate the tests with hard coded scv variants so both are tested when possible. Signed-off-by: Nicholas Piggin ---

Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Christophe Leroy
Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : The basic TM vs syscall test code hard codes an sc instruction for the system call, which fails to cover scv even when the userspace libc has support for it. Duplicate the tests with hard coded scv variants so both are tested when possible.

Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-01 Thread Christophe Leroy
Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : If a system call is made with a transaction active, the kernel immediately aborts it and returns. scv system calls disable irqs even earlier in their interrupt handler, and tabort_syscall does not fix this up. This can result in irq soft-mask

Re: [next-20210827][ppc][multipathd] INFO: task hung in dm_table_add_target

2021-09-01 Thread Christoph Hellwig
On Wed, Sep 01, 2021 at 04:47:26PM +0530, Abdul Haleem wrote: > Greeting's > > multiple task hung while adding the vfc disk back to the multipath on my > powerpc box running linux-next kernel Can you retry to reproduce this with lockdep enabled to see if there is anything interesting holding

Re: [PATCH kernel] KVM: PPC: Book3S HV: Make unique debugfs nodename

2021-09-01 Thread Fabiano Rosas
Alexey Kardashevskiy writes: > On 24/08/2021 18:37, Alexey Kardashevskiy wrote: >> >> >> On 18/08/2021 08:20, Fabiano Rosas wrote: >>> Alexey Kardashevskiy writes: >>> On 07/07/2021 14:13, Alexey Kardashevskiy wrote: >>> alternatively move this debugfs stuff under the

Re: [PATCH kernel] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST

2021-09-01 Thread Fabiano Rosas
Alexey Kardashevskiy writes: > H_COPY_TOFROM_GUEST is an hcall for an upper level VM to access its nested > VMs memory. The userspace can trigger WARN_ON_ONCE(!(gfp & __GFP_NOWARN)) > in __alloc_pages() by constructing a tiny VM which only does > H_COPY_TOFROM_GUEST with a too big GPR9 (number

Re: [PATCH] powerpc/bug: Cast to unsigned long before passing to inline asm

2021-09-01 Thread Segher Boessenkool
On Wed, Sep 01, 2021 at 05:17:26PM +1000, Michael Ellerman wrote: > Segher Boessenkool writes: > > On Tue, Aug 31, 2021 at 11:27:20PM +1000, Michael Ellerman wrote: > >> Nathan filed an LLVM bug [2], in which Eli Friedman explained that "if > >> you pass a value of a type that's narrower than a

Re: [PATCH kernel] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots

2021-09-01 Thread Fabiano Rosas
Alexey Kardashevskiy writes: > The userspace can trigger "vmalloc size %lu allocation failure: exceeds > total pages" via the KVM_SET_USER_MEMORY_REGION ioctl. > > This silences the warning by checking the limit before calling vzalloc() > and returns ENOMEM if failed. > > This does not call

Re: [PATCH kernel] KVM: PPC: Book3S HV: Make unique debugfs nodename

2021-09-01 Thread Fabiano Rosas
Fabiano Rosas writes: > That is why I mentioned creating a hook similar to > kvm_create_vcpu_debugfs in the common KVM code. kvm_create_vm_debugfs or > something. s/kvm/kvm_arch/

[PATCH v1 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Nicholas Piggin
The basic TM vs syscall test code hard codes an sc instruction for the system call, which fails to cover scv even when the userspace libc has support for it. Duplicate the tests with hard coded scv variants so both are tested when possible. Signed-off-by: Nicholas Piggin ---

[PATCH v1 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-01 Thread Nicholas Piggin
If a system call is made with a transaction active, the kernel immediately aborts it and returns. scv system calls disable irqs even earlier in their interrupt handler, and tabort_syscall does not fix this up. This can result in irq soft-mask state being messed up on the next kernel entry, and

[PATCH 04/10] ps3vram: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/ps3vram.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/ps3vram.c

[PATCH 02/10] pktcdvd: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. The out_mem2 error label already does what we need so re-use that. Signed-off-by: Luis Chamberlain --- drivers/block/pktcdvd.c | 4 +++- 1 file changed, 3

[PATCH 08/10] block/sx8: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. A completion is used to notify the initial probe what is happening and so we must defer error handling on completion. Do this by remembering the error and using the

[PATCH 09/10] pf: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/paride/pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/paride/pf.c

[PATCH v3 5/5] KVM: selftests: Remove __NR_userfaultfd syscall fallback

2021-09-01 Thread Sean Christopherson
Revert the __NR_userfaultfd syscall fallback added for KVM selftests now that x86's unistd_{32,63}.h overrides are under uapi/ and thus not in KVM sefltests' search path, i.e. now that KVM gets x86 syscall numbers from the installed kernel headers. No functional change intended. Reviewed-by: Ben

[PATCH 10/10] mtd/ubi/block: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/mtd/ubi/block.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c

[PATCH 03/10] ps3disk: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/ps3disk.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/block/ps3disk.c

[PATCH 07/10] block/sunvdc: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. We re-use the same free tag call, so we also add a label for that as well. Signed-off-by: Luis Chamberlain --- drivers/block/sunvdc.c | 14 +++--- 1 file

[PATCH 05/10] rnbd: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/rnbd/rnbd-clt.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git

Re: [GIT PULL] retire legacy WR sbc8548 and sbc8641 platforms

2021-09-01 Thread Paul Gortmaker
[Re: [GIT PULL] retire legacy WR sbc8548 and sbc8641 platforms] On 27/08/2021 (Fri 01:05) Michael Ellerman wrote: > Paul Gortmaker writes: > > This is unchanged from the original wr_sbc-delete branch sent in January, > > other than to add the Acks from Scott in July, and update the baseline. >

[PATCH v3 4/5] KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs

2021-09-01 Thread Sean Christopherson
Add a test to verify an rseq's CPU ID is updated correctly if the task is migrated while the kernel is handling KVM_RUN. This is a regression test for a bug introduced by commit 72c3c0fe54a3 ("x86/kvm: Use generic xfer to guest work function"), where TIF_NOTIFY_RESUME would be cleared by KVM

[PATCH v3 2/5] entry: rseq: Call rseq_handle_notify_resume() in tracehook_notify_resume()

2021-09-01 Thread Sean Christopherson
Invoke rseq_handle_notify_resume() from tracehook_notify_resume() now that the two function are always called back-to-back by architectures that have rseq. The rseq helper is stubbed out for architectures that don't support rseq, i.e. this is a nop across the board. Note,

[PATCH v3 3/5] tools: Move x86 syscall number fallbacks to .../uapi/

2021-09-01 Thread Sean Christopherson
Move unistd_{32,64}.h from x86/include/asm to x86/include/uapi/asm so that tools/selftests that install kernel headers, e.g. KVM selftests, can include non-uapi tools headers, e.g. to get 'struct list_head', without effectively overriding the installed non-tool uapi headers. Swapping KVM's search

Re: [PATCH 0/5] KVM: PPC: Book3S: Modules cleanup and unification

2021-09-01 Thread David Gibson
On Wed, Sep 01, 2021 at 02:33:52PM -0300, Fabiano Rosas wrote: > This series merges our three kvm modules kvm.ko, kvm-hv.ko and > kvm-pr.ko into one kvm.ko module. That doesn't sound like a good idea to me. People who aren't on BookS servers don't want - and can't use - kvm-hv. Almost nobody

[PATCH 06/10] block/rsxx: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/rsxx/core.c | 4 +++- drivers/block/rsxx/dev.c | 12 +--- 2 files changed, 12 insertions(+), 4

[PATCH 00/10] block: fourth batch of add_disk() error handling conversions

2021-09-01 Thread Luis Chamberlain
The full set of changes can be found on my branch titled 20210901-for-axboe-add-disk-error-handling [0] which is now based on axboe/master. [0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20210901-for-axboe-add-disk-error-handling Luis Chamberlain (10

[PATCH 01/10] mtip32xx: add error handling support for add_disk()

2021-09-01 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. The read_capacity_error error label already does what we need, so just re-use that. Signed-off-by: Luis Chamberlain --- drivers/block/mtip32xx/mtip32xx.c | 4 +++-

[PATCH v3 1/5] KVM: rseq: Update rseq when processing NOTIFY_RESUME on xfer to KVM guest

2021-09-01 Thread Sean Christopherson
Invoke rseq's NOTIFY_RESUME handler when processing the flag prior to transferring to a KVM guest, which is roughly equivalent to an exit to userspace and processes many of the same pending actions. While the task cannot be in an rseq critical section as the KVM path is reachable only by via

[PATCH v3 0/5] KVM: rseq: Fix and a test for a KVM+rseq bug

2021-09-01 Thread Sean Christopherson
Patch 1 fixes a KVM+rseq bug where KVM's handling of TIF_NOTIFY_RESUME, e.g. for task migration, clears the flag without informing rseq and leads to stale data in userspace's rseq struct. Patch 2 is a cleanup to try and make future bugs less likely. It's also a baby step towards moving and

Re: [PATCH kernel] KVM: PPC: Book3S HV: Make unique debugfs nodename

2021-09-01 Thread Alexey Kardashevskiy
On 02/09/2021 00:23, Fabiano Rosas wrote: Alexey Kardashevskiy writes: On 24/08/2021 18:37, Alexey Kardashevskiy wrote: On 18/08/2021 08:20, Fabiano Rosas wrote: Alexey Kardashevskiy writes: On 07/07/2021 14:13, Alexey Kardashevskiy wrote: alternatively move this debugfs stuff

Re: [PATCH kernel] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots

2021-09-01 Thread Alexey Kardashevskiy
On 02/09/2021 00:59, Fabiano Rosas wrote: Alexey Kardashevskiy writes: The userspace can trigger "vmalloc size %lu allocation failure: exceeds total pages" via the KVM_SET_USER_MEMORY_REGION ioctl. This silences the warning by checking the limit before calling vzalloc() and returns ENOMEM

Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 2, 2021 3:15 am: > > > Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : >> The basic TM vs syscall test code hard codes an sc instruction for the >> system call, which fails to cover scv even when the userspace libc has >> support for it. >>

Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-01 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of September 2, 2021 3:21 am: > > > Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : >> If a system call is made with a transaction active, the kernel >> immediately aborts it and returns. scv system calls disable irqs even >> earlier in their interrupt

Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Michael Ellerman
Nicholas Piggin writes: > Excerpts from Christophe Leroy's message of September 2, 2021 3:15 am: >> Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : >>> The basic TM vs syscall test code hard codes an sc instruction for the >>> system call, which fails to cover scv even when the userspace libc

Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Michael Ellerman
Nicholas Piggin writes: > The basic TM vs syscall test code hard codes an sc instruction for the > system call, which fails to cover scv even when the userspace libc has > support for it. > > Duplicate the tests with hard coded scv variants so both are tested > when possible. > > Signed-off-by:

Re: [PATCH 05/10] rnbd: add error handling support for add_disk()

2021-09-01 Thread Jinpu Wang
On Wed, Sep 1, 2021 at 11:01 PM Luis Chamberlain wrote: > > We never checked for errors on add_disk() as this function > returned void. Now that this is fixed, use the shiny new > error handling. > > Signed-off-by: Luis Chamberlain looks good to me. Acked-by: Jack Wang > --- >

[PATCH 0/5] KVM: PPC: Book3S: Modules cleanup and unification

2021-09-01 Thread Fabiano Rosas
This series merges our three kvm modules kvm.ko, kvm-hv.ko and kvm-pr.ko into one kvm.ko module. The main reason for this is to deal with the issue that kvm.ko can be loaded on its own without any of the other modules present. This can happen if one or both of the modules fail to init or if the

[PATCH 3/5] KVM: PPC: Book3S HV: Free allocated memory if module init fails

2021-09-01 Thread Fabiano Rosas
The module's exit function is not called when the init fails, we need to do cleanup before returning. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s_hv.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c

[PATCH 4/5] KVM: PPC: Book3S: Unify kvm-hv and kvm-pr modules

2021-09-01 Thread Fabiano Rosas
Our three virtualization modules (kvm, kvm-hv, kvm-pr) can be loaded/unloaded in such a way that could leave kvm.ko loaded without kvm-hv.ko or kvm-pr.ko. That means the userspace could continue to issue ioctls to KVM while there is no code on our side to service them. We currently select at

[PATCH 5/5] KVM: PPC: Book3S: Stop exporting non-builtin symbols

2021-09-01 Thread Fabiano Rosas
Now that we have only one kvm module, we can stop exporting some symbols. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s.c | 15 --- arch/powerpc/kvm/book3s_64_mmu_radix.c | 3 --- arch/powerpc/kvm/book3s_64_vio.c | 3 ---

[PATCH 1/5] KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init

2021-09-01 Thread Fabiano Rosas
The return of the function is being shadowed by the call to kvmppc_uvmem_init. Fixes: ca9f4942670c ("KVM: PPC: Book3S HV: Support for running secure guests") Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s_hv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH 2/5] KVM: PPC: Book3S HV: Delay setting of kvm ops

2021-09-01 Thread Fabiano Rosas
Delay the setting of kvm_hv_ops until after all init code has completed. This avoids leaving the ops still accessible if the init fails. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s_hv.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git