Re: [PATCH] cpufreq: powernv: Use node ID in init_chip_info

2016-10-20 Thread Shilpasri G Bhat
Hi, On 10/20/2016 09:29 AM, Viresh Kumar wrote: > + few IBM guys who have been working on this. > > On 19-10-16, 15:02, Emily Shaffer wrote: >> Fixed assumption that node_id==chip_id in powernv-cpufreq.c:init_chip_info; >> explicitly use node ID where necessary. Thanks for the bug fix. I agree t

Re: [PATCH kernel v3 3/4] vfio/spapr: Cache mm in tce_container

2016-10-20 Thread Nicholas Piggin
On Thu, 20 Oct 2016 14:03:49 +1100 Alexey Kardashevskiy wrote: > In some situations the userspace memory context may live longer than > the userspace process itself so if we need to do proper memory context > cleanup, we better cache @mm and use it later when the process is gone > (@current or @c

Re: [RFC] ppc64le: Enable emulation support for simple Load/Store instructions

2016-10-20 Thread Greg KH
On Thu, Oct 20, 2016 at 12:01:55PM +0530, Ravi Bangoria wrote: > emulate_step() uses a number of underlying kernel functions that were > initially not enabled for LE. This has been rectified since. So, fix > emulate_step() for LE for the corresponding instructions. > > Reported-by: Anton Blanchard

[RFC][PATCH] powerpc/pseries: implement NMI IPIs with H_SIGNAL_SYS_RESET hcall

2016-10-20 Thread Nicholas Piggin
Add a .cause_nmi_ipi() to smp_ops to support it. Although it's possible to raise a system reset exception on this CPU, which may (or may not) be useful to bring ourselves into a known state. So perhaps it's better make this a platform operation? Thanks, Nick --- arch/powerpc/include/asm/hvcall.h

Re: [PATCH] kernel: irq: fix build failure

2016-10-20 Thread Thomas Gleixner
On Mon, 10 Oct 2016, Sudip Mukherjee wrote: > On Thursday 06 October 2016 11:06 PM, Sudip Mukherjee wrote: > > The allmodconfig build of powerpc is failing with the error: > > ERROR: ".irq_set_parent" [drivers/mfd/tps65217.ko] undefined! > > > > export the symbol to fix the failure. > > Hi Thoma

Re: [PATCH v4 3/5] powerpc/mm: allow memory hotplug into a memoryless node

2016-10-20 Thread Reza Arbab
On Thu, Oct 20, 2016 at 02:30:42PM +1100, Balbir Singh wrote: FYI, these checks were temporary to begin with I found this in git history b226e462124522f2f23153daff31c311729dfa2f (powerpc: don't add memory to empty node/zone) Nice find! I spent some time digging, but this had eluded me. -- R

[PATCH v5 0/9] implement vcpu preempted check

2016-10-20 Thread Pan Xinhui
change from v4: spilt x86 kvm vcpu preempted check into two patches. add documentation patch. add x86 vcpu preempted check patch under xen add s390 vcpu preempted check patch change from v3: add x86 vcpu preempted check patch change from v2: no code

[PATCH v5 1/9] kernel/sched: introduce vcpu preempted check interface

2016-10-20 Thread Pan Xinhui
This patch support to fix lock holder preemption issue. For kernel users, we could use bool vcpu_is_preempted(int cpu) to detech if one vcpu is preempted or not. The default implementation is a macro defined by false. So compiler can wrap it out if arch dose not support such vcpu pteempted check.

[PATCH v5 2/9] locking/osq: Drop the overload of osq_lock()

2016-10-20 Thread Pan Xinhui
An over-committed guest with more vCPUs than pCPUs has a heavy overload in osq_lock(). This is because vCPU A hold the osq lock and yield out, vCPU B wait per_cpu node->locked to be set. IOW, vCPU B wait vCPU A to run and unlock the osq lock. Kernel has an interface bool vcpu_is_preempted(int cpu

[PATCH v5 3/9] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner

2016-10-20 Thread Pan Xinhui
An over-committed guest with more vCPUs than pCPUs has a heavy overload in the two spin_on_owner. This blames on the lock holder preemption issue. Kernel has an interface bool vcpu_is_preempted(int cpu) to see if a vCPU is currently running or not. So break the spin loops on true condition. test-

[PATCH v5 4/9] powerpc/spinlock: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself. Currently kernel has an interface of bool vcpu_is_preempted(int cpu). It takes the cpu as parameter and return true if the cpu is preempted. Then kernel can break the

[PATCH v5 5/9] x86, paravirt: Add interface to support kvm/xen vcpu preempted check

2016-10-20 Thread Pan Xinhui
This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself. Currently kernel has an interface of bool vcpu_is_preempted(int cpu). It takes the cpu as parameter and return true if the cpu is preempted. Then kernel can break the

[PATCH v5 6/9] x86, kvm: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
Support the vcpu_is_preempted() functionality under KVM. This will enhance lock performance on overcommitted hosts (more runnable vcpus than physical cpus in the system) as doing busy waits for preempted vcpus will hurt system performance far worse than early yielding. Use one field of struct kvm_

[PATCH v5 7/9] x86, xen: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
From: Juergen Gross Support the vcpu_is_preempted() functionality under Xen. This will enhance lock performance on overcommitted hosts (more runnable vcpus than physical cpus in the system) as doing busy waits for preempted vcpus will hurt system performance far worse than early yielding. A quic

[PATCH v5 8/9] s390/spinlock: Provide vcpu_is_preempted

2016-10-20 Thread Pan Xinhui
From: Christian Borntraeger this implements the s390 backend for commit "kernel/sched: introduce vcpu preempted check interface" by reworking the existing smp_vcpu_scheduled into arch_vcpu_is_preempted. We can then also get rid of the local cpu_is_preempted function by moving the CIF_ENABLED_WAIT

[PATCH v5 9/9] Documentation: virtual: kvm: Support vcpu preempted check

2016-10-20 Thread Pan Xinhui
Commit ("x86, kvm: support vcpu preempted check") add one field "__u8 preempted" into struct kvm_steal_time. This field tells if one vcpu is running or not. It is zero if 1) some old KVM deos not support this filed. 2) the vcpu is preempted. Other values means the vcpu has been preempted. Signed-

Re: [PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags

2016-10-20 Thread Michal Hocko
On Wed 19-10-16 10:23:55, Dave Hansen wrote: > On 10/19/2016 10:01 AM, Michal Hocko wrote: > > The question I had earlier was whether this has to be an explicit FOLL > > flag used by g-u-p users or we can just use it internally when mm != > > current->mm > > The reason I chose not to do that was t

Re: [PATCH v6] powerpc: Do not make the entire heap executable

2016-10-20 Thread Jason Gunthorpe
On Tue, Oct 04, 2016 at 09:54:12AM -0700, Kees Cook wrote: > On Mon, Oct 3, 2016 at 5:18 PM, Michael Ellerman wrote: > > Kees Cook writes: > > > >> On Mon, Oct 3, 2016 at 9:13 AM, Denys Vlasenko wrote: > >>> On 32-bit powerpc the ELF PLT sections of binaries (built with --bss-plt, > >>> or with

Re: [PATCH kernel v3 1/4] powerpc/iommu: Pass mm_struct to init/cleanup helpers

2016-10-20 Thread David Gibson
On Thu, Oct 20, 2016 at 02:03:47PM +1100, Alexey Kardashevskiy wrote: > We are going to get rid of @current references in mmu_context_boos3s64.c > and cache mm_struct in the VFIO container. Since mm_context_t does not > have reference counting, we will be using mm_struct which does have > the refer

Re: [PATCH kernel v3 2/4] powerpc/iommu: Stop using @current in mm_iommu_xxx

2016-10-20 Thread David Gibson
On Thu, Oct 20, 2016 at 02:03:48PM +1100, Alexey Kardashevskiy wrote: > This changes mm_iommu_xxx helpers to take mm_struct as a parameter > instead of getting it from @current which in some situations may > not have a valid reference to mm. > > This changes helpers to receive @mm and moves all re

[PATCH] powerpc/book3s64: Always build for power4 or later

2016-10-20 Thread Michael Ellerman
When we're not compiling for a specific CPU, ie. none of the CONFIG_POWERx_CPU options are set, and CONFIG_GENERIC_CPU *is* set, we currently don't pass any -mcpu option to the compiler. This means the compiler builds for a "generic" Power CPU. But back in 2014 we dropped support for pre power4 CP

Re: [PATCH] kernel: irq: fix build failure

2016-10-20 Thread Stephen Rothwell
Hi Thomas, On Thu, 20 Oct 2016 14:55:45 +0200 (CEST) Thomas Gleixner wrote: > > On Mon, 10 Oct 2016, Sudip Mukherjee wrote: > > > On Thursday 06 October 2016 11:06 PM, Sudip Mukherjee wrote: > > > The allmodconfig build of powerpc is failing with the error: > > > ERROR: ".irq_set_parent" [dri

Re: [PATCH kernel v3 3/4] vfio/spapr: Cache mm in tce_container

2016-10-20 Thread David Gibson
On Thu, Oct 20, 2016 at 06:31:21PM +1100, Nicholas Piggin wrote: > On Thu, 20 Oct 2016 14:03:49 +1100 > Alexey Kardashevskiy wrote: > > > In some situations the userspace memory context may live longer than > > the userspace process itself so if we need to do proper memory context > > cleanup, we

Re: [PATCH kernel v3 4/4] powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown

2016-10-20 Thread David Gibson
On Thu, Oct 20, 2016 at 02:03:50PM +1100, Alexey Kardashevskiy wrote: > At the moment the userspace tool is expected to request pinning of > the entire guest RAM when VFIO IOMMU SPAPR v2 driver is present. > When the userspace process finishes, all the pinned pages need to > be put; this is done as

Re: [PATCH kernel v3 3/4] vfio/spapr: Cache mm in tce_container

2016-10-20 Thread David Gibson
On Thu, Oct 20, 2016 at 02:03:49PM +1100, Alexey Kardashevskiy wrote: > In some situations the userspace memory context may live longer than > the userspace process itself so if we need to do proper memory context > cleanup, we better cache @mm and use it later when the process is gone > (@current

Re: [PATCH v5 9/9] Documentation: virtual: kvm: Support vcpu preempted check

2016-10-20 Thread Boqun Feng
On Thu, Oct 20, 2016 at 05:27:54PM -0400, Pan Xinhui wrote: > Commit ("x86, kvm: support vcpu preempted check") add one field "__u8 > preempted" into struct kvm_steal_time. This field tells if one vcpu is > running or not. > > It is zero if 1) some old KVM deos not support this filed. 2) the vcpu

Re: [PATCH v5 9/9] Documentation: virtual: kvm: Support vcpu preempted check

2016-10-20 Thread Pan Xinhui
在 2016/10/21 09:23, Boqun Feng 写道: On Thu, Oct 20, 2016 at 05:27:54PM -0400, Pan Xinhui wrote: Commit ("x86, kvm: support vcpu preempted check") add one field "__u8 preempted" into struct kvm_steal_time. This field tells if one vcpu is running or not. It is zero if 1) some old KVM deos not su

Re: [PATCH kernel v3 3/4] vfio/spapr: Cache mm in tce_container

2016-10-20 Thread Nicholas Piggin
On Fri, 21 Oct 2016 11:21:34 +1100 David Gibson wrote: > On Thu, Oct 20, 2016 at 06:31:21PM +1100, Nicholas Piggin wrote: > > On Thu, 20 Oct 2016 14:03:49 +1100 > > Alexey Kardashevskiy wrote: > > > > > In some situations the userspace memory context may live longer than > > > the userspace p

[PATCH v9 00/10] kexec_file_load implementation for PowerPC

2016-10-20 Thread Thiago Jung Bauermann
Hello, This version has the following changes: 1. Rebased on v4.9-rc1. This should fix the conflicts in next and -mm that these patches were having with the s/CONFIG_WORD_SIZE/BITS/ change. 2. Changed patch "powerpc: Factor out relocation code in module_64.c" to make as little changes as p

[PATCH v9 01/10] kexec_file: Allow arch-specific memory walking for kexec_add_buffer

2016-10-20 Thread Thiago Jung Bauermann
Allow architectures to specify a different memory walking function for kexec_add_buffer. x86 uses iomem to track reserved memory ranges, but PowerPC uses the memblock subsystem. Signed-off-by: Thiago Jung Bauermann Acked-by: Dave Young Acked-by: Balbir Singh --- include/linux/kexec.h | 29 ++

[PATCH v9 02/10] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.

2016-10-20 Thread Thiago Jung Bauermann
This is done to simplify the kexec_add_buffer argument list. Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. In addition, change the type of kexec_buf.buffer from char * to void *. There is no particular reason for it to be a char *, and the change allows us to get rid of 3 ex

[PATCH v9 03/10] kexec_file: Factor out kexec_locate_mem_hole from kexec_add_buffer.

2016-10-20 Thread Thiago Jung Bauermann
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load implementation to find free memory for the purgatory stack. Signed-off-by: Thiago Jung Bauermann Acked-by: Dave Young --- include/linux/kexec.h | 1 + kernel/kexec_file.c | 25 - 2 files changed, 21 ins

[PATCH v9 04/10] powerpc: Change places using CONFIG_KEXEC to use CONFIG_KEXEC_CORE instead.

2016-10-20 Thread Thiago Jung Bauermann
Commit 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code") introduced CONFIG_KEXEC_CORE so that CONFIG_KEXEC means whether the kexec_load system call should be compiled-in and CONFIG_KEXEC_FILE means whether the kexec_file_load system call should be compiled-in. These options can

[PATCH v9 05/10] powerpc: Factor out relocation code in module_64.c

2016-10-20 Thread Thiago Jung Bauermann
The kexec_file_load system call needs to relocate the purgatory, so factor out the module relocation code so that it can be shared. This patch's purpose is to move the ELF relocation logic from apply_relocate_add to the new function elf64_apply_relocate_add_item with as few changes as possible. Th

[PATCH v9 06/10] powerpc: Implement kexec_file_load.

2016-10-20 Thread Thiago Jung Bauermann
Add arch-specific functions needed by generic kexec_file code. Also, module_64.c's apply_relocate_add and kexec_file's arch_kexec_apply_relocations_add have slightly different needs, so elf64_apply_relocate_add_item needs to be adapted to accommodate both: When apply_relocate_add is called, the m

[PATCH v9 07/10] powerpc: Add functions to read ELF files of any endianness.

2016-10-20 Thread Thiago Jung Bauermann
A little endian kernel might need to kexec a big endian kernel (the opposite is less likely but could happen as well), so we can't just cast the buffer with the binary to ELF structs and use them as is done elsewhere. This patch adds functions which do byte-swapping as necessary when populating th

[PATCH v9 08/10] powerpc: Add support for loading ELF kernels with kexec_file_load.

2016-10-20 Thread Thiago Jung Bauermann
This uses all the infrastructure built up by the previous patches in the series to load an ELF vmlinux file and an initrd. It uses the flattened device tree at initial_boot_params as a base and adjusts memory reservations and its /chosen node for the next kernel. [a...@linux-foundation.org: coding

[PATCH v9 09/10] powerpc: Add purgatory for kexec_file_load implementation.

2016-10-20 Thread Thiago Jung Bauermann
This purgatory implementation comes from kexec-tools, almost unchanged. In order to use boot/string.S in ppc64 big endian mode, the functions defined in it need to have dot symbols so that they can be called from C code. Therefore, change the file to use a DOTSYM macro if one is defined, so that t

[PATCH v9 10/10] powerpc: Enable CONFIG_KEXEC_FILE in powerpc server defconfigs.

2016-10-20 Thread Thiago Jung Bauermann
Enable CONFIG_KEXEC_FILE in powernv_defconfig, ppc64_defconfig and pseries_defconfig. It depends on CONFIG_CRYPTO_SHA256=y, so add that as well. Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/configs/powernv_defconfig | 2 ++ arch/powerpc/configs/ppc64_defconfig | 2 ++ arch/powerpc/co

[PATCH v6 02/10] ima: on soft reboot, restore the measurement list

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar The TPM PCRs are only reset on a hard reboot. In order to validate a TPM's quote after a soft reboot (eg. kexec -e), the IMA measurement list of the running kernel must be saved and restored on boot. This patch restores the measurement list. Changelog v5: - replace CONFIG_KEXE

[PATCH v6 03/10] ima: permit duplicate measurement list entries

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar Measurements carried across kexec need to be added to the IMA measurement list, but should not prevent measurements of the newly booted kernel from being added to the measurement list. This patch adds support for allowing duplicate measurements. The "boot_aggregate" measurement

[PATCH v6 00/10] ima: carry the measurement list across kexec

2016-10-20 Thread Thiago Jung Bauermann
Hello, This is just a rebase on top of kexec_file_load patches v9 which I just posted. The previous version of this series has some conflicts with it. Original cover letter: The TPM PCRs are only reset on a hard reboot. In order to validate a TPM's quote after a soft reboot (eg. kexec -e), the

[PATCH v6 04/10] ima: maintain memory size needed for serializing the measurement list

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar In preparation for serializing the binary_runtime_measurements, this patch maintains the amount of memory required. Changelog v5: - replace CONFIG_KEXEC_FILE with architecture CONFIG_HAVE_IMA_KEXEC (Thiago) Changelog v3: - include the ima_kexec_hdr size in the binary_runtime_me

[PATCH v6 01/10] powerpc: ima: Get the kexec buffer passed by the previous kernel

2016-10-20 Thread Thiago Jung Bauermann
The IMA kexec buffer allows the currently running kernel to pass the measurement list via a kexec segment to the kernel that will be kexec'd. The second kernel can check whether the previous kernel sent the buffer and retrieve it. This is the architecture-specific part which enables IMA to receive

[PATCH v6 05/10] powerpc: ima: Send the kexec buffer to the next kernel

2016-10-20 Thread Thiago Jung Bauermann
The IMA kexec buffer allows the currently running kernel to pass the measurement list via a kexec segment to the kernel that will be kexec'd. This is the architecture-specific part of setting up the IMA kexec buffer for the next kernel. It will be used in the next patch. Changelog v5: - New patch

[PATCH v6 06/10] ima: on soft reboot, save the measurement list

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar The TPM PCRs are only reset on a hard reboot. In order to validate a TPM's quote after a soft reboot (eg. kexec -e), the IMA measurement list of the running kernel must be saved and restored on boot. This patch uses the kexec buffer passing mechanism to pass the serialized IMA

[PATCH v6 07/10] ima: store the builtin/custom template definitions in a list

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar The builtin and single custom templates are currently stored in an array. In preparation for being able to restore a measurement list containing multiple builtin/custom templates, this patch stores the builtin and custom templates as a linked list. This will permit defining mor

[PATCH v6 08/10] ima: support restoring multiple template formats

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar The configured IMA measurement list template format can be replaced at runtime on the boot command line, including a custom template format. This patch adds support for restoring a measuremement list containing multiple builtin/custom template formats. Signed-off-by: Mimi Zohar

[PATCH v6 09/10] ima: define a canonical binary_runtime_measurements list format

2016-10-20 Thread Thiago Jung Bauermann
From: Mimi Zohar The IMA binary_runtime_measurements list is currently in platform native format. To allow restoring a measurement list carried across kexec with a different endianness than the targeted kernel, this patch defines little-endian as the canonical format. For big endian systems wan

[PATCH v6 10/10] ima: platform-independent hash value

2016-10-20 Thread Thiago Jung Bauermann
From: Andreas Steffen For remote attestion it is important for the ima measurement values to be platform-independent. Therefore integer fields to be hashed must be converted to canonical format. Changelog: - Define canonical format as little endian (Mimi) Signed-off-by: Andreas Steffen Signed-

Re: [PATCH] powerpc/book3s64: Always build for power4 or later

2016-10-20 Thread Balbir Singh
On 21/10/16 11:01, Michael Ellerman wrote: > When we're not compiling for a specific CPU, ie. none of the > CONFIG_POWERx_CPU options are set, and CONFIG_GENERIC_CPU *is* set, we > currently don't pass any -mcpu option to the compiler. This means the > compiler builds for a "generic" Power CPU. >

Re: [PATCH v5 7/9] x86, xen: support vcpu preempted check

2016-10-20 Thread Juergen Gross
Corrected xen-devel mailing list address, added other Xen maintainers On 20/10/16 23:27, Pan Xinhui wrote: > From: Juergen Gross > > Support the vcpu_is_preempted() functionality under Xen. This will > enhance lock performance on overcommitted hosts (more runnable vcpus > than physical cpus in t

Re: [PATCH v5 0/9] implement vcpu preempted check

2016-10-20 Thread Peter Zijlstra
On Thu, Oct 20, 2016 at 05:27:45PM -0400, Pan Xinhui wrote: > > This patch set aims to fix lock holder preemption issues. Thanks, this looks very good. I'll wait for ACKs from at least the KVM people, since that was I think the most contentious patch.

[PATCH] cxl: Fix leaking pid refs in some error paths

2016-10-20 Thread Vaibhav Jain
In some error paths in functions cxl_start_context and afu_ioctl_start_work pid references to the current & group-leader tasks can leak after they are taken. This patch fixes these error paths to release these pid references before exiting the error path. This patch is based on earlier patch "cxl:

Re: [PATCH] cxl: Fix leaking pid refs in some error paths

2016-10-20 Thread Andrew Donnellan
On 21/10/16 16:46, Vaibhav Jain wrote: In some error paths in functions cxl_start_context and afu_ioctl_start_work pid references to the current & group-leader tasks can leak after they are taken. This patch fixes these error paths to release these pid references before exiting the error path. T

Re: [PATCH 0/7] build updates (and RFC on one-pass kallsyms generation)

2016-10-20 Thread Nicholas Piggin
On Wed, 19 Oct 2016 18:44:22 +1100 Nicholas Piggin wrote: > On Wed, 19 Oct 2016 14:15:53 +1100 > Nicholas Piggin wrote: > > > [*] Building allyesconfig still requires KALLSYMS_EXTRA_PASS=1, which > > I'm yet to look into. > > Oh, it's because the kallsyms payload increases kernel image s