Re: [PATCH kernel v4 08/10] KVM: PPC: Separate TCE validation from update

2017-02-08 Thread David Gibson
On Tue, Feb 07, 2017 at 06:17:09PM +1100, Alexey Kardashevskiy wrote: > For the emulated devices it does not matter much if we get a broken TCE > half way handling a TCE list but for VFIO it will matter as it has > more chances to fail so we try to do our best and check as much as we > can before

Re: [PATCH kernel v4 09/10] KVM: PPC: Use preregistered memory API to access TCE list

2017-02-08 Thread David Gibson
On Tue, Feb 07, 2017 at 06:17:10PM +1100, Alexey Kardashevskiy wrote: > VFIO on sPAPR already implements guest memory pre-registration > when the entire guest RAM gets pinned. This can be used to translate > the physical address of a guest page containing the TCE list > from H_PUT_TCE_INDIRECT. >

Re: [PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case

2017-02-08 Thread Aneesh Kumar K.V
Benjamin Herrenschmidt writes: > On Thu, 2017-02-09 at 14:49 +1100, Benjamin Herrenschmidt wrote: >> On Thu, 2017-02-09 at 08:28 +0530, Aneesh Kumar K.V wrote: >> > In the kernel we do follow the below sequence in different code >> > paths. >> > pte =

Re: [PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case

2017-02-08 Thread Benjamin Herrenschmidt
On Thu, 2017-02-09 at 14:49 +1100, Benjamin Herrenschmidt wrote: > On Thu, 2017-02-09 at 08:28 +0530, Aneesh Kumar K.V wrote: > > In the kernel we do follow the below sequence in different code > > paths. > > pte = ptep_get_clear(ptep) > > > > set_pte_at(ptep, pte) > > > > We do that for

Re: [PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case

2017-02-08 Thread Benjamin Herrenschmidt
On Thu, 2017-02-09 at 08:28 +0530, Aneesh Kumar K.V wrote: > In the kernel we do follow the below sequence in different code paths. > pte = ptep_get_clear(ptep) > > set_pte_at(ptep, pte) > > We do that for mremap, autonuma protection update and softdirty clearing. This > implies our

linux-next: manual merge of the kvm-ppc tree with the powerpc tree

2017-02-08 Thread Stephen Rothwell
Hi Paul, Today's linux-next merge of the kvm-ppc tree got conflicts in: arch/powerpc/include/asm/opal.h arch/powerpc/platforms/powernv/opal-wrappers.S between commit: 1d0761d2557d ("powerpc/powernv: Initialise nest mmu") from the powerpc tree and commit: ab9bad0ead9a

Re: [PATCH 1/2] mm/autonuma: Let architecture override how the write bit should be stashed in a protnone pte.

2017-02-08 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V" writes: > Autonuma preserves the write permission across numa fault to avoid taking > a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserve PTE > write permissions across a NUMA hinting fault"). Architecture can implement >

[PATCH 2/2] powerpc/mm/autonuma: Switch ppc64 to its own implementeation of saved write

2017-02-08 Thread Aneesh Kumar K.V
With this our protnone becomes a present pte with READ/WRITE/EXEC bit cleared. By default we also set _PAGE_PRIVILEGED on such pte. This is now used to help us identify a protnone pte that as saved write bit. For such pte, we will clear the _PAGE_PRIVILEGED bit. The pte still remain non-accessible

[PATCH 1/2] mm/autonuma: Let architecture override how the write bit should be stashed in a protnone pte.

2017-02-08 Thread Aneesh Kumar K.V
Autonuma preserves the write permission across numa fault to avoid taking a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserve PTE write permissions across a NUMA hinting fault"). Architecture can implement protnone in different ways and some may choose to implement that by

[PATCH 3/3] powerpc/mm/radix: Skip ptesync in pte update helpers

2017-02-08 Thread Aneesh Kumar K.V
We do them at the start of tlb flush, and we are sure a pte update will be followed by a tlbflush. Hence we can skip the ptesync in pte update helpers. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/radix.h | 3 --- 1 file changed, 3

[PATCH 2/3] powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm

2017-02-08 Thread Aneesh Kumar K.V
This helps us to do some optimization for application exit case, where we can skip the DD1 style pte update sequence. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 17 +

[PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case

2017-02-08 Thread Aneesh Kumar K.V
In the kernel we do follow the below sequence in different code paths. pte = ptep_get_clear(ptep) set_pte_at(ptep, pte) We do that for mremap, autonuma protection update and softdirty clearing. This implies our optimization to skip a tlb flush when clearing a pte update is not valid, because

Re: [PATCH kernel] vfio/spapr_tce: Set window when adding additional groups to container

2017-02-08 Thread David Gibson
On Tue, Feb 07, 2017 at 12:35:59PM -0700, Alex Williamson wrote: > On Tue, 7 Feb 2017 17:26:57 +1100 > Alexey Kardashevskiy wrote: > > > If a container already has a group attached, attaching a new group > > should just program already created IOMMU tables to the hardware via >

Re: [PATCH] powerpc/irq: Improve/fix migrate_irqs()

2017-02-08 Thread Benjamin Herrenschmidt
On Wed, 2017-02-08 at 21:02 +1100, Michael Ellerman wrote: > Benjamin Herrenschmidt writes: > > > migrate_irqs() is used by some platforms to migrate interrupts > > away from a CPU about to be offlined. > > > > The current implementation had various issues such as not

Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler

2017-02-08 Thread Scott Bauer
On Wed, Feb 08, 2017 at 02:58:28PM -0700, Scott Bauer wrote: > On Wed, Feb 08, 2017 at 10:15:28PM +0100, Arnd Bergmann wrote: > > When CONFIG_KASAN is in use, the sed_ioctl function uses unusually large > > stack, > > as each possible ioctl argument gets its own stack area plus redzone: > > > >

Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler

2017-02-08 Thread Scott Bauer
On Wed, Feb 08, 2017 at 10:15:28PM +0100, Arnd Bergmann wrote: > When CONFIG_KASAN is in use, the sed_ioctl function uses unusually large > stack, > as each possible ioctl argument gets its own stack area plus redzone: > > block/sed-opal.c: In function 'sed_ioctl': > block/sed-opal.c:2447:1:

[PATCH] block: sed-opal: reduce stack size of ioctl handler

2017-02-08 Thread Arnd Bergmann
When CONFIG_KASAN is in use, the sed_ioctl function uses unusually large stack, as each possible ioctl argument gets its own stack area plus redzone: block/sed-opal.c: In function 'sed_ioctl': block/sed-opal.c:2447:1: error: the frame size of 2256 bytes is larger than 2048 bytes

Re: [PATCH] tpm: ibmvtpm: simplify crq initialization and document crq format

2017-02-08 Thread Jarkko Sakkinen
On Tue, Jan 31, 2017 at 03:17:34PM +0100, Michal Suchanek wrote: > > The crq is passed in registers so is the same on BE and LE hosts. 's/ so// ' ? > However, current implementation allocates a structure on-stack to > represent the crq, initializes the members swapping them to BE, and > loads

Re: [PATCH 0/2] get rid of immrbar_virt_to_phys()

2017-02-08 Thread David Miller
From: Christophe Leroy Date: Tue, 7 Feb 2017 10:05:07 +0100 (CET) > ucc_geth ethernet driver is the only driver using immrbar_virt_to_phys() and > it uses it incorrectly. > > This patch fixes ucc_geth driver then removes immrbar_virt_to_phys() Feel free to merge this

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-08 Thread Josh Poimboeuf
On Wed, Feb 08, 2017 at 04:47:50PM +0100, Petr Mladek wrote: > > Notice in this case that klp_target_state is KLP_PATCHED. Which means > > that klp_complete_transition() would not call synchronize_rcu() at the > > right time, nor would it call module_put(). It can be fixed with: > > > > @@

[PATCH -next v2] KVM: PPC: fix error return code in kvm_vm_ioctl_create_spapr_tce()

2017-02-08 Thread Wei Yongjun
From: Wei Yongjun Fix to return error code -ENOMEM from the memory alloc error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- arch/powerpc/kvm/book3s_64_vio.c | 1 + 1 file changed, 1 insertion(+)

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-08 Thread Petr Mladek
On Mon 2017-02-06 13:51:48, Josh Poimboeuf wrote: > On Mon, Feb 06, 2017 at 05:44:31PM +0100, Petr Mladek wrote: > > > > > @@ -347,22 +354,37 @@ static int __klp_enable_patch(struct klp_patch > > > > > *patch) > > > > > > > > > > pr_notice("enabling patch '%s'\n", patch->mod->name); > > >

Re: [PATCH] cxl: Force context lock during EEH flow

2017-02-08 Thread Vaibhav Jain
Frederic Barrat writes: >> >> +/* forcibly take the context lock to prevent new context activation */ >> +cxl_adapter_context_force_lock(adapter); >> + > > I'm not a fan of the "force lock" call and I'm not convinced it's > needed. When an EEH is triggered,

Re: [PATCH 1/2] powerpc: mm: support ARCH_MMAP_RND_BITS

2017-02-08 Thread Bhupesh Sharma
HI Michael, On Thu, Feb 2, 2017 at 3:53 PM, Michael Ellerman wrote: > Bhupesh Sharma writes: > >> powerpc: arch_mmap_rnd() uses hard-coded values, (23-PAGE_SHIFT) for >> 32-bit and (30-PAGE_SHIFT) for 64-bit, to generate the random offset >> for the

Re: [PATCH v2 1/1] powerpc: mm: support ARCH_MMAP_RND_BITS

2017-02-08 Thread Bhupesh Sharma
On Sat, Feb 4, 2017 at 6:13 AM, Kees Cook wrote: > On Thu, Feb 2, 2017 at 9:11 PM, Bhupesh Sharma wrote: >> powerpc: arch_mmap_rnd() uses hard-coded values, (23-PAGE_SHIFT) for >> 32-bit and (30-PAGE_SHIFT) for 64-bit, to generate the random offset >>

Re: [PATCH v6 00/12]powerpc: "paca->soft_enabled" based local atomic operation implementation

2017-02-08 Thread Michael Ellerman
Madhavan Srinivasan writes: > Hi mpe, > > Any update on this series. Have also fixed the naming issue with patch 12 > and with this series applied, > > "paca->soft_enabled" becomes "paca->soft_disabled_mask" Yeah sorry I've been putting off dealing with it. Ideally

Re: [PATCH 2/3] powerpc/xmon: Apply binutils changes to upgrade disassembly

2017-02-08 Thread Michael Ellerman
Balbir Singh writes: > On Thu, Feb 02, 2017 at 04:16:41PM +0800, kbuild test robot wrote: >> Hi Balbir, >> >> [auto build test ERROR on powerpc/next] >> [also build test ERROR on v4.10-rc6 next-20170201] >> [if your patch is applied to the wrong git tree, please drop us a

Re: [PATCH 2/3] powerpc/xmon: Apply binutils changes to upgrade disassembly

2017-02-08 Thread Balbir Singh
On Thu, Feb 02, 2017 at 04:16:41PM +0800, kbuild test robot wrote: > Hi Balbir, > > [auto build test ERROR on powerpc/next] > [also build test ERROR on v4.10-rc6 next-20170201] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > FYI for

Re: [RFC PATCH 1/5] powerpc/mm/slice: Convert slice_mask high slice to a bitmap

2017-02-08 Thread Balbir Singh
On Tue, Feb 07, 2017 at 09:18:49AM +0530, Aneesh Kumar K.V wrote: > In followup patch we want to increase the va range which will result > in us requiring high_slices to have more than 64 bits. To enable this > convert high_slices to bitmap. We keep the number bits same in this patch > and later

Re: [PATCH] powerpc/irq: Improve/fix migrate_irqs()

2017-02-08 Thread Michael Ellerman
Benjamin Herrenschmidt writes: > migrate_irqs() is used by some platforms to migrate interrupts > away from a CPU about to be offlined. > > The current implementation had various issues such as not taking > the descriptor lock before manipulating it. ... and not

[PATCH v4 2/2] arch/powerpc: Optimize kprobe in kretprobe_trampoline

2017-02-08 Thread Anju T Sudhakar
Kprobe placed on the kretprobe_trampoline during boot time can be optimized, since the instruction at probe point is a 'nop'. Signed-off-by: Anju T Sudhakar Acked-by: Masami Hiramatsu --- arch/powerpc/kernel/kprobes.c | 8

[PATCH v4 0/2] OPTPROBES for powerpc

2017-02-08 Thread Anju T Sudhakar
This is the patchset of the kprobes jump optimization (a.k.a OPTPROBES)for powerpc. Kprobe being an inevitable tool for kernel developers, enhancing the performance of kprobe has got much importance. Currently kprobes inserts a trap instruction to probe a running kernel. Jump optimization allows

[PATCH v4 1/2] arch/powerpc: Implement Optprobes

2017-02-08 Thread Anju T Sudhakar
Current infrastructure of kprobe uses the unconditional trap instruction to probe a running kernel. Optprobe allows kprobe to replace the trap with a branch instruction to a detour buffer. Detour buffer contains instructions to create an in memory pt_regs. Detour buffer also has a call to

Re: [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce()

2017-02-08 Thread Paul Mackerras
On Tue, Feb 07, 2017 at 03:34:07PM +, Wei Yongjun wrote: > From: Wei Yongjun > > Fix to return error code -ENOMEM from the memory alloc error handling > case instead of 0, as done elsewhere in this function. > > Signed-off-by: Wei Yongjun >

Re: [PATCH 2/2] powerpc/powernv: Properly set "host-ipi" on IPIs

2017-02-08 Thread Michael Ellerman
Benjamin Herrenschmidt writes: > Otherwise KVM will fail to pass them through to the host OK, so this is: Fixes: d74361881f0d ("powerpc/xics: Add ICP OPAL backend") But seeing as the KVM support is only going into v4.11, I won't tag it for stable. Paul do you want

Re: [PATCH 1/2] powerpc/powernv: Fix CPU hotplug to handle waking on HVI

2017-02-08 Thread Michael Ellerman
Benjamin Herrenschmidt writes: > The IPIs come in as HVI not EE, so we need to test the appropriate > SRR1 bits. The encoding is such that it won't have false positives > on P7 and P8 so we can just test it like that. We also need to handle > the icp-opal variant of the

Re: [PATCH] powerpc/mm: Fix typo in set_pte_at()

2017-02-08 Thread Michael Ellerman
Gavin Shan writes: > On Mon, Feb 06, 2017 at 08:03:57AM +0530, Aneesh Kumar K.V wrote: >>Gavin Shan writes: >> >>> This fixes the typo about the _PAGE_PTE in set_pte_at() by changing >>> "tryint" to "trying to". >>> >>> Fixes: 6a119eae942

Re: [PATCH 1/1] powerpc/xmon: Dump memory in native endian format.

2017-02-08 Thread Michael Ellerman
Balbir Singh writes: > On Tue, Feb 07, 2017 at 07:40:44AM -0600, Douglas Miller wrote: >> Extend dump command to allow display of 2, 4, and 8 byte words in native >> endian format. Also adds dump command for "1 byte words" for the sake >> of symmetry. New commands are: >>

[PATCH 3/3] powerpc: kprobes: fixes for kprobe_lookup_name on BE

2017-02-08 Thread Anju T Sudhakar
From: "Naveen N. Rao" Fix two issues with kprobes.h on BE which were exposed with the optprobes work: - one, having to do with a missing include for linux/module.h for MODULE_NAME_LEN -- this didn't show up previously since the only users of kprobe_lookup_name

[PATCH 1/3] powerpc: asm/ppc-opcode.h: introduce __PPC_SH64()

2017-02-08 Thread Anju T Sudhakar
From: "Naveen N. Rao" Introduce __PPC_SH64() as a 64-bit variant to encode shift field in some of the shift and rotate instructions operating on double-words. Convert some of the BPF instruction macros to use the same. Signed-off-by: Naveen N. Rao

[PATCH 2/3] powerpc: add helper to check if offset is within rel branch range

2017-02-08 Thread Anju T Sudhakar
To permit the use of relative branch instruction in powerpc, the target address has to be relatively nearby, since the address is specified in an immediate field (24 bit filed) in the instruction opcode itself. Here nearby refers to 32MB on either side of the current instruction. This patch

Re: [PATCH 1/1] powerpc/xmon: Dump memory in native endian format.

2017-02-08 Thread Balbir Singh
On Tue, Feb 07, 2017 at 07:40:44AM -0600, Douglas Miller wrote: > Extend dump command to allow display of 2, 4, and 8 byte words in native > endian format. Also adds dump command for "1 byte words" for the sake > of symmetry. New commands are: > > d1 dump 8 bit values > d2

Re: [PATCH v2] powerpc/mm: Fix typo in set_pte_at()

2017-02-08 Thread Balbir Singh
On Wed, Feb 08, 2017 at 02:16:50PM +1100, Gavin Shan wrote: > This fixes the typo about the _PAGE_PTE in set_pte_at() by changing > "tryint" to "trying to". > > Signed-off-by: Gavin Shan > --- > v2: Removed "Fixes" tag Not much to ack, but Acked-by: Balbir Singh