[PATCH 4/5] powerpc/kuap: Remove KUAP_CURRENT_XXX

2021-05-12 Thread Christophe Leroy
book3s/32 was the only user of KUAP_CURRENT_XXX. After rework of book3s/32 KUAP, it is not used anymore. Remove it. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 1 - arch/powerpc/include/asm/kup.h | 14 +++--- 2 files changed, 3

[PATCH 5/5] powerpc/kuap: Remove to/from/size parameters of prevent_user_access()

2021-05-12 Thread Christophe Leroy
prevent_user_access() doesn't use anymore to/from/size parameters. Remove them. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 3 +-- arch/powerpc/include/asm/book3s/64/kup.h | 3 +-- arch/powerpc/include/asm/kup.h | 15 +++

[PATCH 2/5] powerpc/32s: Refactor update of user segment registers

2021-05-12 Thread Christophe Leroy
KUEP implements the update of user segment registers. Move it into mmu-hash.h in order to use it from other places. And inline kuep_lock() and kuep_unlock() and remove kuep.c inlining kuep_lock() is important for system_call_exception(), otherwise system_call_exception() has to save into stack

[PATCH 3/5] powerpc/kuap: Rework Kernel Userspace Access Protection on book3s/32

2021-05-12 Thread Christophe Leroy
On book3s/32, KUAP is provided by toggling Ks bit in segment registers. One segment registers addresses 256M of virtual memory. At the time being, KUAP implements a complex logic to apply the unlock/lock on the exact number of segments covering the user range to access, with saving the boundaries

[PATCH 1/5] powerpc/kuap: Force inlining of all first level KUAP helpers.

2021-05-12 Thread Christophe Leroy
All KUAP helpers defined in asm/kup.h are single line functions that should be inlined. But on book3s/32 build, we get many instances of . Force inlining of those helpers. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/kup.h | 22 +++--- 1 file changed, 11

Re: [PATCH kernel v2] powerpc/makefile: Do not redefine $(CPP) for preprocessor

2021-05-12 Thread Segher Boessenkool
On Wed, May 12, 2021 at 01:48:53PM +1000, Alexey Kardashevskiy wrote: > >Oh! I completely missed those few lines. Sorry for that :-( > > Well, I probably should have made it a separate patch anyway, I'll > repost separately. Thanks. > >To compensate a bit: > > > >>It still puzzles me why we

[PATCH 1/5] kbuild: require all architectures to have arch/$(SRCARCH)/Kbuild

2021-05-12 Thread Masahiro Yamada
arch/$(SRCARCH)/Kbuild is useful for Makefile cleanups because you can use the obj-y syntax. Add an empty file if it is missing in arch/$(SRCARCH)/. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- arch/alpha/Kbuild | 1 + arch/arc/Makefile | 3 ---

Re: [PATCH] lockdown, selinux: fix bogus SELinux lockdown permission checks

2021-05-12 Thread Ondrej Mosnacek
On Sat, May 8, 2021 at 12:17 AM Casey Schaufler wrote: > On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: > > Commit 59438b46471a ("security,lockdown,selinux: implement SELinux > > lockdown") added an implementation of the locked_down LSM hook to > > SELinux, with the aim to restrict which domains are

Re: [PATCH v3 0/4] P2040/P2041 i2c recovery erratum

2021-05-12 Thread Joakim Tjernlund
On Wed, 2021-05-12 at 01:48 +, Chris Packham wrote: > On 12/05/21 10:10 am, Joakim Tjernlund wrote: > > On Wed, 2021-05-12 at 09:20 +1200, Chris Packham wrote: > > > The P2040/P2041 has an erratum where the i2c recovery scheme > > > documented in the reference manual (and currently implemented

Re: [PATCH] powerpc: Force inlining of csum_add()

2021-05-12 Thread Christophe Leroy
Hi, Le 11/05/2021 à 12:51, Segher Boessenkool a écrit : Hi! On Tue, May 11, 2021 at 06:08:06AM +, Christophe Leroy wrote: Commit 328e7e487a46 ("powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10") inlined csum_partial(). Now that csum_partial() is

Re: [RFC 1/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats

2021-05-12 Thread Peter Zijlstra
On Wed, May 12, 2021 at 10:08:21PM +0530, Kajol Jain wrote: > +static void nvdimm_pmu_read(struct perf_event *event) > +{ > + struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); > + > + /* jump to arch/platform specific callbacks if any */ > + if (nd_pmu && nd_pmu->read) > +

Re: [PATCH] powerpc: Force inlining of csum_add()

2021-05-12 Thread Segher Boessenkool
On Wed, May 12, 2021 at 04:43:33PM +0200, Christophe Leroy wrote: > Le 12/05/2021 à 16:31, Segher Boessenkool a écrit : > >On Wed, May 12, 2021 at 02:56:56PM +0200, Christophe Leroy wrote: > >>Le 11/05/2021 à 12:51, Segher Boessenkool a écrit : > >>>Something seems to have decided this asm is more

Re: [PATCH] lockdown,selinux: fix bogus SELinux lockdown permission checks

2021-05-12 Thread Casey Schaufler
On 5/12/2021 9:44 AM, Ondrej Mosnacek wrote: > On Wed, May 12, 2021 at 6:18 PM Casey Schaufler > wrote: >> On 5/12/2021 6:21 AM, Ondrej Mosnacek wrote: >>> On Sat, May 8, 2021 at 12:17 AM Casey Schaufler >>> wrote: On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: > Commit 59438b46471a

Re: [PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn

2021-05-12 Thread kernel test robot
Hi Christophe, I love your patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on linus/master v5.13-rc1 next-20210512] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base

Re: [PATCH] powerpc: Force inlining of csum_add()

2021-05-12 Thread Christophe Leroy
Le 12/05/2021 à 16:31, Segher Boessenkool a écrit : On Wed, May 12, 2021 at 02:56:56PM +0200, Christophe Leroy wrote: Le 11/05/2021 à 12:51, Segher Boessenkool a écrit : Something seems to have decided this asm is more expensive than it is. That isn't always avoidable -- the compiler cannot

Re: [RFC PATCH 0/7] Memory hotplug/hotremove at subsection size

2021-05-12 Thread David Hildenbrand
As stated somewhere here already, we'll have to look into making alloc_contig_range() (and main users CMA and virtio-mem) independent of MAX_ORDER and mainly rely on pageblock_order. The current handling in alloc_contig_range() is far from optimal as we have to isolate a whole MAX_ORDER - 1

[RFC 0/4] Add perf interface to expose nvdimm performance stats

2021-05-12 Thread Kajol Jain
Patchset adds performance stats reporting support for nvdimm. Added interface includes support for a pmu register function and callbacks to be used by arch/platform specific drivers. User could use standard perf tool to access perf events exposed via pmu. Patchset adds a structure called

[RFC 2/4] powerpc/papr_scm: Add perf interface support

2021-05-12 Thread Kajol Jain
This patch adds support for performance monitoring of papr nvdimm devices via perf interface. It adds callbacks functions like add/del/read/event_init for nvdimm_pmu structure. Patch adds a new parameter 'priv' in pdev_archdata structure to save nvdimm_pmu device pointer, to handle the

[RFC 4/4] powerpc/papr_scm: Add cpu hotplug support for nvdimm pmu device

2021-05-12 Thread Kajol Jain
Patch here adds cpu hotplug functions to nvdimm pmu. It adds cpumask to designate a cpu to make HCALL to collect the counter data for the nvdimm device and update ABI documentation accordingly. Result in power9 lpar system: command:# cat /sys/devices/nmem0/cpumask 0 Signed-off-by: Kajol Jain

[RFC 1/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats

2021-05-12 Thread Kajol Jain
Patch adds performance stats reporting support for nvdimm. Added interface includes support for a pmu register function and callbacks to be used by the arch/platform specific drivers. User could use the standard perf tool to access perf events exposed via pmu. A structure is added called

Re: [PATCH] lockdown,selinux: fix bogus SELinux lockdown permission checks

2021-05-12 Thread Casey Schaufler
On 5/12/2021 6:21 AM, Ondrej Mosnacek wrote: > On Sat, May 8, 2021 at 12:17 AM Casey Schaufler > wrote: >> On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: >>> Commit 59438b46471a ("security,lockdown,selinux: implement SELinux >>> lockdown") added an implementation of the locked_down LSM hook to >>>

[PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread Christophe Leroy
Some architectures like powerpc require a non standard allocation of optinsn page, because module pages are too far from the kernel for direct branches. Define weak alloc_optinsn_page() and free_optinsn_page(), that fall back on alloc_insn_page() and free_insn_page() when not overriden by the

[PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn

2021-05-12 Thread Christophe Leroy
Commit 51c9c0843993 ("powerpc/kprobes: Implement Optprobes") implemented a powerpc specific version of optinsn in order to workaround the 32Mb limitation for direct branches. Instead of implementing a dedicated powerpc version, use the common optinsn and override the allocation and freeing

Re: [PATCH] powerpc: Force inlining of csum_add()

2021-05-12 Thread Segher Boessenkool
On Wed, May 12, 2021 at 02:56:56PM +0200, Christophe Leroy wrote: > Le 11/05/2021 à 12:51, Segher Boessenkool a écrit : > >Something seems to have decided this asm is more expensive than it is. > >That isn't always avoidable -- the compiler cannot look inside asms -- > >but it seems it could be

Re: [PATCH] lockdown, selinux: fix bogus SELinux lockdown permission checks

2021-05-12 Thread Ondrej Mosnacek
On Wed, May 12, 2021 at 6:18 PM Casey Schaufler wrote: > On 5/12/2021 6:21 AM, Ondrej Mosnacek wrote: > > On Sat, May 8, 2021 at 12:17 AM Casey Schaufler > > wrote: > >> On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: > >>> Commit 59438b46471a ("security,lockdown,selinux: implement SELinux > >>>

Re: [PATCH v3 0/4] P2040/P2041 i2c recovery erratum

2021-05-12 Thread w...@kernel.org
> > I've been doing my recent work with a P2040 and prior to that I did test > > out the recovery on a T2081 (which isn't documented to have this > > erratum) when I was re-working the driver. The "new" recovery actually > > seems better but I don't have a reliably faulty i2c device so that's

[RFC 3/4] powerpc/papr_scm: Document papr_scm sysfs event format entries

2021-05-12 Thread Kajol Jain
This patch add event format and events details in ABI documentation Signed-off-by: Kajol Jain --- Documentation/ABI/testing/sysfs-bus-papr-pmem | 25 +++ 1 file changed, 25 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-papr-pmem

[PATCH] sched: Initialize the idle task with preemption disabled

2021-05-12 Thread Valentin Schneider
As pointed out by commit de9b8f5dcbd9 ("sched: Fix crash trying to dequeue/enqueue the idle thread") init_idle() can and will be invoked more than once on the same idle task. At boot time, it is invoked for the boot CPU thread by sched_init(). Then smp_init() creates the threads for all the

Re: [PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn

2021-05-12 Thread Masami Hiramatsu
On Wed, 12 May 2021 14:29:27 + (UTC) Christophe Leroy wrote: > Commit 51c9c0843993 ("powerpc/kprobes: Implement Optprobes") > implemented a powerpc specific version of optinsn in order > to workaround the 32Mb limitation for direct branches. > > Instead of implementing a dedicated powerpc

Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread Masami Hiramatsu
On Wed, 12 May 2021 14:29:26 + (UTC) Christophe Leroy wrote: > Some architectures like powerpc require a non standard > allocation of optinsn page, because module pages are > too far from the kernel for direct branches. > > Define weak alloc_optinsn_page() and free_optinsn_page(), that >

Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread Masami Hiramatsu
On Thu, 13 May 2021 03:04:51 +0800 kernel test robot wrote: > Hi Christophe, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on powerpc/next] > [also build test WARNING on linus/master v5.13-rc1 next-20210512] > [If your patch is applied

Re: [PATCH v13 1/8] powerpc/mm: Implement set_memory() routines

2021-05-12 Thread Jordan Niethe
On Mon, May 10, 2021 at 11:18 AM Jordan Niethe wrote: > > From: Russell Currey > > The set_memory_{ro/rw/nx/x}() functions are required for > STRICT_MODULE_RWX, and are generally useful primitives to have. This > implementation is designed to be generic across powerpc's many MMUs. > It's

[powerpc:merge] BUILD SUCCESS 1fab3666d738e4af3a7450c44441310e4d7a7e53

2021-05-12 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge branch HEAD: 1fab3666d738e4af3a7450c1310e4d7a7e53 Automatic merge of 'master' into merge (2021-05-09 08:09) elapsed time: 6060m configs tested: 97 configs skipped: 2 The following configs have been built

Re: [PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn

2021-05-12 Thread kernel test robot
Hi Christophe, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on linus/master v5.13-rc1 next-20210512] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base

Re: [PATCH 2/3] hotplug-memory.c: enhance dlpar_memory_remove* LMB checks

2021-05-12 Thread Daniel Henrique Barboza
On 5/3/21 10:02 PM, David Gibson wrote: On Fri, Apr 30, 2021 at 09:09:16AM -0300, Daniel Henrique Barboza wrote: dlpar_memory_remove_by_ic() validates the amount of LMBs to be removed by checking !DRCONF_MEM_RESERVED, and in the following loop before dlpar_remove_lmb() a check for

Re: [PATCH v2] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-12 Thread Dan Williams
On Fri, May 7, 2021 at 4:40 AM Vaibhav Jain wrote: > > In case performance stats for an nvdimm are not available, reading the > 'perf_stats' sysfs file returns an -ENOENT error. A better approach is > to make the 'perf_stats' file entirely invisible to indicate that > performance stats for an

[PATCH v2 4/4] powerpc/pseries: minor enhancements in dlpar_memory_remove_by_ic()

2021-05-12 Thread Daniel Henrique Barboza
We don't need the 'lmbs_available' variable to count the valid LMBs and to check if we have less than 'lmbs_to_remove'. We must ensure that the entire LMB range must be removed, so we can error out immediately if any LMB in the range is marked as reserved. Add a couple of comments explaining the

Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread kernel test robot
Hi Christophe, I love your patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on linus/master v5.13-rc1 next-20210512] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base

[PATCH v2 1/4] powerpc/pseries: Set UNISOLATE on dlpar_memory_remove_by_ic() error

2021-05-12 Thread Daniel Henrique Barboza
As previously done in dlpar_cpu_remove() for CPUs, this patch changes dlpar_memory_remove_by_ic() to unisolate the LMB DRC when the LMB is failed to be removed. The hypervisor, seeing a LMB DRC that was supposed to be removed being unisolated instead, can do error recovery on its side. This

[PATCH v2 3/4] powerpc/pseries: break early in dlpar_memory_remove_by_count() loops

2021-05-12 Thread Daniel Henrique Barboza
After marking the LMBs as reserved depending on dlpar_remove_lmb() rc, we evaluate whether we need to add the LMBs back or if we can release the LMB DRCs. In both cases, a for_each_drmem_lmb() loop without a break condition is used. This means that we're going to cycle through all LMBs of the

[PATCH v2 0/4] Unisolate LMBs DRC on removal error + cleanups

2021-05-12 Thread Daniel Henrique Barboza
changes from v1: - patch 1: added David's r-b - patch 2: * removed the DRCONF_MEM_RESERVED assumption for dlpar_memory_remove_by_ic() * reworded the commit msg - patch 3: dropped. the differences between dlpar_memory_remove_by_ic() and dlpar_memory_remove_by_count() makes a helper

[PATCH v2 2/4] powerpc/pseries: check DRCONF_MEM_RESERVED in lmb_is_removable()

2021-05-12 Thread Daniel Henrique Barboza
DRCONF_MEM_RESERVED is a flag that represents the "Reserved Memory" status in LOPAR v2.10, section 4.2.8. If a LMB is marked as reserved, quoting LOPAR, "is not to be used or altered by the base OS". This flag is read only in the kernel, being set by the firmware/hypervisor in the DT. As an

Re: [PATCH 2/3] hotplug-memory.c: enhance dlpar_memory_remove* LMB checks

2021-05-12 Thread David Gibson
On Wed, May 12, 2021 at 05:35:39PM -0300, Daniel Henrique Barboza wrote: > > On 5/3/21 10:02 PM, David Gibson wrote: > > On Fri, Apr 30, 2021 at 09:09:16AM -0300, Daniel Henrique Barboza wrote: > > > dlpar_memory_remove_by_ic() validates the amount of LMBs to be removed > > > by checking

Re: [PATCH v2 3/4] powerpc/pseries: break early in dlpar_memory_remove_by_count() loops

2021-05-12 Thread David Gibson
On Wed, May 12, 2021 at 05:28:08PM -0300, Daniel Henrique Barboza wrote: > After marking the LMBs as reserved depending on dlpar_remove_lmb() rc, > we evaluate whether we need to add the LMBs back or if we can release > the LMB DRCs. In both cases, a for_each_drmem_lmb() loop without a break >

Re: [PATCH v2 4/4] powerpc/pseries: minor enhancements in dlpar_memory_remove_by_ic()

2021-05-12 Thread David Gibson
On Wed, May 12, 2021 at 05:28:09PM -0300, Daniel Henrique Barboza wrote: > We don't need the 'lmbs_available' variable to count the valid LMBs and > to check if we have less than 'lmbs_to_remove'. We must ensure that the > entire LMB range must be removed, so we can error out immediately if any >

Re: [PATCH v2 2/4] powerpc/pseries: check DRCONF_MEM_RESERVED in lmb_is_removable()

2021-05-12 Thread David Gibson
On Wed, May 12, 2021 at 05:28:07PM -0300, Daniel Henrique Barboza wrote: > DRCONF_MEM_RESERVED is a flag that represents the "Reserved Memory" > status in LOPAR v2.10, section 4.2.8. If a LMB is marked as reserved, > quoting LOPAR, "is not to be used or altered by the base OS". This flag > is read