Re: [PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Naveen N. Rao
Hi Santosh, This seems to have gone from v4 to v6 -- did I miss v5? On 2017/10/10 11:10PM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the resp

Re: [PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
* Naveen N. Rao wrote (on 2017-10-11 07:04:43 +): > Hi Santosh, > This seems to have gone from v4 to v6 -- did I miss v5? Nope, this is indeed v5, a typo :-( > > On 2017/10/10 11:10PM, Santosh Sivaraj wrote: > > Current vDSO64 implementation does not have support for coarse clocks > > (CLOC

[PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
Current vDSO64 implementation does not have support for coarse clocks (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back to system call, increasing the response time, vDSO implementation reduces the cycle time. Below is a benchmark of the difference in execution times. (Non-c

Re: [PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Naveen N. Rao
On 2017/10/11 08:35AM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the response time, vDSO implementation reduces > the cycle time. Below is a b

Re: [PATCH] powerpc/powernv: Add kernel cmdline parameter to disable imc

2017-10-11 Thread Anju T Sudhakar
Hi mpe, stewart, On Wednesday 11 October 2017 01:55 AM, Stewart Smith wrote: Michael Ellerman writes: Anju T Sudhakar writes: Add a kernel command line parameter option to disable In-Memory Collection (IMC) counters and add documentation. This helps in debug. I'd really rather we didn't.

Re: [PATCH v2] cxl: Dump PSL_FIR register on PSL9 error irq

2017-10-11 Thread Frederic Barrat
Le 11/10/2017 à 08:14, Vaibhav Jain a écrit : For PSL9 currently we aren't dumping the PSL FIR register when a PSL error interrupt is triggered. Contents of this register are useful in debugging AFU issues. This patch fixes issue by adding a new service_layer_ops callback cxl_native_err_irq_du

Re: [PATCH v4 19/20] x86/mm: Add speculative pagefault handling

2017-10-11 Thread Laurent Dufour
On 10/10/2017 23:23, Andrew Morton wrote: > On Mon, 9 Oct 2017 12:07:51 +0200 Laurent Dufour > wrote: > >> +/* >> + * Advertise that we call the Speculative Page Fault handler. >> + */ >> +#if defined(CONFIG_X86_64) && defined(CONFIG_SMP) >> +#define __HAVE_ARCH_CALL_SPF >> +#endif > > Here's

Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-11 Thread Kamalesh Babulal
On Friday 06 October 2017 11:13 AM, Kamalesh Babulal wrote: On Thursday 05 October 2017 06:13 PM, Torsten Duwe wrote: On Wed, Oct 04, 2017 at 11:25:16AM -0400, Kamalesh Babulal wrote: Both the failures with REL24 livepatch symbols relocation, can be resolved by constructing a new livepatch stu

Re: [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()

2017-10-11 Thread Petr Mladek
On Wed 2017-10-04 16:27:05, Kees Cook wrote: > The expires field is normally initialized during the first mod_timer() > call. It was unused by all callers, so remove it from the macro. > > Signed-off-by: Kees Cook > --- > include/linux/kthread.h | 2 +- > include/linux/timer.h | 5 ++--- >

Re: [PATCH 12/13] kthread: Convert callback to use from_timer()

2017-10-11 Thread Petr Mladek
On Wed 2017-10-04 16:27:06, Kees Cook wrote: > In preparation for unconditionally passing the struct timer_list pointer > to all timer callbacks, switch kthread to use from_timer() and pass the > timer pointer explicitly. > > Cc: Andrew Morton > Cc: Petr Mladek > Cc: Tejun Heo > Cc: Thomas Glei

Re: [PATCH] powerpc/memkey: feature applies to PPC_BOOK3S_64 archs only

2017-10-11 Thread Michael Ellerman
Ram Pai writes: > Currently protection key feature is erroneously configured to > be enabled for any flavor of PPC64. This patch fixes it. > > Signed-off-by: Ram Pai > --- > arch/powerpc/Kconfig |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/powerpc/Kconfig

Re: [PATCH 1/3] powerpc/powernv: Avoid the secondary hold spinloop for OPAL boot

2017-10-11 Thread Michael Ellerman
Nicholas Piggin writes: > On Wed, 11 Oct 2017 01:58:28 +1000 > Nicholas Piggin wrote: > > >> Ahh okay, pseries is using the start-cpu RTAS call to enter at >> generic_secondary_smp_init() as well. So we can take it out for >> pseries as well. > > This patch seems to do the trick for pseries gues

[PATCH] cxl: Dump PSL_FIR register on PSL9 error irq

2017-10-11 Thread Vaibhav Jain
For PSL9 currently we aren't dumping the PSL FIR register when a PSL error interrupt is triggered. Contents of this register are useful in debugging AFU issues. This patch fixes issue by adding a new service_layer_ops callback cxl_native_err_irq_dump_regs_psl9() to dump the PSL_FIR registers on a

[PATCH] cxl: Rework the implementation of cxl_stop_trace_psl9()

2017-10-11 Thread Vaibhav Jain
Presently the PSL9 specific cxl_stop_trace_psl9() only stops the RX0 traces on the CXL adapter when a PSL error irq is triggered. The patch updates the function to stop all the traces arrays and move them to the FIN state. The implementation issues the mmio to TRACECFG register to stop the trace ar

[PATCH] powerpc/perf: Add ___GFP_NOWARN flag to alloc_pages_node()

2017-10-11 Thread Anju T Sudhakar
Stack trace output during a stress test: [4.310049] Freeing initrd memory: 22592K [4.310646] rtas_flash: no firmware flash support [4.313341] cpuhp/64: page allocation failure: order:0, mode:0x14480c0(GFP_KERNEL|__GFP_ZERO|__GFP_THISNODE), nodemask=(null) [4.313465] cpuhp/64 cpuse

Re: [PATCH v2] cxl: Dump PSL_FIR register on PSL9 error irq

2017-10-11 Thread Andrew Donnellan
On 11/10/17 17:14, Vaibhav Jain wrote: For PSL9 currently we aren't dumping the PSL FIR register when a PSL error interrupt is triggered. Contents of this register are useful in debugging AFU issues. This patch fixes issue by adding a new service_layer_ops callback cxl_native_err_irq_dump_regs_p

[PATCH v5 00/22] Speculative page faults

2017-10-11 Thread Laurent Dufour
This is a port on kernel 4.14 of the work done by Peter Zijlstra to handle page fault without holding the mm semaphore [1]. The idea is to try to handle user space page faults without holding the mmap_sem. This should allow better concurrency for massively threaded process since the page fault han

[PATCH v5 01/22] x86/mm: Define CONFIG_SPF

2017-10-11 Thread Laurent Dufour
Introduce CONFIG_SPF which turns on the Speculative Page Fault handler when building for 64bits with SMP. Signed-off-by: Laurent Dufour --- arch/x86/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 063f1e0d51aa..a726618b7018 100644 --- a/a

[PATCH v5 02/22] powerpc/mm: Define CONFIG_SPF

2017-10-11 Thread Laurent Dufour
Define CONFIG_SPF for BOOK3S_64 and SMP. This enables the Speculative Page Fault handler. Support is only provide for BOOK3S_64 currently because: - require CONFIG_PPC_STD_MMU because checks done in set_access_flags_filter() - require BOOK3S because we can't support for book3e_hugetlb_preload()

[PATCH v5 03/22] mm: Dont assume page-table invariance during faults

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra One of the side effects of speculating on faults (without holding mmap_sem) is that we can race with free_pgtables() and therefore we cannot assume the page-tables will stick around. Remove the reliance on the pte pointer. Signed-off-by: Peter Zijlstra (Intel) [Remove onl

[PATCH v5 04/22] mm: Prepare for FAULT_FLAG_SPECULATIVE

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra When speculating faults (without holding mmap_sem) we need to validate that the vma against which we loaded pages is still valid when we're ready to install the new PTE. Therefore, replace the pte_offset_map_lock() calls that (re)take the PTL with pte_map_lock() which can fa

[PATCH v5 05/22] mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE

2017-10-11 Thread Laurent Dufour
When handling page fault without holding the mmap_sem the fetch of the pte lock pointer and the locking will have to be done while ensuring that the VMA is not touched in our back. So move the fetch and locking operations in a dedicated function. Signed-off-by: Laurent Dufour --- mm/memory.c |

[PATCH v5 06/22] mm: VMA sequence count

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra Wrap the VMA modifications (vma_adjust/unmap_page_range) with sequence counts such that we can easily test if a VMA is changed. The unmap_page_range() one allows us to make assumptions about page-tables; when we find the seqcount hasn't changed we can assume page-tables are

[PATCH v5 08/22] mm: RCU free VMAs

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra Manage the VMAs with SRCU such that we can do a lockless VMA lookup. We put the fput(vma->vm_file) in the SRCU callback, this keeps files valid during speculative faults, this is possible due to the delayed fput work by Al Viro -- do we need srcu_barrier() in unmount somepla

[PATCH v5 07/22] mm: Protect VMA modifications using VMA sequence count

2017-10-11 Thread Laurent Dufour
The VMA sequence count has been introduced to allow fast detection of VMA modification when running a page fault handler without holding the mmap_sem. This patch provides protection against the VMA modification done in : - madvise() - mremap() - mpol_rebind_policy()

[PATCH v5 09/22] mm: Cache some VMA fields in the vm_fault structure

2017-10-11 Thread Laurent Dufour
When handling speculative page fault, the vma->vm_flags and vma->vm_page_prot fields are read once the page table lock is released. So there is no more guarantee that these fields would not change in our back. They will be saved in the vm_fault structure before the VMA is checked for changes. This

[PATCH v5 10/22] mm: Protect SPF handler against anon_vma changes

2017-10-11 Thread Laurent Dufour
The speculative page fault handler must be protected against anon_vma changes. This is because page_add_new_anon_rmap() is called during the speculative path. In addition, don't try speculative page fault if the VMA don't have an anon_vma structure allocated because its allocation should be protec

[PATCH v5 11/22] mm/migrate: Pass vm_fault pointer to migrate_misplaced_page()

2017-10-11 Thread Laurent Dufour
migrate_misplaced_page() is only called during the page fault handling so it's better to pass the pointer to the struct vm_fault instead of the vma. This way during the speculative page fault path the saved vma->vm_flags could be used. Signed-off-by: Laurent Dufour --- include/linux/migrate.h |

[PATCH v5 12/22] mm: Introduce __lru_cache_add_active_or_unevictable

2017-10-11 Thread Laurent Dufour
The speculative page fault handler which is run without holding the mmap_sem is calling lru_cache_add_active_or_unevictable() but the vm_flags is not guaranteed to remain constant. Introducing __lru_cache_add_active_or_unevictable() which has the vma flags value parameter instead of the vma pointer

[PATCH v5 13/22] mm: Introduce __maybe_mkwrite()

2017-10-11 Thread Laurent Dufour
The current maybe_mkwrite() is getting passed the pointer to the vma structure to fetch the vm_flags field. When dealing with the speculative page fault handler, it will be better to rely on the cached vm_flags value stored in the vm_fault structure. This patch introduce a __maybe_mkwrite() servi

[PATCH v5 14/22] mm: Introduce __vm_normal_page()

2017-10-11 Thread Laurent Dufour
When dealing with the speculative fault path we should use the VMA's field cached value stored in the vm_fault structure. Currently vm_normal_page() is using the pointer to the VMA to fetch the vm_flags value. This patch provides a new __vm_normal_page() which is receiving the vm_flags flags value

[PATCH v5 15/22] mm: Introduce __page_add_new_anon_rmap()

2017-10-11 Thread Laurent Dufour
When dealing with speculative page fault handler, we may race with VMA being split or merged. In this case the vma->vm_start and vm->vm_end fields may not match the address the page fault is occurring. This can only happens when the VMA is split but in that case, the anon_vma pointer of the new VM

[PATCH v5 16/22] mm: Provide speculative fault infrastructure

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra Provide infrastructure to do a speculative fault (not holding mmap_sem). The not holding of mmap_sem means we can race against VMA change/removal and page-table destruction. We use the SRCU VMA freeing to keep the VMA around. We use the VMA seqcount to detect change (includi

[PATCH v5 17/22] mm: Try spin lock in speculative path

2017-10-11 Thread Laurent Dufour
There is a deadlock when a CPU is doing a speculative page fault and another one is calling do_unmap(). The deadlock occurred because the speculative path try to spinlock the pte while the interrupt are disabled. When the other CPU in the unmap's path has locked the pte then is waiting for all the

[PATCH v5 18/22] mm: Adding speculative page fault failure trace events

2017-10-11 Thread Laurent Dufour
This patch a set of new trace events to collect the speculative page fault event failures. Signed-off-by: Laurent Dufour --- include/trace/events/pagefault.h | 87 mm/memory.c | 59 ++- 2 files changed, 135 ins

[PATCH v5 19/22] perf: Add a speculative page fault sw event

2017-10-11 Thread Laurent Dufour
Add a new software event to count succeeded speculative page faults. Signed-off-by: Laurent Dufour --- include/uapi/linux/perf_event.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 140ae638cfd6..101e509ee39b 100644 ---

[PATCH v5 20/22] perf tools: Add support for the SPF perf event

2017-10-11 Thread Laurent Dufour
Add support for the new speculative faults event. Signed-off-by: Laurent Dufour --- tools/include/uapi/linux/perf_event.h | 1 + tools/perf/util/evsel.c | 1 + tools/perf/util/parse-events.c| 4 tools/perf/util/parse-events.l| 1 + tools/perf/util/python.c

[PATCH v5 21/22] x86/mm: Add speculative pagefault handling

2017-10-11 Thread Laurent Dufour
From: Peter Zijlstra Try a speculative fault before acquiring mmap_sem, if it returns with VM_FAULT_RETRY continue with the mmap_sem acquisition and do the traditional fault. Signed-off-by: Peter Zijlstra (Intel) [Clearing of FAULT_FLAG_ALLOW_RETRY is now done in handle_speculative_fault()] [

[PATCH v5 22/22] powerpc/mm: Add speculative page fault

2017-10-11 Thread Laurent Dufour
This patch enable the speculative page fault on the PowerPC architecture. This will try a speculative page fault without holding the mmap_sem, if it returns with VM_FAULT_RETRY, the mmap_sem is acquired and the traditional page fault processing is done. Build on if CONFIG_SPF is defined (currentl

Re: [PATCH 1/3] powerpc/powernv: Avoid the secondary hold spinloop for OPAL boot

2017-10-11 Thread Nicholas Piggin
On Wed, 11 Oct 2017 22:27:23 +1100 Michael Ellerman wrote: > Nicholas Piggin writes: > > > On Wed, 11 Oct 2017 01:58:28 +1000 > > Nicholas Piggin wrote: > > > > > >> Ahh okay, pseries is using the start-cpu RTAS call to enter at > >> generic_secondary_smp_init() as well. So we can take it ou

Re: [PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Segher Boessenkool
Hi, On Wed, Oct 11, 2017 at 02:05:02PM +0530, Santosh Sivaraj wrote: > +70: ld r8,CFG_TB_UPDATE_COUNT(r3) > + andi. r0,r8,1 /* pending update ? loop */ > + bne-70b > + xor r0,r8,r8/* create dependency */ r0 already is 0 here, and already

Re: [PATCH 0/5] arm64: add ls1012a and ls1046a pcie support

2017-10-11 Thread Bjorn Helgaas
On Tue, Sep 19, 2017 at 05:26:53PM +0800, Zhiqiang Hou wrote: > From: Hou Zhiqiang > > This patch set adds ls1012a MSI and PCIe support, including driver > and device tree nodes. The ls1046a's MSI support patch and PCIe > driver patch has been applied, so only adds the PCIe device tree > nodes. >

Re: [PATCH v3 2/2] pseries/eeh: Add Pseries pcibios_bus_add_device

2017-10-11 Thread Bjorn Helgaas
On Fri, Sep 22, 2017 at 09:19:28AM -0500, Bryant G. Ly wrote: > This patch adds the machine dependent call for > pcibios_bus_add_device, since the previous patch > separated the calls out between the PowerNV and PowerVM. > > The difference here is that for the PowerVM environment > we do not want

Re: [PATCH v3 0/2] Prepartion for SR-IOV PowerVM Enablement

2017-10-11 Thread Bjorn Helgaas
On Fri, Sep 22, 2017 at 09:19:26AM -0500, Bryant G. Ly wrote: > This patch series is to prepare for enabling SR-IOV > on pseries. It separates the calls to be machine dependent > and does not change any current functionality. > > The patch linked below which is currently in review is a dependency:

Re: Linux 4.14: Reported regressions as of Sunday, 2017-10-08

2017-10-11 Thread Rafael J. Wysocki
On Sunday, October 8, 2017 2:37:41 PM CEST Thorsten Leemhuis wrote: > Hi! Find below my second regression report for Linux 4.14. It lists 8 > regressions I'm currently aware of. One regression was fixed since last > weeks report. One was in there that shouldn't have been there. > > As always: Are

Re: powerpc/livepatch: Fix livepatch stack access

2017-10-11 Thread Michael Ellerman
On Wed, 2017-09-20 at 10:19:51 UTC, Kamalesh Babulal wrote: > While running stress test with livepatch module loaded, kernel > bug was triggered. ... > > Signed-off-by: Kamalesh Babulal > Cc: Balbir Singh > Cc: Naveen N. Rao > Cc: linuxppc-dev@lists.ozlabs.org Applied to powerpc fixes, thanks.

Re: powerpc: Drop lockdep_assert_cpus_held call from arch_update_cpu_topology

2017-10-11 Thread Michael Ellerman
On Thu, 2017-10-05 at 00:04:30 UTC, Thiago Jung Bauermann wrote: > It turns out that not all paths calling arch_update_cpu_topology hold > cpu_hotplug_lock, but that's ok because those paths aren't supposed to race > with any concurrent hotplug events. > > Callers of arch_update_cpu_topology are e

Re: [v2] powerpc/lib/sstep: Fix count leading zeros instructions

2017-10-11 Thread Michael Ellerman
On Tue, 2017-10-10 at 06:45:30 UTC, Sandipan Das wrote: > According to the GCC documentation, the behaviour of __builtin_clz() > and __builtin_clzl() is undefined if the value of the input argument > is zero. Without handling this special case, these builtins have been > used for emulating the foll

[PATCH] powerpc/configs: Enable I2C_CHARDEV for pseries and powernv

2017-10-11 Thread Andrew Donnellan
i2c-dev provides an interface for userspace programs to interact with I2C devices, and is very helpful for I2C-related debugging. Enable it in pseries_defconfig and powernv_defconfig. It's already enabled in many other powerpc defconfigs. Signed-off-by: Andrew Donnellan --- arch/powerpc/configs

Re: [PATCH v3 2/2] pseries/eeh: Add Pseries pcibios_bus_add_device

2017-10-11 Thread Michael Ellerman
Bjorn Helgaas writes: > On Fri, Sep 22, 2017 at 09:19:28AM -0500, Bryant G. Ly wrote: >> This patch adds the machine dependent call for >> pcibios_bus_add_device, since the previous patch >> separated the calls out between the PowerNV and PowerVM. >> >> The difference here is that for the PowerV

Re: [PATCH] powerpc/modules: Use WARN_ON() in stub_for_addr()

2017-10-11 Thread Michael Ellerman
Kamalesh Babulal writes: > On Wednesday 11 October 2017 09:42 AM, Michael Ellerman wrote: >> Kamalesh Babulal writes: >> >>> Use WARN_ON(), while running out of stubs in stub_for_addr() >>> and abort loading of the module instead of BUG_ON(). >> >> Thanks. This looks good in principle. Have yo

Re: [PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Santosh Sivaraj
* Segher Boessenkool wrote (on 2017-10-11 17:02:16 +): Hi Segher, > Hi, > > On Wed, Oct 11, 2017 at 02:05:02PM +0530, Santosh Sivaraj wrote: > > +70:ld r8,CFG_TB_UPDATE_COUNT(r3) > > + andi. r0,r8,1 /* pending update ? loop */ > > + bne-70b > > + xor

[PATCH 1/3] powerpc/watchdog: Tweak watchdog printks

2017-10-11 Thread Michael Ellerman
Use pr_fmt() in the watchdog code, so we don't have to say "Watchdog" so many times. Rather than "CPU:%d" just spell it "CPU %d", "Hard" doesn't need a capital in the middle of a sentence, and "LOCKUP other CPUS" should be "LOCKUP on other CPUS". Also make it clear when a CPU self detects a locku

[PATCH] powerpc/tm: Don't check for WARN in TM Bad Thing handling

2017-10-11 Thread Michael Ellerman
Currently when we take a TM Bad Thing program check exception, we search the bug table to see if the program check was generated by a WARN/WARN_ON etc. That makes no sense, the WARN macros use trap instructions, which should never generate a TM Bad Thing exception. If they ever did that would be a

[PATCH 2/3] powerpc/watchdog: regs can't be null in soft_nmi_interrupt()

2017-10-11 Thread Michael Ellerman
soft_nmi_interrupt() is called directly from the asm exception handling code, which passes regs as a pointer to the stack. So regs can't be NULL, it may be full of junk, but that's a separate problem. Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/watchdog.c | 5 + 1 file changed, 1

[PATCH 3/3] powerpc/watchdog: Print the NIP in soft_nmi_interrupt()

2017-10-11 Thread Michael Ellerman
When a CPU detects its locked up via soft_nmi_interrupt() we have pt_regs, so print the regs->nip, which points to where we took the soft-NMI. Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/watchdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kerne