[PATCH kernel v9 00/10] powerpc/kvm/vfio: Enable in-kernel acceleration

2017-03-16 Thread Alexey Kardashevskiy
This is my current queue of patches to add acceleration of TCE updates in KVM. This is based on Linus'es tree sha1 ae50dfd61665. Please comment. Thanks. Changes: v9: * renamed few exported symbols in 04/10 * reforked various objects reference counting in 10/10 v8: * kept fixing oddities with er

[PATCH kernel v9 02/10] powerpc/powernv/iommu: Add real mode version of iommu_table_ops::exchange()

2017-03-16 Thread Alexey Kardashevskiy
In real mode, TCE tables are invalidated using special cache-inhibited store instructions which are not available in virtual mode This defines and implements exchange_rm() callback. This does not define set_rm/clear_rm/flush_rm callbacks as there is no user for those - exchange/exchange_rm are onl

[PATCH kernel v9 03/10] powerpc/iommu/vfio_spapr_tce: Cleanup iommu_table disposal

2017-03-16 Thread Alexey Kardashevskiy
At the moment iommu_table can be disposed by either calling iommu_table_free() directly or it_ops::free(); the only implementation of free() is in IODA2 - pnv_ioda2_table_free() - and it calls iommu_table_free() anyway. As we are going to have reference counting on tables, we need an unified way o

[PATCH kernel v9 04/10] powerpc/vfio_spapr_tce: Add reference counting to iommu_table

2017-03-16 Thread Alexey Kardashevskiy
So far iommu_table obejcts were only used in virtual mode and had a single owner. We are going to change this by implementing in-kernel acceleration of DMA mapping requests. The proposed acceleration will handle requests in real mode and KVM will keep references to tables. This adds a kref to iomm

[PATCH kernel v9 06/10] KVM: PPC: Enable IOMMU_API for KVM_BOOK3S_64 permanently

2017-03-16 Thread Alexey Kardashevskiy
It does not make much sense to have KVM in book3s-64 and not to have IOMMU bits for PCI pass through support as it costs little and allows VFIO to function on book3s KVM. Having IOMMU_API always enabled makes it unnecessary to have a lot of "#ifdef IOMMU_API" in arch/powerpc/kvm/book3s_64_vio*. Wi

[PATCH kernel v9 07/10] KVM: PPC: Pass kvm* to kvmppc_find_table()

2017-03-16 Thread Alexey Kardashevskiy
The guest view TCE tables are per KVM anyway (not per VCPU) so pass kvm* there. This will be used in the following patches where we will be attaching VFIO containers to LIOBNs via ioctl() to KVM (rather than to VCPU). Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson --- arch/powerp

[PATCH kernel v9 08/10] KVM: PPC: Use preregistered memory API to access TCE list

2017-03-16 Thread Alexey Kardashevskiy
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. This makes use of the pre-registrered memory API to access TCE list pages in ord

[PATCH kernel v9 09/10] KVM: PPC: iommu: Unify TCE checking

2017-03-16 Thread Alexey Kardashevskiy
This reworks helpers for checking TCE update parameters in way they can be used in KVM. This should cause no behavioral change. Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson --- Changes: v6: * s/tce/gpa/ as TCE without permission bits is a GPA and this is what is passed everywhe

[PATCH kernel v9 10/10] KVM: PPC: VFIO: Add in-kernel acceleration for VFIO

2017-03-16 Thread Alexey Kardashevskiy
This allows the host kernel to handle H_PUT_TCE, H_PUT_TCE_INDIRECT and H_STUFF_TCE requests targeted an IOMMU TCE table used for VFIO without passing them to user space which saves time on switching to user space and back. This adds H_PUT_TCE/H_PUT_TCE_INDIRECT/H_STUFF_TCE handlers to KVM. KVM tr

[PATCH kernel v9 01/10] powerpc/mmu: Add real mode support for IOMMU preregistered memory

2017-03-16 Thread Alexey Kardashevskiy
This makes mm_iommu_lookup() able to work in realmode by replacing list_for_each_entry_rcu() (which can do debug stuff which can fail in real mode) with list_for_each_entry_lockless(). This adds realmode version of mm_iommu_ua_to_hpa() which adds explicit vmalloc'd-to-linear address conversion. Un

[PATCH kernel v9 05/10] KVM: PPC: Reserve KVM_CAP_SPAPR_TCE_VFIO capability number

2017-03-16 Thread Alexey Kardashevskiy
This adds a capability number for in-kernel support for VFIO on SPAPR platform. The capability will tell the user space whether in-kernel handlers of H_PUT_TCE can handle VFIO-targeted requests or not. If not, the user space must not attempt allocating a TCE table in the host kernel via the KVM_CR

[PATCH v5 00/13] IMC Instrumentation Support

2017-03-16 Thread Madhavan Srinivasan
Power9 has In-Memory-Collection (IMC) infrastructure which contains various Performance Monitoring Units (PMUs) at Nest level (these are on-chip but off-core), Core level and Thread level. The Nest PMU counters are handled by a Nest IMC microcode which runs in the OCC (On-Chip Controller) complex.

[PATCH v5 01/13] powerpc/powernv: Data structure and macros definitions

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Create new header file "imc-pmu.h" to add the data structures and macros needed for IMC pmu support. Cc: Gautham R. Shenoy Cc: Balbir Singh Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Anton Blanchard Cc: Sukadev Bhattiprolu Cc: Michael Neuling Cc: Stewart Smith C

[PATCH v5 02/13] powerpc/powernv: Autoload IMC device driver module

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar This patch does three things : - Enables "opal.c" to create a platform device for the IMC interface according to the appropriate compatibility string. - Find the reserved-memory region details from the system device tree and get the base address of HOMER (Reserved memor

[PATCH v5 03/13] powerpc/powernv: Detect supported IMC units and its events

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Parse device tree to detect IMC units. Traverse through each IMC unit node to find supported events and corresponding unit/scale files (if any). Here is the DTS file for reference: https://github.com/open-power/ima-catalog/blob/master/81E00612.4E0100.dts The device

[PATCH v5 04/13] powerpc/perf: Add event attribute and group to IMC pmus

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Device tree IMC driver code parses the IMC units and their events. It passes the information to IMC pmu code which is placed in powerpc/perf as "imc-pmu.c". This patch creates only event attributes and attribute groups for the IMC pmus. Cc: Gautham R. Shenoy Cc: Balbir Singh

[PATCH v5 05/13] powerpc/perf: Generic imc pmu event functions

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Since, the IMC counters' data are periodically fed to a memory location, the functions to read/update, start/stop, add/del can be generic and can be used by all IMC PMU units. This patch adds a set of generic imc pmu related event functions to be used by each imc pmu unit. Ad

[PATCH v5 06/13] powerpc/perf: IMC pmu cpumask and cpu hotplug support

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Adds cpumask attribute to be used by each IMC pmu. Only one cpu (any online CPU) from each chip for nest PMUs is designated to read counters. On CPU hotplug, dying CPU is checked to see whether it is one of the designated cpus, if yes, next online cpu from the same chip (for n

[PATCH v5 07/13] powerpc/powernv: Core IMC events detection

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar This patch adds support for detection of core IMC events along with the Nest IMC events. It adds a new domain IMC_DOMAIN_CORE and its determined with the help of the compatibility string "ibm,imc-counters-core" based on the IMC device tree. Cc: Gautham R. Shenoy Cc: Balbir Si

[PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and hotplugging

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar This patch adds the PMU function to initialize a core IMC event. It also adds cpumask initialization function for core IMC PMU. For initialization, a page of memory is allocated per core where the data for core IMC counters will be accumulated. The base address for this page is

[PATCH v5 09/13] powerpc/powernv: Thread IMC events detection

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar Patch adds support for detection of thread IMC events. It adds a new domain IMC_DOMAIN_THREAD and it is determined with the help of the compatibility string "ibm,imc-counters-thread" based on the IMC device tree. Cc: Gautham R. Shenoy Cc: Balbir Singh Cc: Benjamin Herrenschm

[PATCH 11/13] powerpc/powernv: Add device shutdown function for Core IMC

2017-03-16 Thread Madhavan Srinivasan
Core In Memory Collection device programs the hardware counters and have them runing always. But if the hardware counter were not stopped at device shutdown (like kexec), could lead to memory corruption. Patch to stop the hardware counters via device "shutdown" callback. Cc: Gautham R. Shenoy Cc:

[PATCH v5 10/13] powerpc/perf: Thread IMC PMU functions

2017-03-16 Thread Madhavan Srinivasan
From: Hemant Kumar This patch adds the PMU functions required for event initialization, read, update, add, del etc. for thread IMC PMU. Thread IMC PMUs are used for per-task monitoring. These PMUs don't need any hotplugging support. For each CPU, a page of memory is allocated and is kept static

[PATCH 13/13] powerpc/perf: Enable/disable core engine during cpuhotplug

2017-03-16 Thread Madhavan Srinivasan
From: Anju T Sudhakar This patch disables the core imc engine when we offline all the cpus available in a core. Also it enables core imc when any of the cpu in that core comes back. Enable/disable core imc is done through the opal calls OPAL_CORE_IMC_ENABLE and OPAL_CORE_IMC_DISABLE respectively

[PATCH 12/13] powerpc/perf: Thread imc cpuhotplug support

2017-03-16 Thread Madhavan Srinivasan
From: Anju T Sudhakar This patch adds support for thread IMC on cpuhotplug. When a cpu goes offline, the LDBAR for that cpu is disabled, and when it comes back online the previous ldbar value is written back to the LDBAR for that cpu. To register the hotplug functions for thread_imc, a new stat

[PATCH] arch/powerpc: Fix zImage wrapper with 64bit only toolchains

2017-03-16 Thread Cyril Bur
Historically the zImage wrapper has needed to be compiled 32bit to run on 32bit only platforms. Today some platforms can have 64bit wrappers as they've always been 64bit compatible, notably little endian systems. Problems arise when a kernel and zImage are cross compiled with a 64bit only toolchai

[PATCH v2] powerpc: handle simultaneous interrupts at once

2017-03-16 Thread Christophe Leroy
It often happens to have simultaneous interrupts, for instance when having double Ethernet attachment. With the current implementation, we suffer the cost of kernel entry/exit for each interrupt. This patch introduces a loop in __do_irq() to handle all interrupts at once before returning. Signed-

[PATCH] powerpc: Wire up statx() syscall

2017-03-16 Thread Chandan Rajendra
Test runs on a ppc64 BE guest succeeded. linux/samples/statx/test-statx program was executed on the following file types, 1. Regular file 2. Directory 3. device file 4. symlink 5. Named pipe The test run also included invoking test-statx with the runtime options provided in the main() function of

[PATCH] isdn: hardware: mISDN: Remove reference to CONFIG_8xx

2017-03-16 Thread Christophe Leroy
CONFIG_8xx is deprecated and should soon be removed in favor of CONFIG_PPC_8xx. Anyway, hfc_multi_8xx.h only uses 8xx I/O ports which are linked to the CPM1 communication processor included in the 8xx rather than the 8xx itself. This patch therefore makes it dependent on CONFIG_CPM1 instead, like

[PATCH] net: ethernet: fs_enet: Remove useless includes

2017-03-16 Thread Christophe Leroy
CONFIG_8xx is being deprecated. Since the includes dependent on CONFIG_8xx are useless, just drop them. Signed-off-by: Christophe Leroy --- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 6 -- drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 6 -- 2 files changed, 12 deletions(-)

RE: [PATCH 1/4] crypto: powerpc - Factor out the core CRC vpmsum algorithm

2017-03-16 Thread David Laight
From: Daniel Axtens > Sent: 15 March 2017 22:30 > Hi David, > > > While not part of this change, the unrolled loops look as though > > they just destroy the cpu cache. > > I'd like be convinced that anything does CRC over long enough buffers > > to make it a gain at all. > > > > With modern (not t

Re: [PATCH] drivers/pcmcia: NO_IRQ removal for electra_cf.c

2017-03-16 Thread Michael Ellerman
Scott Wood writes: > On Wed, 2017-03-15 at 16:35 +1100, Michael Ellerman wrote: >> I'll do patches for everything above that's not drivers/soc or >> include/soc and hopefully we can hear from someone at NXP on the plans >> for getting the soc parts enabled on arm. > > qe_ic is handled by https://l

Re: [PATCH] drivers/pcmcia: NO_IRQ removal for electra_cf.c

2017-03-16 Thread Michael Ellerman
Arnd Bergmann writes: > On Wed, Mar 15, 2017 at 6:35 AM, Michael Ellerman wrote: >> I'll do patches for everything above that's not drivers/soc or >> include/soc and hopefully we can hear from someone at NXP on the plans >> for getting the soc parts enabled on arm. > > I think the removal of the

Re: [PATCH] drivers/pcmcia: NO_IRQ removal for electra_cf.c

2017-03-16 Thread Arnd Bergmann
On Thu, Mar 16, 2017 at 10:55 AM, Michael Ellerman wrote: > Arnd Bergmann writes: >> On Wed, Mar 15, 2017 at 6:35 AM, Michael Ellerman >> wrote: >>> I'll do patches for everything above that's not drivers/soc or >>> include/soc and hopefully we can hear from someone at NXP on the plans >>> for

Re: [PATCH] powerpc/pasemi, cbe: Do not process decremeter or external wakeup from powersave

2017-03-16 Thread Michael Ellerman
Nicholas Piggin writes: > Hi, > > I would like to start using a dedicated stack for system reset interrupt > and treat it as a Linux nmi, which makes it tricky to call complex > interrupt handlers directly from the system reset trap handler. > > So I would like to remove the decrementer and exter

[PATCH V2 00/11] powerpc/mm/hash: Cleanup and fixes

2017-03-16 Thread Aneesh Kumar K.V
Hi, This series collect all the different patches sent before into one patch series. The patch series is also rebased on top of latest upstream linus. It also contain fixes to the patches posted earlier. Aneesh Kumar K.V (11): powerpc/mm/nohash: MM_SLICE is only used by book3s 64 powerpc/mm/

[PATCH V2 01/11] powerpc/mm/nohash: MM_SLICE is only used by book3s 64

2017-03-16 Thread Aneesh Kumar K.V
BOOKE code is dead code as per the Kconfig details. So make it simpler by enabling MM_SLICE only for book3s_64. The changes w.r.t nohash is just removing deadcode. W.r.t ppc64, 4k without hugetlb will now enable MM_SLICE. But that is good, because we reduce one extra variant which probably is not g

[PATCH V2 03/11] powerpc/mm: Cleanup bits definition between hash and radix.

2017-03-16 Thread Aneesh Kumar K.V
Define everything based on bits present in pgtable.h. This will help in easily identifying overlapping bits between hash/radix. No functional change with this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash-64k.h | 4 arch/powerpc/include/asm/book3s/64/h

[PATCH V2 02/11] powerpc/mm/slice: when computing slice mask limit lowe slice max addr correctly

2017-03-16 Thread Aneesh Kumar K.V
For low slice max addr should be less that 4G Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/slice.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 2b27458902ee..bf150557dba8 100644 --- a/arch/powerpc/mm/slice

[PATCH V2 04/11] powerpc/mm/radix: rename _PAGE_LARGE to R_PAGE_LARGE

2017-03-16 Thread Aneesh Kumar K.V
This bit is only used by radix and it is nice to follow the naming style of having bit name start with H_/R_ depending on which translation mode they are used. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hugetlb.h | 2 +- arch/powe

[PATCH V2 06/11] powerpc/mm/hugetlb: Filter out hugepage size not supported by page table layout

2017-03-16 Thread Aneesh Kumar K.V
Without this if firmware reports 1MB page size support we will crash trying to use 1MB as hugetlb page size. echo 300 > /sys/kernel/mm/hugepages/hugepages-1024kB/nr_hugepages kernel BUG at ./arch/powerpc/include/asm/hugetlb.h:19! . [c000e2c27b30] c029dae8 .hugetlb_fault+0x638

[PATCH V2 07/11] powerpc/mm: Conditional defines of pte bits are messy

2017-03-16 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 4 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index c39bc4cb9247..4d4ff9a324f0 100644 --- a/arch/powerpc/include/a

[PATCH V2 05/11] powerpc/mm: Add translation mode information in /proc/cpuinfo

2017-03-16 Thread Aneesh Kumar K.V
With this we have on powernv and pseries /proc/cpuinfo reporting timebase: 51200 platform: PowerNV model : 8247-22L machine : PowerNV 8247-22L firmware: OPAL MMU : Hash Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/platforms/powernv/s

[PATCH V2 09/11] powerpc/mm: Lower the max real address to 51 bits

2017-03-16 Thread Aneesh Kumar K.V
Max value supported by hardware is 51 bits address. Radix page table define a slot of 57 bits for future expansion. We restrict the value supported in linux kernel 51 bits, so that we can use the bits between 57-51 for storing hash linux page table bits. This is done in the next patch. This will f

[PATCH V2 08/11] powerpc/mm: Express everything based on Radix page table defines

2017-03-16 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash-64k.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgtable.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash

[PATCH V2 10/11] powerpc/mm/radix: Make max pfn bits a variable

2017-03-16 Thread Aneesh Kumar K.V
This makes max pysical address bits a variable so that hash and radix translation mode can choose what value to use. In this patch we also switch the radix translation mode to use 57 bits. This make it resilient to future changes to max pfn supported by platforms. This patch is split from the prev

[PATCH V2 11/11] powerpc/mm: Move hash specific pte bits to be top bits of RPN

2017-03-16 Thread Aneesh Kumar K.V
We don't support the full 57 bits of physical address and hence can overload the top bits of RPN as hash specific pte bits. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash.h| 18 ++ arch/powerpc/include/asm/book3s/64/pgtable.h | 19

[PATCH V4 00/14] powerpc/mm/ppc64: Add 128TB support

2017-03-16 Thread Aneesh Kumar K.V
This patch series increase the effective virtual address range of applications from 64TB to 128TB. We do that by supporting a 68 bit virtual address. On platforms that can only do 65 bit virtual address we limit the max contexts to a 16bit value instead of 19. The patch series also switch the pag

[PATCH V4 01/14] powerpc/mm/slice: Convert slice_mask high slice to a bitmap

2017-03-16 Thread Aneesh Kumar K.V
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 change that to higher value Signed-off-by: Aneesh Kumar K.V --- arch/powe

[PATCH V4 02/14] powerpc/mm/slice: Update the function prototype

2017-03-16 Thread Aneesh Kumar K.V
This avoid copying the slice_mask struct as function return value Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/slice.c | 62 ++--- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c

[PATCH V4 03/14] powerpc/mm: Move copy_mm_to_paca to paca.c

2017-03-16 Thread Aneesh Kumar K.V
We also update the function arg to struct mm_struct. Move this so that function finds the definition of struct mm_struct. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/paca.h | 18 +- arch/powerpc/kernel/paca.c | 19

[PATCH V4 06/14] powerpc/mm/slice: Update slice mask printing to use bitmap printing.

2017-03-16 Thread Aneesh Kumar K.V
We now get output like below which is much better. [0.935306] good_mask low_slice: 0-15 [0.935360] good_mask high_slice: 0-511 Compared to [0.953414] good_mask: - 1. I also fixed an error with slice_dbg printing. Signed-off-by: Aneesh Kumar K.

[PATCH V4 08/14] powerpc/mm/hash: Support 68 bit VA

2017-03-16 Thread Aneesh Kumar K.V
Inorder to support large effective address range (512TB), we want to increase the virtual address bits to 68. But we do have platforms like p4 and p5 that can only do 65 bit VA. We support those platforms by limiting context bits on them to 16. The protovsid -> vsid conversion is verified to work

[PATCH V4 07/14] powerpc/mm/hash: Move kernel context to the starting of context range

2017-03-16 Thread Aneesh Kumar K.V
With current kernel, we use the top 4 context for the kernel. Kernel VSIDs are built using these top context values and effective segemnt ID. In the following patches, we want to increase the max effective address to 512TB. We achieve that by increasing the effective segments IDs there by increas

[PATCH V4 04/14] powerpc/mm: Remove redundant TASK_SIZE_USER64 checks

2017-03-16 Thread Aneesh Kumar K.V
The check against VSID range is implied when we check task size against hash and radix pgtable range[1], because we make sure page table range cannot exceed vsid range. [1] BUILD_BUG_ON(TASK_SIZE_USER64 > H_PGTABLE_RANGE); BUILD_BUG_ON(TASK_SIZE_USER64 > RADIX_PGTABLE_RANGE); The check for smalle

[PATCH V4 09/14] powerpc/mm/hash: VSID 0 is no more an invalid VSID

2017-03-16 Thread Aneesh Kumar K.V
This is now used by linear mapped region of the kernel. User space still should not see a VSID 0. But having that VSID check confuse the reader. Remove the same and convert the error checking to be based on addr value Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/mmu-has

[PATCH V4 05/14] powerpc/mm/slice: Move slice_mask struct definition to slice.c

2017-03-16 Thread Aneesh Kumar K.V
This structure definition need not be in a header since this is used only by slice.c file. So move it to slice.c. This also allow us to use SLICE_NUM_HIGH instead of 64. I also switch the low_slices type to u64 from u16. This doesn't have an impact on size of struct due to padding added with u16 t

[PATCH V4 12/14] powerpc/mm/slice: Use mm task_size as max value of slice index

2017-03-16 Thread Aneesh Kumar K.V
In the followup patch, we will increase the slice array sice to handle 512TB range, but will limit the task size to 128TB. Avoid doing uncessary computation and avoid doing slice mask related operation above task_size. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/mmu-ha

[PATCH V4 13/14] powerpc/mm/hash64: Store task size in PACA

2017-03-16 Thread Aneesh Kumar K.V
We can optmize the slice page size array copy to paca by copying only the range based on task size. This will require us to not look at page size array beyond task size in PACA on slb fault. To enable that copy task size to paca which will be used during slb fault. We can take slb fault on an mm e

[PATCH V4 14/14] powerpc/mm/hash: Skip using reserved virtual address range

2017-03-16 Thread Aneesh Kumar K.V
Now that we use all the available virtual address range, we need to make sure we don't generate VSID such that it overlaps with the reserved vsid range. Reserved vsid range include the virtual address range used by the adjunct partition and also the VRMA virtual segment. We find the context value t

[PATCH V4 11/14] powerpc/mm/hash: Increase VA range to 128TB

2017-03-16 Thread Aneesh Kumar K.V
We update the hash linux page table layout such that we can support 512TB. But we limit the TASK_SIZE to 128TB. We can switch to 128TB by default without conditional because that is the max virtual address supported by other architectures. We will later add a mechanism to on-demand increase the app

[PATCH V4 10/14] powerpc/mm/hash: Convert mask to unsigned long

2017-03-16 Thread Aneesh Kumar K.V
This doesn't have any functional change. But helps in avoiding mistakes in case the shift bit changes Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.

Re: [PATCH 2/4] crypto: powerpc - Re-enable non-REFLECTed CRCs

2017-03-16 Thread Michael Ellerman
Daniel Axtens writes: > When CRC32c was included in the kernel, Anton ripped out > the #ifdefs around reflected polynomials, because CRC32c > is always reflected. However, not all CRCs use reflection > so we'd like to make it optional. > > Restore the REFLECT parts from Anton's original CRC32 > i

Re: [PATCH 1/4] crypto: powerpc - Factor out the core CRC vpmsum algorithm

2017-03-16 Thread Michael Ellerman
Daniel Axtens writes: > The core nuts and bolts of the crc32c vpmsum algorithm will > also work for a number of other CRC algorithms with different > polynomials. Factor out the function into a new asm file. > > To handle multiple users of the function, a user simply > provides constants, defines

Re: ioctl structs differ from x86_64?

2017-03-16 Thread Michael Ellerman
Harshal Patil writes: > Hello, > I am looking into a bug, https://bugzilla.linux.ibm.com/show_bug.cgi?id=152493 > ( external mirror is at, https://github.com/opencontainers/runc/issues/1364) > Recently in runc code, they added this code > https://github.com/opencontainers/runc/commit/eea28f480db

[PATCH updated] powerpc/mm/hash: Skip using reserved virtual address range

2017-03-16 Thread Aneesh Kumar K.V
Now that we use all the available virtual address range, we need to make sure we don't generate VSID such that it overlaps with the reserved vsid range. Reserved vsid range include the virtual address range used by the adjunct partition and also the VRMA virtual segment. We find the context value t

Re: [PATCH 1/4] crypto: powerpc - Factor out the core CRC vpmsum algorithm

2017-03-16 Thread Anton Blanchard
Hi David, > While not part of this change, the unrolled loops look as though > they just destroy the cpu cache. > I'd like be convinced that anything does CRC over long enough buffers > to make it a gain at all. btrfs data checksumming is one area. > With modern (not that modern now) superscalar

Re: [PATCH 2/8] powerpc/64s: stop using bit in HSPRG0 to test winkle

2017-03-16 Thread Gautham R Shenoy
Hi Nick, On Tue, Mar 14, 2017 at 07:23:43PM +1000, Nicholas Piggin wrote: > The POWER8 idle code has a neat trick of programming the power on engine > to restore a low bit into HSPRG0, so idle wakeup code can test and see > if it has been programmed this way and therefore lost all state, and > avo

Re: [PATCH 3/8] powerpc/64s: use alternative feature patching

2017-03-16 Thread Gautham R Shenoy
On Tue, Mar 14, 2017 at 07:23:44PM +1000, Nicholas Piggin wrote: > This reduces the number of nops for POWER8. Nice! > > Signed-off-by: Nicholas Piggin Reviewed-by: Gautham R. Shenoy > --- > arch/powerpc/kernel/idle_book3s.S | 19 --- > 1 file changed, 12 insertions(+), 7 del

Re: [PATCH 5/8] powerpc/64s: use PACA_THREAD_IDLE_STATE only in POWER8

2017-03-16 Thread Gautham R Shenoy
Hi Nick, On Tue, Mar 14, 2017 at 07:23:46PM +1000, Nicholas Piggin wrote: > POWER9 does not use this field, so it should be moved into the POWER8 > code. Update the documentation in the paca struct too. > > Signed-off-by: Nicholas Piggin > --- > arch/powerpc/include/asm/paca.h | 12 ++

Re: [PATCH 6/8] powerpc/64s: idle expand usable core idle state bits

2017-03-16 Thread Gautham R Shenoy
Hi Nick, On Tue, Mar 14, 2017 at 07:23:47PM +1000, Nicholas Piggin wrote: > In preparation for adding more bits to the core idle state word, > move the lock bit up, and unlock by flipping the lock bit rather > than masking off all but the thread bits. > > Add branch hints for atomic operations wh

Re: [PATCH 5/8] powerpc/64s: use PACA_THREAD_IDLE_STATE only in POWER8

2017-03-16 Thread Nicholas Piggin
On Thu, 16 Mar 2017 17:24:03 +0530 Gautham R Shenoy wrote: > Hi Nick, > > On Tue, Mar 14, 2017 at 07:23:46PM +1000, Nicholas Piggin wrote: > > POWER9 does not use this field, so it should be moved into the POWER8 > > code. Update the documentation in the paca struct too. > > > > Signed-off-by:

Re: [PATCH 4/8] powerpc/64s: fix POWER9 machine check handler from stop state

2017-03-16 Thread Mahesh Jagannath Salgaonkar
On 03/14/2017 02:53 PM, Nicholas Piggin wrote: > The ISA specifies power save wakeup can cause a machine check interrupt. > The machine check handler currently has code to handle that for POWER8, > but POWER9 crashes when trying to execute the P8 style sleep > instructions. > > So queue up the mac

Re: [PATCH 7/8] powerpc/64s: idle do not hold reservation longer than required

2017-03-16 Thread Gautham R Shenoy
Hi Nick, On Tue, Mar 14, 2017 at 07:23:48PM +1000, Nicholas Piggin wrote: > When taking the core idle state lock, grab it immediately like a > regular lock, rather than adding more tests in there. Holding the lock > keeps it stable, so there is no need to do it whole holding the > reservation. I

Re: [PATCH 1/4] crypto: powerpc - Factor out the core CRC vpmsum algorithm

2017-03-16 Thread Daniel Axtens
> So although this sits in arch/powerpc, it's heavy on the crypto which is > not my area of expertise (to say the least!), so I think it should > probably go via Herbert and the crypto tree? That was my thought as well. Sorry - probably should have put that in the comments somewhere. Regards, Dan

Re: [PATCH 7/8] powerpc/64s: idle do not hold reservation longer than required

2017-03-16 Thread Nicholas Piggin
On Thu, 16 Mar 2017 18:13:28 +0530 Gautham R Shenoy wrote: > Hi Nick, > > On Tue, Mar 14, 2017 at 07:23:48PM +1000, Nicholas Piggin wrote: > > When taking the core idle state lock, grab it immediately like a > > regular lock, rather than adding more tests in there. Holding the lock > > keeps it

Re: [PATCH 4/8] powerpc/64s: fix POWER9 machine check handler from stop state

2017-03-16 Thread Nicholas Piggin
On Thu, 16 Mar 2017 18:10:48 +0530 Mahesh Jagannath Salgaonkar wrote: > On 03/14/2017 02:53 PM, Nicholas Piggin wrote: > > The ISA specifies power save wakeup can cause a machine check interrupt. > > The machine check handler currently has code to handle that for POWER8, > > but POWER9 crashes wh

Re: [PATCH 4/8] powerpc/64s: fix POWER9 machine check handler from stop state

2017-03-16 Thread Gautham R Shenoy
Hi, On Thu, Mar 16, 2017 at 11:05:20PM +1000, Nicholas Piggin wrote: > On Thu, 16 Mar 2017 18:10:48 +0530 > Mahesh Jagannath Salgaonkar wrote: > > > On 03/14/2017 02:53 PM, Nicholas Piggin wrote: > > > The ISA specifies power save wakeup can cause a machine check interrupt. > > > The machine che

[PATCH 2/6] trace/kprobes: Fix check for kretprobe offset within function entry

2017-03-16 Thread Arnaldo Carvalho de Melo
From: "Naveen N. Rao" perf specifies an offset from _text and since this offset is fed directly into the arch-specific helper, kprobes tracer rejects installation of kretprobes through perf. Fix this by looking up the actual offset from a function for the specified sym+offset. Refactor and reuse

[GIT PULL 0/6] perf/core improvements and fixes

2017-03-16 Thread Arnaldo Carvalho de Melo
linux into perf/core (2017-03-15 19:27:27 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170316 for you to fetch changes up to 61f35d750683b21e9e3836e309195c79c1daed74: uprobes: Default UPROBES_E

Re: [PATCH 8/8] powerpc/64s: idle POWER8 avoid full state loss recovery when possible

2017-03-16 Thread Gautham R Shenoy
Hi Nick, On Tue, Mar 14, 2017 at 07:23:49PM +1000, Nicholas Piggin wrote: > If not all threads were in winkle, full state loss recovery is not > necessary and can be avoided. A previous patch removed this optimisation > due to some complexity with the implementation. Re-implement it by > counting

Re: [GIT PULL 0/6] perf/core improvements and fixes

2017-03-16 Thread Ingo Molnar
;perf-core-for-mingo-4.12-20170314' of > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core > (2017-03-15 19:27:27 +0100) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git > tags/perf-

Re: [PATCH kernel v9 10/10] KVM: PPC: VFIO: Add in-kernel acceleration for VFIO

2017-03-16 Thread Alex Williamson
On Thu, 16 Mar 2017 18:09:32 +1100 Alexey Kardashevskiy wrote: > This allows the host kernel to handle H_PUT_TCE, H_PUT_TCE_INDIRECT > and H_STUFF_TCE requests targeted an IOMMU TCE table used for VFIO > without passing them to user space which saves time on switching > to user space and back. >

RE: [PATCH 08/29] drivers, md: convert mddev.active from atomic_t to refcount_t

2017-03-16 Thread Reshetova, Elena
> On Tue, 2017-03-14 at 12:29 +, Reshetova, Elena wrote: > > > Elena Reshetova writes: > > > > > > > refcount_t type and corresponding API should be > > > > used instead of atomic_t when the variable is used as > > > > a reference counter. This allows to avoid accidental > > > > refcounter ove

Re: [PATCH] isdn: hardware: mISDN: Remove reference to CONFIG_8xx

2017-03-16 Thread David Miller
From: Christophe Leroy Date: Thu, 16 Mar 2017 10:18:02 +0100 (CET) > CONFIG_8xx is deprecated and should soon be removed in favor > of CONFIG_PPC_8xx. > Anyway, hfc_multi_8xx.h only uses 8xx I/O ports which are > linked to the CPM1 communication processor included in the 8xx > rather than the 8xx

Re: [PATCH] net: ethernet: fs_enet: Remove useless includes

2017-03-16 Thread David Miller
From: Christophe Leroy Date: Thu, 16 Mar 2017 10:18:04 +0100 (CET) > CONFIG_8xx is being deprecated. Since the includes dependent on > CONFIG_8xx are useless, just drop them. > > Signed-off-by: Christophe Leroy Applied.

[PATCH v2 1/2] powerpc/fadump: reserve memory at an offset closer to bottom of RAM

2017-03-16 Thread Hari Bathini
Currently, the area to preserve boot memory is reserved at the top of RAM. This leaves fadump vulnerable to memory hot-remove operations. As memory for fadump has to be reserved early in the boot process, fadump can't be registered after a memory hot-remove operation. Though this problem can't be e

[PATCH v2 2/2] powerpc/fadump: update fadump documentation

2017-03-16 Thread Hari Bathini
With the unnecessary restriction to reserve memory for fadump at the top of RAM forgone, update the documentation accordingly. Signed-off-by: Hari Bathini --- Documentation/powerpc/firmware-assisted-dump.txt | 34 +++--- 1 file changed, 17 insertions(+), 17 deletions(-) diff -

Re: [PATCH] kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()

2017-03-16 Thread Tejun Heo
On Tue, Mar 14, 2017 at 08:17:00AM +0530, Vaibhav Jain wrote: > Recently started seeing a kernel oops when a module tries removing a > memory mapped sysfs bin_attribute. On closer investigation the root > cause seems to be kernfs_release_file() trying to call > kernfs_op.release() callback that's N

Re: [PATCH] kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()

2017-03-16 Thread Tejun Heo
Hello, Greg. On Tue, Mar 14, 2017 at 11:08:29AM +0800, Greg Kroah-Hartman wrote: > Tejun, want to take this through your tree, or at the least, give me an > ack for this? Just acked. I think going through your tree is better for this one. Thanks! -- tejun

Re: [PATCH V2 09/11] powerpc/mm: Lower the max real address to 51 bits

2017-03-16 Thread Benjamin Herrenschmidt
On Thu, 2017-03-16 at 16:02 +0530, Aneesh Kumar K.V wrote: > Max value supported by hardware is 51 bits address. Radix page table define > a slot of 57 bits for future expansion. We restrict the value supported in > linux kernel 51 bits, so that we can use the bits between 57-51 for storing > hash

Re: [PATCH V2 01/11] powerpc/mm/nohash: MM_SLICE is only used by book3s 64

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:01:59PM +0530, Aneesh Kumar K.V wrote: > BOOKE code is dead code as per the Kconfig details. So make it simpler > by enabling MM_SLICE only for book3s_64. The changes w.r.t nohash is just > removing deadcode. W.r.t ppc64, 4k without hugetlb will now enable MM_SLICE. > But

Re: [PATCH V2 11/11] powerpc/mm: Move hash specific pte bits to be top bits of RPN

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:09PM +0530, Aneesh Kumar K.V wrote: > We don't support the full 57 bits of physical address and hence can overload > the top bits of RPN as hash specific pte bits. > > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/hash.h| 18 ++--

Re: [PATCH V2 08/11] powerpc/mm: Express everything based on Radix page table defines

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:06PM +0530, Aneesh Kumar K.V wrote: > Signed-off-by: Aneesh Kumar K.V This change seems correct, but of minimal benefit. The subject could be better expressed. How about "Define all PTE bits based on radix definitions" or something like that? "Everything" is a bit

Re: [PATCH V2 04/11] powerpc/mm/radix: rename _PAGE_LARGE to R_PAGE_LARGE

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:02PM +0530, Aneesh Kumar K.V wrote: > This bit is only used by radix and it is nice to follow the naming style of > having > bit name start with H_/R_ depending on which translation mode they are used. > > No functional change in this patch. > > Signed-off-by: Anees

Re: [PATCH V2 06/11] powerpc/mm/hugetlb: Filter out hugepage size not supported by page table layout

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:04PM +0530, Aneesh Kumar K.V wrote: > Without this if firmware reports 1MB page size support we will crash > trying to use 1MB as hugetlb page size. > > echo 300 > /sys/kernel/mm/hugepages/hugepages-1024kB/nr_hugepages > > kernel BUG at ./arch/powerpc/include/asm/hug

Re: [PATCH V2 02/11] powerpc/mm/slice: when computing slice mask limit lowe slice max addr correctly

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:00PM +0530, Aneesh Kumar K.V wrote: > For low slice max addr should be less that 4G than A more verbose explanation of the off-by-1 error that you are fixing is needed here. Tell us what goes wrong with the current code an

Re: [PATCH V2 10/11] powerpc/mm/radix: Make max pfn bits a variable

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:08PM +0530, Aneesh Kumar K.V wrote: > This makes max pysical address bits a variable so that hash and radix > translation mode can choose what value to use. In this patch we also switch > the > radix translation mode to use 57 bits. This make it resilient to future >

Re: [PATCH V2 03/11] powerpc/mm: Cleanup bits definition between hash and radix.

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:01PM +0530, Aneesh Kumar K.V wrote: > Define everything based on bits present in pgtable.h. This will help in easily > identifying overlapping bits between hash/radix. > > No functional change with this patch. > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Paul M

Re: [PATCH V2 09/11] powerpc/mm: Lower the max real address to 51 bits

2017-03-16 Thread Paul Mackerras
On Thu, Mar 16, 2017 at 04:02:07PM +0530, Aneesh Kumar K.V wrote: > Max value supported by hardware is 51 bits address. Radix page table define > a slot of 57 bits for future expansion. We restrict the value supported in > linux kernel 51 bits, so that we can use the bits between 57-51 for storing

  1   2   >