Re: [PATCH 1/1] mm/pgtable/debug: Add test validating architecture page table helpers

2019-09-04 Thread Anshuman Khandual
On 09/03/2019 04:43 PM, kbuild test robot wrote: > Hi Anshuman, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [cannot apply to v5.3-rc7 next-20190902] > [if your patch is applied to the wrong git tree, please drop us a note to > help

Re: linux-next: build warnings after merge of the kbuild tree

2019-09-04 Thread Masahiro Yamada
On Wed, Sep 4, 2019 at 10:00 AM Masahiro Yamada wrote: > > Hi Stephen, > > On Wed, Sep 4, 2019 at 9:13 AM Stephen Rothwell wrote: > > For today's linux-next, please squash the following too. (This is my fault, since scripts/mkuboot.sh is a bash script) diff --git a/scripts/Makefile.lib

Re: [PATCH v2 2/2] powerpc/nvdimm: use H_SCM_QUERY hcall on H_OVERLAP error

2019-09-04 Thread Vaibhav Jain
Hi Aneesh, Thanks for the patch. A minor suggestion below: "Aneesh Kumar K.V" writes: > Right now we force an unbind of SCM memory at drcindex on H_OVERLAP error. > This really slows down operations like kexec where we get the H_OVERLAP > error because we don't go through a full hypervisor re

RE: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp

2019-09-04 Thread David Laight
From: Nathan Chancellor [mailto:natechancel...@gmail.com] > Sent: 04 September 2019 01:24 > On Tue, Sep 03, 2019 at 02:31:28PM -0500, Segher Boessenkool wrote: > > On Mon, Sep 02, 2019 at 10:55:53PM -0700, Nathan Chancellor wrote: > > > On Thu, Aug 29, 2019 at 09:59:48AM +, David Laight wrote:

[PATCH v2] powerpc: dump kernel log before carrying out fadump or kdump

2019-09-04 Thread Ganesh Goudar
Since commit 4388c9b3a6ee ("powerpc: Do not send system reset request through the oops path"), pstore dmesg file is not updated when dump is triggered from HMC. This commit modified system reset (sreset) handler to invoke fadump or kdump (if configured), without pushing dmesg to pstore. This

[PATCH] KVM: PPC: Book3S HV: Delete an unnecessary check before kfree() in __kvmhv_nested_page_fault()

2019-09-04 Thread Markus Elfring
From: Markus Elfring Date: Wed, 4 Sep 2019 11:00:20 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring ---

Re: [PATCH v5 10/31] opal: add MPIPL interface definitions

2019-09-04 Thread Michael Ellerman
Hi Hari, One other comment. Hari Bathini writes: > Signed-off-by: Hari Bathini Change log is missing. Please define what MPIPL means, and give people some explanation of what it is, how it works and how you're using it for fadump. cheers

Re: [PATCH 1/2] ftrace: Fix NULL pointer dereference in t_probe_next()

2019-09-04 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 4 Jul 2019 20:04:41 +0530 "Naveen N. Rao" wrote: kernel/trace/ftrace.c | 4 1 file changed, 4 insertions(+) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 7b037295a1f1..0791eafb693d 100644 --- a/kernel/trace/ftrace.c +++

Re: [PATCH v5 02/31] powerpc/fadump: move internal code to a new file

2019-09-04 Thread Mahesh Jagannath Salgaonkar
On 9/3/19 9:35 PM, Hari Bathini wrote: > > > On 03/09/19 4:39 PM, Michael Ellerman wrote: >> Hari Bathini writes: >>> Make way for refactoring platform specific FADump code by moving code >>> that could be referenced from multiple places to fadump-common.c file. >>> >>> Signed-off-by: Hari

Re: [PATCH v5 15/31] powernv/fadump: support copying multiple kernel boot memory regions

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > Firmware uses 32-bit field for region size while copying/backing-up Which firmware exactly is imposing that limit? > memory during MPIPL. So, the maximum copy size for a region would > be a page less than 4GB (aligned to pagesize) but FADump capture > kernel usually needs

Re: [PATCH] sysfs: add BIN_ATTR_WO() macro

2019-09-04 Thread Greg Kroah-Hartman
On Tue, Sep 03, 2019 at 01:37:02PM +1000, Michael Ellerman wrote: > Greg Kroah-Hartman writes: > > This variant was missing from sysfs.h, I guess no one noticed it before. > > > > Turns out the powerpc secure variable code can use it, so add it to the > > tree for it, and potentially others to

Re: [PATCH v5 10/31] opal: add MPIPL interface definitions

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > On 03/09/19 4:40 PM, Michael Ellerman wrote: >> Hari Bathini writes: >>> diff --git a/arch/powerpc/include/asm/opal.h >>> b/arch/powerpc/include/asm/opal.h >>> index 57bd029..878110a 100644 >>> --- a/arch/powerpc/include/asm/opal.h >>> +++

Re: [PATCH v5 12/31] powernv/fadump: register kernel metadata address with opal

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c > index b8061fb9..a086a09 100644 > --- a/arch/powerpc/kernel/fadump.c > +++ b/arch/powerpc/kernel/fadump.c > @@ -283,17 +286,17 @@ static void __init fadump_reserve_crash_area(unsigned > long base, >

Re: [PATCH v3 3/3] Powerpc64/Watchpoint: Rewrite ptrace-hwbreak.c selftest

2019-09-04 Thread Ravi Bangoria
On 8/28/19 11:44 AM, Christophe Leroy wrote: Le 10/07/2019 à 06:54, Ravi Bangoria a écrit : ptrace-hwbreak.c selftest is logically broken. On powerpc, when watchpoint is created with ptrace, signals are generated before executing the instruction and user has to manually singlestep the

Re: [PATCH v5 16/23] PCI: hotplug: movable BARs: Don't reserve IO/mem bus space

2019-09-04 Thread Sergey Miroshnichenko
On 9/4/19 8:42 AM, Oliver O'Halloran wrote: > On Fri, 2019-08-16 at 19:50 +0300, Sergey Miroshnichenko wrote: >> A hotplugged bridge with many hotplug-capable ports may request >> reserving more IO space than the machine has. This could be overridden >> with the "hpiosize=" kernel argument though.

Re: lockdep warning while booting POWER9 PowerNV

2019-09-04 Thread Bart Van Assche
On 8/30/19 2:13 PM, Qian Cai wrote: https://raw.githubusercontent.com/cailca/linux-mm/master/powerpc.config Once in a while, booting an IBM POWER9 PowerNV system (8335-GTH) would generate a warning in lockdep_register_key() at, if (WARN_ON_ONCE(static_obj(key))) because key =

Re: [PATCH v5 16/31] powernv/fadump: process the crashdump by exporting it as /proc/vmcore

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c > b/arch/powerpc/platforms/powernv/opal-fadump.c > index a755705..10f6086 100644 > --- a/arch/powerpc/platforms/powernv/opal-fadump.c > +++ b/arch/powerpc/platforms/powernv/opal-fadump.c > @@ -41,6 +43,37 @@ static

[PATCH v2 01/20] powerpc/64s/exception: Introduce INT_DEFINE parameter block for code generation

2019-09-04 Thread Nicholas Piggin
The code generation macro arguments are difficult to read, and defaults can't easily be used. This introduces a block where parameters can be set for interrupt handler code generation by the subsequent macros, and adds the first generation macro for interrupt entry. One interrupt handler is

[PATCH v2 04/20] powerpc/64s/exception: Expand EXC_COMMON and EXC_COMMON_ASYNC macros

2019-09-04 Thread Nicholas Piggin
These don't provide a large amount of code sharing. Removing them makes code easier to shuffle around. For example, some of the common instructions will be moved into the common code gen macro. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S |

[PATCH v2 13/20] powerpc/64s/exception: remove confusing IEARLY option

2019-09-04 Thread Nicholas Piggin
Replace IEARLY=1 and IEARLY=2 with IBRANCH_COMMON, which controls if the entry code branches to a common handler; and IREALMODE_COMMON, which controls whether the common handler should remain in real mode. These special cases no longer avoid loading the SRR registers, there is no point as most of

[PATCH v2 17/20] powerpc/64s/exception: re-inline some handlers

2019-09-04 Thread Nicholas Piggin
The reduction in interrupt entry size allows some handlers to be re-inlined. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH] powerpc: Add attributes for setjmp/longjmp

2019-09-04 Thread Segher Boessenkool
The setjmp function should be declared as "returns_twice", or bad things can happen[1]. This does not actually change generated code in my testing. The longjmp function should be declared as "noreturn", so that the compiler can optimise calls to it better. This makes the generated code a little

[PATCH AUTOSEL 5.2 67/94] ibmvnic: Do not process reset during or after device removal

2019-09-04 Thread Sasha Levin
From: Thomas Falcon [ Upstream commit 36f1031c51a2538e5558fb44c6d6b88f98d3c0f2 ] Currently, the ibmvnic driver will not schedule device resets if the device is being removed, but does not check the device state before the reset is actually processed. This leads to a race where a reset is

Re: [PATCH v2] powerpc/fadump: when fadump is supported register the fadump sysfs files.

2019-09-04 Thread Michal Suchánek
On Thu, 29 Aug 2019 10:58:16 +0530 Hari Bathini wrote: > On 28/08/19 10:57 PM, Michal Suchanek wrote: > > Currently it is not possible to distinguish the case when fadump is > > supported by firmware and disabled in kernel and completely unsupported > > using the kernel sysfs interface. User can

Re: [PATCH v5 02/31] powerpc/fadump: move internal code to a new file

2019-09-04 Thread Hari Bathini
On 04/09/19 2:32 PM, Mahesh Jagannath Salgaonkar wrote: > On 9/3/19 9:35 PM, Hari Bathini wrote: >> >> >> On 03/09/19 4:39 PM, Michael Ellerman wrote: >>> Hari Bathini writes: Make way for refactoring platform specific FADump code by moving code that could be referenced from multiple

[PATCH AUTOSEL 4.19 41/52] ibmvnic: Do not process reset during or after device removal

2019-09-04 Thread Sasha Levin
From: Thomas Falcon [ Upstream commit 36f1031c51a2538e5558fb44c6d6b88f98d3c0f2 ] Currently, the ibmvnic driver will not schedule device resets if the device is being removed, but does not check the device state before the reset is actually processed. This leads to a race where a reset is

[PATCH v2 02/20] powerpc/64s/exception: Add GEN_COMMON macro that uses INT_DEFINE parameters

2019-09-04 Thread Nicholas Piggin
No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index

[PATCH v2 08/20] powerpc/64s/exception: Remove old INT_KVM_HANDLER

2019-09-04 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 55 +--- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index f318869607db..bef0c2eee7dc 100644 ---

[PATCH v2 14/20] powerpc/64s/exception: remove the SPR saving patch code macros

2019-09-04 Thread Nicholas Piggin
These are used infrequently enough they don't provide much help, so inline them. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 82 ++-- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp

2019-09-04 Thread Segher Boessenkool
On Wed, Sep 04, 2019 at 08:16:45AM +, David Laight wrote: > From: Nathan Chancellor [mailto:natechancel...@gmail.com] > > Fair enough so I guess we are back to just outright disabling the > > warning. > > Just disabling the warning won't stop the compiler generating code > that breaks a

Re: [PATCH v5 20/31] powerpc/fadump: use smaller offset while finding memory for reservation

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > diff --git a/arch/powerpc/kernel/fadump-common.h > b/arch/powerpc/kernel/fadump-common.h > index d2dd117..7107cf2 100644 > --- a/arch/powerpc/kernel/fadump-common.h > +++ b/arch/powerpc/kernel/fadump-common.h > @@ -66,6 +66,14 @@ static inline u64 fadump_str_to_u64(const

[PATCH v2 06/20] powerpc/64s/exception: Remove old INT_ENTRY macro

2019-09-04 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index b5decc9a0cbf..ba2dcd91aaaf 100644 ---

[PATCH v2 10/20] powerpc/64s/exception: move real->virt switch into the common handler

2019-09-04 Thread Nicholas Piggin
The real mode interrupt entry points currently use rfid to branch to the common handler in virtual mode. This is a significant amount of code, and forces other code (notably the KVM test) to live in the real mode handler. In the interest of minimising the amount of code that runs unrelocated move

[PATCH v2 15/20] powerpc/64s/exception: trim unused arguments from KVMTEST macro

2019-09-04 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 2705fd84accd..1bca009cd495 100644 ---

Re: [PATCH v5 21/31] powernv/fadump: process architected register state data provided by firmware

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > diff --git a/arch/powerpc/kernel/fadump-common.h > b/arch/powerpc/kernel/fadump-common.h > index 7107cf2..fc408b0 100644 > --- a/arch/powerpc/kernel/fadump-common.h > +++ b/arch/powerpc/kernel/fadump-common.h > @@ -98,7 +98,11 @@ struct fw_dump { > /* cmd line

Re: [PATCH v2 3/6] powerpc: Convert flush_icache_range & friends to C

2019-09-04 Thread Segher Boessenkool
On Wed, Sep 04, 2019 at 01:23:36PM +1000, Alastair D'Silva wrote: > > Maybe also add "msr" in the clobbers. > > > Ok. There is no known register "msr" in GCC. Segher

Re: [PATCH v3 2/3] Powerpc64/Watchpoint: Don't ignore extraneous exceptions

2019-09-04 Thread Naveen N. Rao
Ravi Bangoria wrote: On Powerpc64, watchpoint match range is double-word granular. On a watchpoint hit, DAR is set to the first byte of overlap between actual access and watched range. And thus it's quite possible that DAR does not point inside user specified range. Ex, say user creates a

[PATCH v2 05/20] powerpc/64s/exception: Move all interrupt handlers to new style code gen macros

2019-09-04 Thread Nicholas Piggin
Aside from label names and BUG line numbers, the generated code change is an additional HMI KVM handler added for the "late" KVM handler, because early and late HMI generation is achieved by defining two different interrupt types. Signed-off-by: Nicholas Piggin ---

[PATCH v2 11/20] powerpc/64s/exception: move soft-mask test to common code

2019-09-04 Thread Nicholas Piggin
As well as moving code out of the unrelocated vectors, this allows the masked handlers to be moved to common code, and allows the soft_nmi handler to be generated more like a regular handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 106

Re: [PATCH 1/1] mm/pgtable/debug: Add test validating architecture page table helpers

2019-09-04 Thread Kirill A. Shutemov
On Tue, Sep 03, 2019 at 01:31:46PM +0530, Anshuman Khandual wrote: > This adds a test module which will validate architecture page table helpers > and accessors regarding compliance with generic MM semantics expectations. > This will help various architectures in validating changes to the existing

Re: [PATCH v5 17/31] powernv/fadump: Warn before processing partial crashdump

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c > b/arch/powerpc/platforms/powernv/opal-fadump.c > index 10f6086..6a05d51 100644 > --- a/arch/powerpc/platforms/powernv/opal-fadump.c > +++ b/arch/powerpc/platforms/powernv/opal-fadump.c > @@ -71,6 +71,30 @@ static

[PATCH v2 18/20] powerpc/64s/exception: Clean up SRR specifiers

2019-09-04 Thread Nicholas Piggin
Remove more magic numbers and replace with nicely named bools. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 +--- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

Re: linux-next: build warnings after merge of the kbuild tree

2019-09-04 Thread Stephen Rothwell
Hi Masahiro, On Wed, 4 Sep 2019 15:22:09 +0900 Masahiro Yamada wrote: > > For today's linux-next, please squash the following too. > > (This is my fault, since scripts/mkuboot.sh is a bash script) > > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib > index

Re: [PATCH v5 19/31] powerpc/fadump: Update documentation about OPAL platform support

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > With FADump support now available on both pseries and OPAL platforms, > update FADump documentation with these details. > > Signed-off-by: Hari Bathini > --- > Documentation/powerpc/firmware-assisted-dump.rst | 104 > +- > 1 file changed, 63

[PATCH v2 00/20] remaining interrupt handler changes

2019-09-04 Thread Nicholas Piggin
This is a rebase of the remaining patches in this series to the powerpc next branch https://lore.kernel.org/r/20190802105709.27696-2-npig...@gmail.com Plus the next series. A few improvements were added, such as using the name=val style of parameter for invoking macros. Nicholas Piggin (20):

[PATCH v2 09/20] powerpc/64s/exception: Add ISIDE option

2019-09-04 Thread Nicholas Piggin
Rather than using DAR=2 to select the i-side registers, add an explicit option. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 16/20] powerpc/64s/exception: hdecrementer avoid touching the stack

2019-09-04 Thread Nicholas Piggin
The hdec interrupt handler is reported to sometimes fire in Linux if KVM leaves it pending after a guest exists. This is harmless, so there is a no-op handler for it. The interrupt handler currently uses the regular kernel stack. Change this to avoid touching the stack entirely. This should be

[PATCH v2 20/20] powerpc/64s/exception: only test KVM in SRR interrupts when PR KVM is supported

2019-09-04 Thread Nicholas Piggin
Apart from SRESET, MCE, and syscall (hcall variant), the SRR type interrupts are not escalated to hypervisor mode, so delivered to the OS. When running PR KVM, the OS is the hypervisor, and the guest runs with MSR[PR]=1, so these interrupts must test if a guest was running when interrupted. These

Re: linux-next: build warnings after merge of the kbuild tree

2019-09-04 Thread Stephen Rothwell
Hi Masahiro, On Wed, 4 Sep 2019 10:00:30 +0900 Masahiro Yamada wrote: > > Could you fix it up as follows? > I will squash it for tomorrow's linux-next. > > > --- a/arch/powerpc/Makefile.postlink > +++ b/arch/powerpc/Makefile.postlink > @@ -18,7 +18,7 @@ quiet_cmd_relocs_check = CHKREL $@ >

Re: [PATCH v5 11/31] powernv/fadump: add fadump support on powernv

2019-09-04 Thread Hari Bathini
On 03/09/19 10:01 PM, Hari Bathini wrote: > [...] >>> diff --git a/arch/powerpc/kernel/fadump-common.h >>> b/arch/powerpc/kernel/fadump-common.h >>> index d2c5b16..f6c52d3 100644 >>> --- a/arch/powerpc/kernel/fadump-common.h >>> +++ b/arch/powerpc/kernel/fadump-common.h >>> @@ -140,4 +140,13

[PATCH v2 03/20] powerpc/64s/exception: Add GEN_KVM macro that uses INT_DEFINE parameters

2019-09-04 Thread Nicholas Piggin
No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 591ae2a73e18..0e39e98ef719 100644

[PATCH v2 07/20] powerpc/64s/exception: Remove old INT_COMMON macro

2019-09-04 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 51 +--- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index ba2dcd91aaaf..f318869607db 100644 ---

[PATCH v2 12/20] powerpc/64s/exception: move KVM test to common code

2019-09-04 Thread Nicholas Piggin
This allows more code to be moved out of unrelocated regions. The system call KVMTEST is changed to be open-coded and remain in the tramp area to avoid having to move it to entry_64.S. The custom nature of the system call entry code means the hcall case can be made more streamlined than regular

[PATCH v2 19/20] powerpc/64s/exception: add more comments for interrupt handlers

2019-09-04 Thread Nicholas Piggin
A few of the non-standard handlers are left uncommented. Some more description could be added to some. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 391 --- 1 file changed, 353 insertions(+), 38 deletions(-) diff --git

Re: [PATCH v5 19/31] powerpc/fadump: Update documentation about OPAL platform support

2019-09-04 Thread Oliver O'Halloran
On Wed, Sep 4, 2019 at 9:51 PM Michael Ellerman wrote: > > Hari Bathini writes: > > With FADump support now available on both pseries and OPAL platforms, > > update FADump documentation with these details. > > > > Signed-off-by: Hari Bathini > > --- > >

Re: [PATCH 1/1] mm/pgtable/debug: Add test validating architecture page table helpers

2019-09-04 Thread Gerald Schaefer
On Tue, 3 Sep 2019 13:31:46 +0530 Anshuman Khandual wrote: > This adds a test module which will validate architecture page table helpers > and accessors regarding compliance with generic MM semantics expectations. > This will help various architectures in validating changes to the existing >

[PATCH v12 02/12] clone3: switch to copy_struct_from_user()

2019-09-04 Thread Aleksa Sarai
The change is very straightforward, and takes advantage of the (very minor) efficiency improvements in copy_struct_from_user() -- that the memchr_inv() check is done on a buffer instead of one-at-at-time with get_user(). Additionally, explicitly define CLONE_ARGS_SIZE_VER0 to match the other

[PATCH v12 08/12] namei: O_BENEATH-style path resolution flags

2019-09-04 Thread Aleksa Sarai
Add the following flags to allow various restrictions on path resolution (these affect the *entire* resolution, rather than just the final path component -- as is the case with LOOKUP_FOLLOW). The primary justification for these flags is to allow for programs to be far more strict about how they

[PATCH v12 00/12] namei: openat2(2) path resolution restrictions

2019-09-04 Thread Aleksa Sarai
This patchset is being developed here: Patch changelog: v12: * Remove @how->reserved field from openat2(2), and instead use the (struct, size) design for syscall extensions. * Implement copy_struct_{to,from}_user() to unify

[PATCH v12 04/12] perf_event_open: switch to copy_struct_from_user()

2019-09-04 Thread Aleksa Sarai
The change is very straightforward, and takes advantage of the (very minor) efficiency improvements in copy_struct_from_user() -- that the memchr_inv() check is done on a buffer instead of one-at-at-time with get_user(). Signed-off-by: Aleksa Sarai --- kernel/events/core.c | 45

[PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Aleksa Sarai
This patch allows for LOOKUP_BENEATH and LOOKUP_IN_ROOT to safely permit ".." resolution (in the case of LOOKUP_BENEATH the resolution will still fail if ".." resolution would resolve a path outside of the root -- while LOOKUP_IN_ROOT will chroot(2)-style scope it). Magic-link jumps are still

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 2:09 PM Linus Torvalds wrote: > > So you'd have three stages: > > 1) ".." always returns -EXDEV > > 2) ".." returns -EXDEV if there was a concurrent rename/mount > > 3) ".." returns -EXDEV if there was a concurrent rename/mount and we > reset the sequence numbers and

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 2:35 PM Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 2:09 PM Linus Torvalds > wrote: > > > > So you'd have three stages: > > > > 1) ".." always returns -EXDEV > > > > 2) ".." returns -EXDEV if there was a concurrent rename/mount > > > > 3) ".." returns -EXDEV if

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Aleksa Sarai
On 2019-09-04, Linus Torvalds wrote: > On Wed, Sep 4, 2019 at 1:23 PM Aleksa Sarai wrote: > > This patch allows for LOOKUP_BENEATH and LOOKUP_IN_ROOT to safely permit > > ".." resolution (in the case of LOOKUP_BENEATH the resolution will still > > fail if ".." resolution would resolve a path

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 2:49 PM Aleksa Sarai wrote: > > Hinting to userspace to do a retry (with -EAGAIN as you mention in your > other mail) wouldn't be a bad thing at all, though you'd almost > certainly get quite a few spurious -EAGAINs -- &{mount,rename}_lock are > global for the entire

[PATCH] KVM: PPC: Book3S HV: add smp_mb() in kvmppc_set_host_ipi()

2019-09-04 Thread Michael Roth
On a 2-socket Witherspoon system with 128 cores and 1TB of memory running the following guest configs: guest A: - 224GB of memory - 56 VCPUs (sockets=1,cores=28,threads=2), where: VCPUs 0-1 are pinned to CPUs 0-3, VCPUs 2-3 are pinned to CPUs 4-7, ... VCPUs 54-55

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread David Howells
Linus Torvalds wrote: > > Hinting to userspace to do a retry (with -EAGAIN as you mention in your > > other mail) wouldn't be a bad thing at all, though you'd almost > > certainly get quite a few spurious -EAGAINs -- &{mount,rename}_lock are > > global for the entire machine, after all. > > I'd

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > It ought to be reasonably easy to make them per-sb at least, I think. We > don't allow cross-super rename, right? Right now the sequence count handling very much depends on it being a global entity on the reader side, at least. And while

missing doorbell interrupt when onlining cpu

2019-09-04 Thread Nathan Lynch
I'm hoping for some help investigating a behavior I see when doing cpu hotplug under load on P9 and P8 LPARs. Occasionally, while coming online a cpu will seem to get "stuck" in idle, with a pending doorbell interrupt unserviced (cpu 12 here): cpuhp/12-70[012] 46133.602202: cpuhp_enter:

Re: [PATCH 1/1] mm/pgtable/debug: Add test validating architecture page table helpers

2019-09-04 Thread Dave Hansen
On 9/3/19 1:01 AM, Anshuman Khandual wrote: > This adds a test module which will validate architecture page table helpers > and accessors regarding compliance with generic MM semantics expectations. > This will help various architectures in validating changes to the existing > page table helpers

Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp

2019-09-04 Thread Nathan Chancellor
On Wed, Sep 04, 2019 at 08:01:35AM -0500, Segher Boessenkool wrote: > On Wed, Sep 04, 2019 at 08:16:45AM +, David Laight wrote: > > From: Nathan Chancellor [mailto:natechancel...@gmail.com] > > > Fair enough so I guess we are back to just outright disabling the > > > warning. > > > > Just

Re: missing doorbell interrupt when onlining cpu

2019-09-04 Thread Nathan Lynch
Nathan Lynch writes: > I'm hoping for some help investigating a behavior I see when doing cpu > hotplug under load on P9 and P8 LPARs. Occasionally, while coming online > a cpu will seem to get "stuck" in idle, with a pending doorbell > interrupt unserviced (cpu 12 here): > > cpuhp/12-70

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Al Viro
On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > don't allow cross-super rename, right? > > Right now the sequence count handling very much

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 4:29 PM Al Viro wrote: > > On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > > don't allow cross-super rename,

[PATCH v12 03/12] sched_setattr: switch to copy_struct_{to, from}_user()

2019-09-04 Thread Aleksa Sarai
The change is very straightforward, and takes advantage of the (very minor) efficiency improvements in copy_struct_{to,from}_user() -- that the memchr_inv() check is done on a buffer instead of one-at-at-time with get_user() or put_user(). Signed-off-by: Aleksa Sarai --- kernel/sched/core.c |

[PATCH v12 06/12] procfs: switch magic-link modes to be more sane

2019-09-04 Thread Aleksa Sarai
Now that magic-link modes are obeyed for file re-opening purposes, some of the pre-existing magic-link modes need to be adjusted to be more semantically correct. The most blatant example of this is /proc/self/exe, which had a mode of a+rwx even though tautologically the file could never be opened

[PATCH v12 09/12] namei: LOOKUP_IN_ROOT: chroot-like path resolution

2019-09-04 Thread Aleksa Sarai
The primary motivation for the need for this flag is container runtimes which have to interact with malicious root filesystems in the host namespaces. One of the first requirements for a container runtime to be secure against a malicious rootfs is that they correctly scope symlinks (that is, they

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-04 Thread Randy Dunlap
Hi, just kernel-doc fixes: On 9/4/19 1:19 PM, Aleksa Sarai wrote: > > diff --git a/lib/struct_user.c b/lib/struct_user.c > new file mode 100644 > index ..7301ab1bbe98 > --- /dev/null > +++ b/lib/struct_user.c > @@ -0,0 +1,182 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* >

Re: [PATCH v5 15/31] powernv/fadump: support copying multiple kernel boot memory regions

2019-09-04 Thread Hari Bathini
On 04/09/19 5:00 PM, Michael Ellerman wrote: > Hari Bathini writes: >> Firmware uses 32-bit field for region size while copying/backing-up > > Which firmware exactly is imposing that limit? I think the MDST/MDRT tables in the f/w. Vasant, which component is that? >> +/* >> + *

[PATCH v12 12/12] selftests: add openat2(2) selftests

2019-09-04 Thread Aleksa Sarai
Test all of the various openat2(2) flags, as well as how file descriptor re-opening works. A small stress-test of a symlink-rename attack is included to show that the protections against ".."-based attacks are sufficient. In addition, the memfd selftest is fixed to no longer depend on the

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-04 Thread Randy Dunlap
Hi, just noisy nits here: On 9/4/19 1:19 PM, Aleksa Sarai wrote: > diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h > index 1d338357df8a..479baf2da10e 100644 > --- a/include/uapi/linux/fcntl.h > +++ b/include/uapi/linux/fcntl.h > @@ -93,5 +93,47 @@ > > #define AT_RECURSIVE

[PATCH v12 07/12] open: O_EMPTYPATH: procfs-less file descriptor re-opening

2019-09-04 Thread Aleksa Sarai
Userspace has made use of /proc/self/fd very liberally to allow for descriptors to be re-opened. There are a wide variety of uses for this feature, but it has always required constructing a pathname and could not be done without procfs mounted. The obvious solution for this is to extend openat(2)

[PATCH v12 11/12] open: openat2(2) syscall

2019-09-04 Thread Aleksa Sarai
The most obvious syscall to add support for the new LOOKUP_* scoping flags would be openat(2). However, there are a few reasons why this is not the best course of action: * The new LOOKUP_* flags are intended to be security features, and openat(2) will silently ignore all unknown flags. This

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user helpers

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 1:20 PM Aleksa Sarai wrote: > > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages to

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 1:23 PM Aleksa Sarai wrote: > > This patch allows for LOOKUP_BENEATH and LOOKUP_IN_ROOT to safely permit > ".." resolution (in the case of LOOKUP_BENEATH the resolution will still > fail if ".." resolution would resolve a path outside of the root -- > while LOOKUP_IN_ROOT

Re: [PATCH v5 11/31] powernv/fadump: add fadump support on powernv

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > On 03/09/19 10:01 PM, Hari Bathini wrote: >> > [...] diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index f7c8073..b8061fb9 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -114,6 +114,9 @@

Re: [PATCH v3 3/4] x86/efi: move common keyring handler functions to new file

2019-09-04 Thread Michael Ellerman
Mimi Zohar writes: > (Cc'ing Josh Boyer, David Howells) > > On Mon, 2019-09-02 at 21:55 +1000, Michael Ellerman wrote: >> Nayna Jain writes: >> >> > The handlers to add the keys to the .platform keyring and blacklisted >> > hashes to the .blacklist keyring is common for both the uefi and

[PATCH 0/2] Fix IOMMU setup for hotplugged devices on pseries

2019-09-04 Thread Shawn Anastasio
On pseries QEMU guests, IOMMU setup for hotplugged PCI devices is currently broken for all but the first device on a given bus. The culprit is an ordering issue in the pseries hotplug path (via pci_rescan_bus()) which results in IOMMU group assigment occuring before device registration in sysfs.

Re: [PATCH v2] powerpc/64: system call implement the bulk of the logic in C

2019-09-04 Thread Nicholas Piggin
Michael Ellerman's on September 5, 2019 2:14 pm: > Nicholas Piggin writes: >> System call entry and particularly exit code is beyond the limit of what >> is reasonable to implement in asm. >> >> This conversion moves all conditional branches out of the asm code, >> except for the case that all

Re: [PATCH v2] powerpc/64: system call implement the bulk of the logic in C

2019-09-04 Thread Michael Ellerman
Nicholas Piggin writes: > System call entry and particularly exit code is beyond the limit of what > is reasonable to implement in asm. > > This conversion moves all conditional branches out of the asm code, > except for the case that all GPRs should be restored at exit. > > Null syscall test is

[PATCH 1/2] PCI: Introduce pcibios_fixup_dev()

2019-09-04 Thread Shawn Anastasio
Introduce pcibios_fixup_dev to allow platform-specific code to perform final setup of a PCI device after it has been registered in sysfs. The default implementation is a no-op. Signed-off-by: Shawn Anastasio --- drivers/pci/probe.c | 14 ++ include/linux/pci.h | 1 + 2 files

Re: [PATCH] KVM: PPC: Book3S HV: add smp_mb() in kvmppc_set_host_ipi()

2019-09-04 Thread Michael Ellerman
Hi Mike, Thanks for the patch & great change log, just a few comments. Michael Roth writes: > On a 2-socket Witherspoon system with 128 cores and 1TB of memory ^ Power9 (not everyone knows what a Witherspoon is) > running the following

Re: [PATCH v5 19/31] powerpc/fadump: Update documentation about OPAL platform support

2019-09-04 Thread Michael Ellerman
"Oliver O'Halloran" writes: > On Wed, Sep 4, 2019 at 9:51 PM Michael Ellerman wrote: >> Hari Bathini writes: ... >> > diff --git a/Documentation/powerpc/firmware-assisted-dump.rst >> > b/Documentation/powerpc/firmware-assisted-dump.rst >> > index d912755..2c3342c 100644 >> > ---

Re: [PATCH v3 2/3] Powerpc64/Watchpoint: Don't ignore extraneous exceptions

2019-09-04 Thread Ravi Bangoria
On 9/4/19 8:12 PM, Naveen N. Rao wrote: Ravi Bangoria wrote: On Powerpc64, watchpoint match range is double-word granular. On a watchpoint hit, DAR is set to the first byte of overlap between actual access and watched range. And thus it's quite possible that DAR does not point inside user

Re: [PATCH v4 02/16] powerpc/pseries: Introduce option to build secure virtual machines

2019-09-04 Thread Michael Ellerman
Thiago Jung Bauermann writes: > Michael Ellerman writes: >> On Tue, 2019-08-20 at 02:13:12 UTC, Thiago Jung Bauermann wrote: >>> Introduce CONFIG_PPC_SVM to control support for secure guests and include >>> Ultravisor-related helpers when it is selected >>> >>> Signed-off-by: Thiago Jung

Re: [PATCH v5 14/31] powernv/fadump: define register/un-register callback functions

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > Make OPAL calls to register and un-register with firmware for MPIPL. > This has the same subject as patch 6, would be good to make them different. cheers

[PATCH 2/2] powerpc/pci: Fix IOMMU setup for hotplugged devices on pseries

2019-09-04 Thread Shawn Anastasio
Move PCI device setup from pcibios_add_device() to pcibios_fixup_dev(). This ensures that platform-specific DMA and IOMMU setup occurs after the device has been registered in sysfs, which is a requirement for IOMMU group assignment to work. This fixes IOMMU group assignment for hotplugged devices

Re: [PATCH v5 15/31] powernv/fadump: support copying multiple kernel boot memory regions

2019-09-04 Thread Michael Ellerman
Hari Bathini writes: > On 04/09/19 5:00 PM, Michael Ellerman wrote: >> Hari Bathini writes: >>> Firmware uses 32-bit field for region size while copying/backing-up >> >> Which firmware exactly is imposing that limit? > > I think the MDST/MDRT tables in the f/w. Vasant, which component is that?

Re: lockdep warning while booting POWER9 PowerNV

2019-09-04 Thread Michael Ellerman
Bart Van Assche writes: > On 8/30/19 2:13 PM, Qian Cai wrote: >> https://raw.githubusercontent.com/cailca/linux-mm/master/powerpc.config >> >> Once in a while, booting an IBM POWER9 PowerNV system (8335-GTH) would >> generate >> a warning in lockdep_register_key() at, >> >> if

[PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-04 Thread Aleksa Sarai
A common pattern for syscall extensions is increasing the size of a struct passed from userspace, such that the zero-value of the new fields result in the old kernel behaviour (allowing for a mix of userspace and kernel vintages to operate on one another in most cases). This is done in both

  1   2   >