Re: [PATCH 07/14] powerpc: Add support for restartable sequences

2018-05-23 Thread Michael Ellerman
Mathieu Desnoyers writes: > - On May 23, 2018, at 4:14 PM, Mathieu Desnoyers > mathieu.desnoy...@efficios.com wrote: ... >> >> Hi Boqun, >> >> I tried your patch in a ppc64 le environment, and it does not survive boot >> with CONFIG_DEBUG_RSEQ=y. init gets

Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices

2018-05-23 Thread Benjamin Herrenschmidt
On Wed, 2018-05-23 at 21:50 +0300, Michael S. Tsirkin wrote: > I re-read that discussion and I'm still unclear on the > original question, since I got several apparently > conflicting answers. > > I asked: > > Why isn't setting VIRTIO_F_IOMMU_PLATFORM on the > hypervisor side

Re: [PATCH 4/5] pci/hotplug/pnv-php: add missing of_node_put

2018-05-23 Thread Bjorn Helgaas
On Wed, May 23, 2018 at 09:07:15PM +0200, Julia Lawall wrote: > The device node iterators perform an of_node_get on each iteration, so a > jump out of the loop requires an of_node_put. > > The semantic patch that fixes this problem is as follows > (http://coccinelle.lip6.fr): > > // > @@ >

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Jakub Kicinski
On Wed, 23 May 2018 16:07:40 +0530, Sandipan Das wrote: > "name": "bpf_prog_196af774a3477707_F", > "insns": [{ > "pc": "0x0", > "operation": "nop", > "operands": [null > ] > },{ > "pc":

Re: [PATCH 07/14] powerpc: Add support for restartable sequences

2018-05-23 Thread Mathieu Desnoyers
- On May 23, 2018, at 4:14 PM, Mathieu Desnoyers mathieu.desnoy...@efficios.com wrote: > - On May 20, 2018, at 10:08 AM, Boqun Feng boqun.f...@gmail.com wrote: > >> On Fri, May 18, 2018 at 02:17:17PM -0400, Mathieu Desnoyers wrote: >>> - On May 17, 2018, at 7:50 PM, Boqun Feng

Re: [PATCH 07/14] powerpc: Add support for restartable sequences

2018-05-23 Thread Paul E. McKenney
On Wed, May 23, 2018 at 04:14:39PM -0400, Mathieu Desnoyers wrote: > - On May 20, 2018, at 10:08 AM, Boqun Feng boqun.f...@gmail.com wrote: > > > On Fri, May 18, 2018 at 02:17:17PM -0400, Mathieu Desnoyers wrote: > >> - On May 17, 2018, at 7:50 PM, Boqun Feng boqun.f...@gmail.com wrote: >

Re: [PATCH 07/14] powerpc: Add support for restartable sequences

2018-05-23 Thread Mathieu Desnoyers
- On May 20, 2018, at 10:08 AM, Boqun Feng boqun.f...@gmail.com wrote: > On Fri, May 18, 2018 at 02:17:17PM -0400, Mathieu Desnoyers wrote: >> - On May 17, 2018, at 7:50 PM, Boqun Feng boqun.f...@gmail.com wrote: >> [...] >> >> > I think you're right. So we have to introduce callsite to

[PATCH 4/5] pci/hotplug/pnv-php: add missing of_node_put

2018-05-23 Thread Julia Lawall
The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression root,e; local idexpression child; iterator name for_each_child_of_node;

[PATCH 0/5] add missing of_node_put

2018-05-23 Thread Julia Lawall
The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put. --- drivers/gpu/drm/rockchip/rockchip_lvds.c |4 +++- drivers/pci/hotplug/pnv_php.c |8 ++-- drivers/phy/hisilicon/phy-hisi-inno-usb2.c |9

[PATCH] sound: Use octal not symbolic permissions

2018-05-23 Thread Joe Perches
Convert the S_ symbolic permissions to their octal equivalents as using octal and not symbolic permissions is preferred by many as more readable. see: https://lkml.org/lkml/2016/8/2/1945 Done with automated conversion via: $ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace

Re: [PATCH 1/2] powerpc/xmon: Specify the full format in DUMP() macro

2018-05-23 Thread Mathieu Malaterre
On Wed, May 23, 2018 at 1:48 PM, Michael Ellerman wrote: > In dump_one_paca() the DUMP macro unconditionally prepends '#' to the > printf format specifier. In most cases we're using either 'x' or 'lx' > etc. and that is OK. But for 'p' and other formats using '#' is >

Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices

2018-05-23 Thread Michael S. Tsirkin
subj: s/virito/virtio/ On Tue, May 22, 2018 at 12:03:17PM +0530, Anshuman Khandual wrote: > This adds a hook which a platform can define in order to allow it to > force the use of the DMA API for all virtio devices even if they don't > have the VIRTIO_F_IOMMU_PLATFORM flag set. We want to use

[PATCH net-next 7/8] ibmvnic: Set resetting state at earliest possible point

2018-05-23 Thread Thomas Falcon
Set device resetting state at the earliest possible point: as soon as a reset is successfully scheduled. The reset state is toggled off when all resets have been processed to completion. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 3 +-- 1

[PATCH net-next 8/8] ibmvnic: Introduce hard reset recovery

2018-05-23 Thread Thomas Falcon
Introduce a recovery hard reset to handle reset failure as a result of change of device context following a transport event, such as a backing device failover or partition migration. These operations reset the device context to its initial state. If this occurs during a reset, any initialization

[PATCH net-next 6/8] ibmvnic: Create separate initialization routine for resets

2018-05-23 Thread Thomas Falcon
Instead of having one initialization routine for all cases, create a separate, simpler function for standard initialization, such as during device probe. Use the original initialization function to handle device reset scenarios. The goal of this patch is to avoid having a single, cluttered init

[PATCH net-next 5/8] ibmvnic: Handle error case when setting link state

2018-05-23 Thread Thomas Falcon
If setting the link state is not successful, print a warning with the resulting return code and return it to be handled by the caller. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 4 1 file changed, 4 insertions(+) diff --git

[PATCH net-next 4/8] ibmvnic: Return error code if init interrupted by transport event

2018-05-23 Thread Thomas Falcon
If device init is interrupted by a failover, set the init return code so that it can be checked and handled appropriately by the init routine. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 5 - 1 file changed, 4 insertions(+), 1

[PATCH net-next 2/8] ibmvnic: Introduce active CRQ state

2018-05-23 Thread Thomas Falcon
Introduce an "active" state for a IBM vNIC Command-Response Queue. A CRQ is considered active once it has initialized or linked with its partner by sending an initialization request and getting a successful response back from the management partition. Until this has happened, do not allow CRQ

[PATCH net-next 3/8] ibmvnic: Check CRQ command return codes

2018-05-23 Thread Thomas Falcon
Check whether CRQ command is successful before awaiting a response from the management partition. If the command was not successful, the driver may hang waiting for a response that will never come. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c

[PATCH net-next 1/8] ibmvnic: Mark NAPI flag as disabled when released

2018-05-23 Thread Thomas Falcon
Set adapter NAPI state as disabled if they are removed. This will allow them to be enabled again if reallocated in case of a hard reset. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH net-next 0/8] ibmvnic: Failover hardening

2018-05-23 Thread Thomas Falcon
Introduce additional transport event hardening to handle events during device reset. In the driver's current state, if a transport event is received during device reset, it can cause the device to become unresponsive as invalid operations are processed as the backing device context changes. After

Re: [PATCH v3] powerpc: Implement csum_ipv6_magic in assembly

2018-05-23 Thread Segher Boessenkool
On Tue, May 22, 2018 at 08:57:01AM +0200, Christophe Leroy wrote: > The generic csum_ipv6_magic() generates a pretty bad result Please try with a more recent compiler, what you used is pretty ancient. It's not like recent compilers do great on this either, but it's not *that* bad anymore ;-) >

Re: [PATCH v2] powerpc/xmon: Also setup debugger hooks when single-stepping

2018-05-23 Thread Vaibhav Jain
Michal Suchanek writes: > When single-stepping kernel code from xmon without a debug hook enabled > the kernel crashes. This can happen when kernel starts with xmon on > crash disabled but xmon is entered using sysrq. > > Call force_enable_xmon when single-stepping in xmon to

[PATCH v2] powerpc/xmon: Also setup debugger hooks when single-stepping

2018-05-23 Thread Michal Suchanek
When single-stepping kernel code from xmon without a debug hook enabled the kernel crashes. This can happen when kernel starts with xmon on crash disabled but xmon is entered using sysrq. Call force_enable_xmon when single-stepping in xmon to install the xmon debug hooks. Fixes: e1368d0c9edb

Re: [PATCH] powerpc/xmon: really enable xmon when a breakpoint is set

2018-05-23 Thread Michal Suchánek
On Tue, 22 May 2018 12:53:53 +0530 Vaibhav Jain wrote: > Thanks for the patch Michal, > > Michal Suchanek writes: > > > When single-stepping kernel code from xmon without a debug hook > > enabled the kernel crashes. This can happen when kernel

Patch "powerpc/pseries: Use the security flags in pseries_setup_rfi_flush()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/pseries: Use the security flags in pseries_setup_rfi_flush() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the

Patch "powerpc/rfi-flush: Always enable fallback flush on pseries" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/rfi-flush: Always enable fallback flush on pseries to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/powernv: Set or clear security feature flags" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/powernv: Set or clear security feature flags to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/pseries: Set or clear security feature flags" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/pseries: Set or clear security feature flags to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/pseries: Fix clearing of security feature flags" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/pseries: Fix clearing of security feature flags to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/pseries: Add new H_GET_CPU_CHARACTERISTICS flags" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/pseries: Add new H_GET_CPU_CHARACTERISTICS flags to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/powernv: Use the security flags in pnv_setup_rfi_flush()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/powernv: Use the security flags in pnv_setup_rfi_flush() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the

Patch "powerpc/64s: Enhance the information in cpu_show_meltdown()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/64s: Enhance the information in cpu_show_meltdown() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc: Move default security feature flags" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc: Move default security feature flags to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc: Add security feature flags for Spectre/Meltdown" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc: Add security feature flags for Spectre/Meltdown to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/64s: Wire up cpu_show_spectre_v2()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/64s: Wire up cpu_show_spectre_v2() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/64s: Wire up cpu_show_spectre_v1()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/64s: Wire up cpu_show_spectre_v1() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/64s: Move cpu_show_meltdown()" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/64s: Move cpu_show_meltdown() to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Patch "powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit" has been added to the 4.16-stable tree

2018-05-23 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit to the 4.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename

Re: [PATCH stable 4.16 00/14] powerpc backports for 4.16

2018-05-23 Thread Greg KH
On Wed, May 23, 2018 at 12:41:11AM +1000, Michael Ellerman wrote: > Hi Greg, > > Please queue up this series of patches for 4.16 if you have no objections. > > These are mostly clean backports but one or two required some fixing up, hench > the backport. All now applied, thanks. greg k-h

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Sandipan Das
On 05/23/2018 07:20 PM, Daniel Borkmann wrote: > On 05/23/2018 12:37 PM, Sandipan Das wrote: > [...] >> Other than that, for powerpc64, there is a problem with the way the >> binutils disassembler code (in "opcodes/ppc-dis.c") passes arguments >> to the callback fprintf_json(). >> >> In

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Daniel Borkmann
On 05/23/2018 12:37 PM, Sandipan Das wrote: [...] > Other than that, for powerpc64, there is a problem with the way the > binutils disassembler code (in "opcodes/ppc-dis.c") passes arguments > to the callback fprintf_json(). > > In fprintf_json(), we always expect the va_list elements to resolve

[PATCH 2/2] powerpc/xmon: Realign paca dump fields

2018-05-23 Thread Michael Ellerman
We've added some fields with longer names since we originally wrote this, so the fields are no longer lined up. Adjust the widths to make it all look nice again, eg: 0:mon> dp paca for cpu 0x0 @ c1fa: possible = yes ... slb_shadow[0] =

[PATCH 1/2] powerpc/xmon: Specify the full format in DUMP() macro

2018-05-23 Thread Michael Ellerman
In dump_one_paca() the DUMP macro unconditionally prepends '#' to the printf format specifier. In most cases we're using either 'x' or 'lx' etc. and that is OK. But for 'p' and other formats using '#' is actually undefined, and once we enable printf() checking for xmon_printf() we will get

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Sandipan Das
On 05/23/2018 02:38 PM, Daniel Borkmann wrote: > On 05/22/2018 09:55 PM, Jakub Kicinski wrote: >> On Tue, 22 May 2018 22:46:13 +0530, Sandipan Das wrote: >>> + if (info.nr_jited_func_lens && info.jited_func_lens) { >>> + struct kernel_sym *sym = NULL; >>> +

Re: [PATCH v9] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Nicholas Piggin
On Wed, 23 May 2018 10:53:22 +0200 (CEST) Christophe Leroy wrote: > Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every > userspace instruction miss") has shown that limiting the read of > faulting instruction to likely cases improves performance. > > This

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Daniel Borkmann
On 05/22/2018 09:55 PM, Jakub Kicinski wrote: > On Tue, 22 May 2018 22:46:13 +0530, Sandipan Das wrote: >> +if (info.nr_jited_func_lens && info.jited_func_lens) { >> +struct kernel_sym *sym = NULL; >> +unsigned char *img = buf; >> +

[RESEND RFC PATCH] powerpc/fsl: Add barrier_nospec implementation for NXP PowerPC Book E

2018-05-23 Thread Diana Craciun
Implement the barrier_nospec as a isync;sync instruction sequence. The implementation uses the infrastructure built for BOOK3S 64 with the difference that for NXP platforms there is no firmware involved and the need for a speculation barrier is read from the device tree. I have used the same name

[PATCH v9] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Christophe Leroy
Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every userspace instruction miss") has shown that limiting the read of faulting instruction to likely cases improves performance. This patch goes further into this direction by limiting the read of the faulting instruction to the only

Re: [PATCH v8] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Nicholas Piggin
On Wed, 23 May 2018 09:31:33 +0200 Christophe LEROY wrote: > Le 23/05/2018 à 09:17, Nicholas Piggin a écrit : > > On Wed, 23 May 2018 09:01:19 +0200 (CEST) > > Christophe Leroy wrote: > > > >> @@ -264,8 +266,30 @@ static bool

[PATCH v4 29/29] KVM: PPC: Book3S PR: enable kvmppc_get/set_one_reg_pr() for HTM registers

2018-05-23 Thread wei . guo . simon
From: Simon Guo We need to migrate PR KVM during transaction and qemu will use kvmppc_get_one_reg_pr()/kvmppc_set_one_reg_pr() APIs to get/set transaction checkpoint state. This patch adds support for that. So far PPC PR qemu doesn't fully function for migration but the

[PATCH v4 28/29] KVM: PPC: remove load/put vcpu for KVM_GET_REGS/KVM_SET_REGS

2018-05-23 Thread wei . guo . simon
From: Simon Guo In both HV/PR KVM, the KVM_SET_REGS/KVM_GET_REGS ioctl should be able to perform without load vcpu. This patch adds KVM_SET_ONE_REG/KVM_GET_ONE_REG implementation to async ioctl function. Due to the vcpu mutex locking/unlock has been moved out of

[PATCH v4 27/29] KVM: PPC: remove load/put vcpu for KVM_GET/SET_ONE_REG ioctl

2018-05-23 Thread wei . guo . simon
From: Simon Guo Due to the vcpu mutex locking/unlock has been moved out of vcpu_load() /vcpu_put(), KVM_GET_ONE_REG and KVM_SET_ONE_REG doesn't need to do ioctl with loading vcpu anymore. This patch removes vcpu_load()/vcpu_put() from KVM_GET_ONE_REG and KVM_SET_ONE_REG

[PATCH v4 26/29] KVM: PPC: move vcpu_load/vcpu_put down to each ioctl case in kvm_arch_vcpu_ioctl

2018-05-23 Thread wei . guo . simon
From: Simon Guo Although we already have kvm_arch_vcpu_async_ioctl() which doesn't require ioctl to load vcpu, the sync ioctl code need to be cleaned up when CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL is not configured. This patch moves vcpu_load/vcpu_put down to each ioctl

[PATCH v4 25/29] KVM: PPC: Book3S PR: enable HTM for PR KVM for KVM_CHECK_EXTENSION ioctl

2018-05-23 Thread wei . guo . simon
From: Simon Guo With current patch set, PR KVM now supports HTM. So this patch turns it on for PR KVM. Tested with: https://github.com/justdoitqd/publicFiles/blob/master/test_kvm_htm_cap.c Signed-off-by: Simon Guo ---

[PATCH v4 24/29] KVM: PPC: Book3S PR: Support TAR handling for PR KVM HTM.

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently guest kernel doesn't handle TAR fac unavailable and it always runs with TAR bit on. PR KVM will lazily enable TAR. TAR is not a frequent-use reg and it is not included in SVCPU struct. Due to the above, the checkpointed TAR val might be a bogus

[PATCH v4 23/29] KVM: PPC: Book3S PR: add guard code to prevent returning to guest with PR=0 and Transactional state

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently PR KVM doesn't support transaction memory at guest privilege state. This patch adds a check at setting guest msr, so that we can never return to guest with PR=0 and TS=0b10. A tabort will be emulated to indicate this and fail transaction

[PATCH v4 22/29] KVM: PPC: Book3S PR: add emulation for tabort. for privilege guest

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently privilege guest will be run with TM disabled. Although the privilege guest cannot initiate a new transaction, it can use tabort to terminate its problem state's transaction. So it is still necessary to emulate tabort. for privilege guest. This

[PATCH v4 21/29] KVM: PPC: Book3S PR: add emulation for trechkpt in PR KVM.

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch adds host emulation when guest PR KVM executes "trechkpt.", which is a privileged instruction and will trap into host. We firstly copy vcpu ongoing content into vcpu tm checkpoint content, then perform kvmppc_restore_tm_pr() to do trechkpt.

[PATCH v4 20/29] KVM: PPC: Book3S PR: adds emulation for treclaim.

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch adds support for "treclaim." emulation when PR KVM guest executes treclaim. and traps to host. We will firstly doing treclaim. and save TM checkpoint. Then it is necessary to update vcpu current reg content with checkpointed vals. When rfid

[PATCH v4 19/29] KVM: PPC: Book3S PR: enable NV reg restore for reading TM SPR at guest privilege state

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently kvmppc_handle_fac() will not update NV GPRs and thus it can return with GUEST_RESUME. However PR KVM guest always disables MSR_TM bit at privilege state. If PR privilege guest are trying to read TM SPRs, it will trigger TM facility unavailable

[PATCH v4 18/29] KVM: PPC: Book3S PR: always fail transaction in guest privilege state

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently kernel doesn't use transaction memory. And there is an issue for privilege guest that: tbegin/tsuspend/tresume/tabort TM instructions can impact MSR TM bits without trap into PR host. So following code will lead to a false mfmsr result:

[PATCH v4 17/29] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPRs

2018-05-23 Thread wei . guo . simon
From: Simon Guo The mfspr/mtspr on TM SPRs(TEXASR/TFIAR/TFHAR) are non-privileged instructions and can be executed at PR KVM guest without trapping into host in problem state. We only emulate mtspr/mfspr texasr/tfiar/tfhar at guest PR=0 state. When we are emulating

[PATCH v4 16/29] KVM: PPC: Book3S PR: add math support for PR KVM HTM

2018-05-23 Thread wei . guo . simon
From: Simon Guo The math registers will be saved into vcpu->arch.fp/vr and corresponding vcpu->arch.fp_tm/vr_tm area. We flush or giveup the math regs into vcpu->arch.fp/vr before saving transaction. After transaction is restored, the math regs will be loaded back into

[PATCH v4 15/29] KVM: PPC: Book3S PR: add transaction memory save/restore skeleton for PR KVM

2018-05-23 Thread wei . guo . simon
From: Simon Guo The transaction memory checkpoint area save/restore behavior is triggered when VCPU qemu process is switching out/into CPU. ie. at kvmppc_core_vcpu_put_pr() and kvmppc_core_vcpu_load_pr(). MSR TM active state is determined by TS bits: active:

[PATCH v4 14/29] KVM: PPC: Book3S PR: add kvmppc_save/restore_tm_sprs() APIs

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch adds 2 new APIs kvmppc_save_tm_sprs()/kvmppc_restore_tm_sprs() for the purpose of TEXASR/TFIAR/TFHAR save/restore. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras ---

[PATCH v4 3/3] powerpc/lib: optimise PPC32 memcmp

2018-05-23 Thread Christophe Leroy
At the time being, memcmp() compares two chunks of memory byte per byte. This patch optimises the comparison by comparing word by word. A small benchmark performed on an 8xx comparing two chuncks of 512 bytes performed 10 times gives: Before : 5852274 TB ticks After: 1488638 TB ticks

[PATCH v4 13/29] KVM: PPC: Book3S PR: adds new kvmppc_copyto_vcpu_tm/kvmppc_copyfrom_vcpu_tm API for PR KVM.

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch adds 2 new APIs: kvmppc_copyto_vcpu_tm() and kvmppc_copyfrom_vcpu_tm(). These 2 APIs will be used to copy from/to TM data between VCPU_TM/VCPU area. PR KVM will use these APIs for treclaim. or trchkpt. emulation. Signed-off-by: Simon Guo

[PATCH v4 12/29] KVM: PPC: Book3S PR: prevent TS bits change in kvmppc_interrupt_pr()

2018-05-23 Thread wei . guo . simon
From: Simon Guo PR KVM host usually equipped with enabled TM in its host MSR value, and with non-transactional TS value. When a guest with TM active traps into PR KVM host, the rfid at the tail of kvmppc_interrupt_pr() will try to switch TS bits from S0 (Suspended & TM

[PATCH v4 11/29] KVM: PPC: Book3S PR: implement RFID TM behavior to suppress change from S0 to N0

2018-05-23 Thread wei . guo . simon
From: Simon Guo Accordingly to ISA specification for RFID, in MSR TM disabled and TS suspended state(S0), if the target MSR is TM disabled and TS state is inactive(N0), rfid should suppress this update. This patch make RFID emulation of PR KVM to be consistent with

[PATCH v4 10/29] KVM: PPC: Book3S PR: Sync TM bits to shadow msr for problem state guest

2018-05-23 Thread wei . guo . simon
From: Simon Guo MSR TS bits can be modified with non-privileged instruction like tbegin./tend. That means guest can change MSR value "silently" without notifying host. It is necessary to sync the TM bits to host so that host can calculate shadow msr correctly. note

[PATCH v4 09/29] KVM: PPC: Book3S PR: PR KVM pass through MSR TM/TS bits to shadow_msr.

2018-05-23 Thread wei . guo . simon
From: Simon Guo PowerPC TM functionality needs MSR TM/TS bits support in hardware level. Guest TM functionality can not be emulated with "fake" MSR (msr in magic page) TS bits. This patch syncs TM/TS bits in shadow_msr with the MSR value in magic page, so that the MSR

[PATCH v4 08/29] KVM: PPC: Book3S PR: In PR KVM suspends Transactional state when inject an interrupt.

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch simulates interrupt behavior per Power ISA while injecting interrupt in PR KVM: - When interrupt happens, transactional state should be suspended. kvmppc_mmu_book3s_64_reset_msr() will be invoked when injecting an interrupt. This patch

[PATCH v4 07/29] KVM: PPC: Book3S PR: add C function wrapper for _kvmppc_save/restore_tm()

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently _kvmppc_save/restore_tm() APIs can only be invoked from assembly function. This patch adds C function wrappers for them so that they can be safely called from C function. Signed-off-by: Simon Guo ---

[PATCH v4 06/29] KVM: PPC: Book3S PR: turn on FP/VSX/VMX MSR bits in kvmppc_save_tm()

2018-05-23 Thread wei . guo . simon
From: Simon Guo kvmppc_save_tm() invokes store_fp_state/store_vr_state(). So it is mandatory to turn on FP/VSX/VMX MSR bits for its execution, just like what kvmppc_restore_tm() did. Previsouly HV KVM has turned the bits on outside of function kvmppc_save_tm(). Now we

[PATCH v4 05/29] KVM: PPC: Book3S PR: add new parameter (guest MSR) for kvmppc_save_tm()/kvmppc_restore_tm()

2018-05-23 Thread wei . guo . simon
From: Simon Guo HV KVM and PR KVM need different MSR source to indicate whether treclaim. or trecheckpoint. is necessary. This patch add new parameter (guest MSR) for these kvmppc_save_tm/ kvmppc_restore_tm() APIs: - For HV KVM, it is VCPU_MSR - For PR KVM, it is

[PATCH v4 04/29] KVM: PPC: Book3S PR: Move kvmppc_save_tm/kvmppc_restore_tm to separate file

2018-05-23 Thread wei . guo . simon
From: Simon Guo It is a simple patch just for moving kvmppc_save_tm/kvmppc_restore_tm() functionalities to tm.S. There is no logic change. The reconstruct of those APIs will be done in later patches to improve readability. It is for preparation of reusing those APIs on

[PATCH v4 03/29] powerpc: export tm_enable()/tm_disable/tm_abort() APIs

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch exports tm_enable()/tm_disable/tm_abort() APIs, which will be used for PR KVM transaction memory logic. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras ---

[PATCH v4 02/29] powerpc: add TEXASR related macros

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patches add some macros for CR0/TEXASR bits so that PR KVM TM logic(tbegin./treclaim./tabort.) can make use of them later. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras ---

[PATCH v4 01/29] powerpc: export symbol msr_check_and_set().

2018-05-23 Thread wei . guo . simon
From: Simon Guo PR KVM will need to reuse msr_check_and_set(). This patch exports this API for reuse. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras --- arch/powerpc/kernel/process.c | 1 + 1 file changed, 1

[PATCH v4 00/29] KVM: PPC: Book3S PR: Transaction memory support on PR KVM

2018-05-23 Thread wei . guo . simon
From: Simon Guo In current days, many OS distributions have utilized transaction memory functionality. In PowerPC, HV KVM supports TM. But PR KVM does not. The drive for the transaction memory support of PR KVM is the openstack Continuous Integration testing - They runs

Re: [PATCH v3 24/29] KVM: PPC: Book3S PR: Support TAR handling for PR KVM HTM.

2018-05-23 Thread Simon Guo
Hi Paul, On Tue, May 22, 2018 at 09:44:47PM +1000, Paul Mackerras wrote: > On Mon, May 21, 2018 at 12:09:41PM +0800, wei.guo.si...@gmail.com wrote: > > From: Simon Guo > > > > Currently guest kernel doesn't handle TAR fac unavailable and it always > > runs with TAR bit

[PATCH v5 4/4] powerpc:selftest update memcmp_64 selftest for VMX implementation

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch reworked selftest memcmp_64 so that memcmp selftest can cover more test cases. It adds testcases for: - memcmp over 4K bytes size. - s1/s2 with different/random offset on 16 bytes boundary. - enter/exit_vmx_ops pairness. Signed-off-by: Simon

[PATCH v5 3/4] powerpc/64: add 32 bytes prechecking before using VMX optimization on memcmp()

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch is based on the previous VMX patch on memcmp(). To optimize ppc64 memcmp() with VMX instruction, we need to think about the VMX penalty brought with: If kernel uses VMX instruction, it needs to save/restore current thread's VMX registers.

[PATCH v5 2/4] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2018-05-23 Thread wei . guo . simon
From: Simon Guo This patch add VMX primitives to do memcmp() in case the compare size exceeds 4K bytes. KSM feature can benefit from this. Test result with following test program(replace the "^>" with ""): -- ># cat

[PATCH v5 1/4] powerpc/64: Align bytes before fall back to .Lshort in powerpc64 memcmp()

2018-05-23 Thread wei . guo . simon
From: Simon Guo Currently memcmp() 64bytes version in powerpc will fall back to .Lshort (compare per byte mode) if either src or dst address is not 8 bytes aligned. It can be opmitized in 2 situations: 1) if both addresses are with the same offset with 8 bytes boundary:

[PATCH v5 0/4] powerpc/64: memcmp() optimization

2018-05-23 Thread wei . guo . simon
From: Simon Guo There is some room to optimize memcmp() in powerpc 64 bits version for following 2 cases: (1) Even src/dst addresses are not aligned with 8 bytes at the beginning, memcmp() can align them and go with .Llong comparision mode without fallback to .Lshort

Re: [PATCH v8] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Christophe LEROY
Le 23/05/2018 à 09:17, Nicholas Piggin a écrit : On Wed, 23 May 2018 09:01:19 +0200 (CEST) Christophe Leroy wrote: Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every userspace instruction miss") has shown that limiting the read of faulting instruction

Re: [PATCH v8] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Nicholas Piggin
On Wed, 23 May 2018 09:01:19 +0200 (CEST) Christophe Leroy wrote: > Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every > userspace instruction miss") has shown that limiting the read of > faulting instruction to likely cases improves performance. > > This

[PATCH] powerpc/mm: Use instruction symbolic names in store_updates_sp()

2018-05-23 Thread Christophe Leroy
Use symbolic names defined in asm/ppc-opcode.h instead of hardcoded values. Signed-off-by: Christophe Leroy --- Resending as inpependant of the do_page_fault() stuff arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/mm/fault.c | 26

[PATCH v8] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Christophe Leroy
Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every userspace instruction miss") has shown that limiting the read of faulting instruction to likely cases improves performance. This patch goes further into this direction by limiting the read of the faulting instruction to the only

Re: [PATCH v7 2/3] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Christophe LEROY
Le 23/05/2018 à 08:29, Nicholas Piggin a écrit : On Tue, 22 May 2018 16:50:55 +0200 Christophe LEROY wrote: Le 22/05/2018 à 16:38, Nicholas Piggin a écrit : On Tue, 22 May 2018 16:02:56 +0200 (CEST) Christophe Leroy wrote: Commit

Re: [PATCH v7 2/3] powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

2018-05-23 Thread Nicholas Piggin
On Tue, 22 May 2018 16:50:55 +0200 Christophe LEROY wrote: > Le 22/05/2018 à 16:38, Nicholas Piggin a écrit : > > On Tue, 22 May 2018 16:02:56 +0200 (CEST) > > Christophe Leroy wrote: > > > >> Commit a7a9dcd882a67 ("powerpc: Avoid taking a