Re: [PATCH v3 2/2] powerpc/uaccess: Add pre-update addressing to __get_user_asm() and __put_user_asm()

2020-08-12 Thread Christophe Leroy
Le 12/08/2020 à 21:37, Segher Boessenkool a écrit : On Wed, Aug 12, 2020 at 12:25:17PM +, Christophe Leroy wrote: Enable pre-update addressing mode in __get_user_asm() and __put_user_asm() Signed-off-by: Christophe Leroy --- v3: new, splited out from patch 1. It still looks fine to

Re: [PATCH 16/16] debug_vm_pgtable/ppc64: Add a variant of pfn_pte/pmd

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > The tests do expect _PAGE_PTE bit set by different page table accessors. > This is not true for the kernel. Within the kernel, _PAGE_PTE bits are > usually set by set_pte_at(). To make the below tests work correctly add test > specific

Re: [PATCH 13/16] debug_vm_pgtable/pmd_clear: Don't use pmd/pud_clear on pte entries

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > pmd_clear() should not be used to clear pmd level pte entries. Could you please elaborate on this. The proposed change set does not match the description here. > > Signed-off-by: Aneesh Kumar K.V > --- > mm/debug_vm_pgtable.c | 7 --- >

Re: [PATCH 10/16] debug_vm_pgtable/thp: Use page table depost/withdraw with THP

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > Architectures like ppc64 use deposited page table while updating the huge pte > entries. > > Signed-off-by: Aneesh Kumar K.V > --- > mm/debug_vm_pgtable.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git

[PATCH] powerpc/papr_scm: Limit the readability of 'perf_stats' sysfs attribute

2020-08-12 Thread Vaibhav Jain
The newly introduced 'perf_stats' attribute uses the default access mode of 0444 letting non-root users access performance stats of an nvdimm and potentially force the kernel into issuing large number of expensive HCALLs. Since the information exposed by this attribute cannot be cached hence its

[PATCH 3/3] selftests/powerpc: Run tm-tmspr test for longer

2020-08-12 Thread Michael Ellerman
This test creates some threads, which write to TM SPRs, and then makes sure the registers maintain the correct values across context switches and contention with other threads. But currently the test finishes almost instantaneously, which reduces the chance of it hitting an interesting condition.

[PATCH 2/3] selftests/powerpc: Don't use setaffinity in tm-tmspr

2020-08-12 Thread Michael Ellerman
This test tries to set affinity to CPUs that don't exist, especially if the set of online CPUs doesn't start at 0. But there's no real reason for it to use setaffinity in the first place, it's just trying to create lots of threads to cause contention. So drop the setaffinity entirely.

[PATCH 1/3] selftests/powerpc: Fix TM tests when CPU 0 is offline

2020-08-12 Thread Michael Ellerman
Several of the TM tests fail spuriously if CPU 0 is offline, because they blindly try to affinitise to CPU 0. Fix them by picking any online CPU and using that instead. Signed-off-by: Michael Ellerman --- tools/testing/selftests/powerpc/tm/tm-poison.c | 11 +++

Re: [PATCH v2] powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

2020-08-12 Thread Nathan Lynch
Michael Ellerman writes: > Tyrel Datwyler writes: >> On 8/11/20 6:20 PM, Nathan Lynch wrote: >>> >>> +static inline struct drmem_lmb *drmem_lmb_next(struct drmem_lmb *lmb) >>> +{ >>> + const unsigned int resched_interval = 20; >>> + >>> + BUG_ON(lmb < drmem_info->lmbs); >>> + BUG_ON(lmb

Re: [PATCH] powerpc: Fix P10 PVR revision in /proc/cpuinfo for SMT4 cores

2020-08-12 Thread Michael Neuling
On Mon, 2020-08-03 at 22:41 +1000, Michael Ellerman wrote: > Michael Neuling writes: > > On POWER10 bit 12 in the PVR indicates if the core is SMT4 or > > SMT8. Bit 12 is set for SMT4. > > > > Without this patch, /proc/cpuinfo on a SMT4 DD1 POWER10 looks like > > this: > > cpu :

Re: [PATCH v2] powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

2020-08-12 Thread Michael Ellerman
Tyrel Datwyler writes: > On 8/11/20 6:20 PM, Nathan Lynch wrote: >> The drmem lmb list can have hundreds of thousands of entries, and >> unfortunately lookups take the form of linear searches. As long as >> this is the case, traversals have the potential to monopolize the CPU >> and provoke

[RFC PATCH v1 1/4] powerpc: apm82181: create shared dtsi for APM bluestone

2020-08-12 Thread Christian Lamparter
This patch adds an DTSI-File that can be used by various device-tree files for APM82181-based devices. Some of the nodes (like UART, PCIE, SATA) are used by the uboot and need to stick with the naming-conventions of the old times'. I've added comments whenever this was the case. But

[RFC PATCH v1 3/4] powerpc: apm82181: add Meraki MR24 AP

2020-08-12 Thread Christian Lamparter
This patch adds the device-tree definitions for Meraki MR24 Accesspoint devices. Ready to go images and install instruction can be found @OpenWrt. Signed-off-By: Chris Blake Signed-off-by: Christian Lamparter --- arch/powerpc/boot/dts/meraki-mr24.dts | 237 +

[RFC PATCH v1 0/4] powerpc: apm82181: adding customer devices

2020-08-12 Thread Christian Lamparter
Hello, I've been holding on to these devices dts' for a while now. But ever since the recent purge of the PPC405, I'm feeling the urge to move forward. The devices in question have been running with OpenWrt since around 2016/2017. Back then it was linux v4.4 and required many out-of-tree patches

[RFC PATCH v1 4/4] powerpc: apm82181: integrate bluestone.dts

2020-08-12 Thread Christian Lamparter
This patch tries to integrate the existing bluestone.dts into the apm82181.dtsi framework. The original bluestone.dts produces a peculiar warning message. > bluestone.dts:120.10-125.4: Warning (i2c_bus_reg): > /plb/opb/i2c@ef600700/sttm@4C: I2C bus unit address format error, expected > "4c"

[RFC PATCH v1 2/4] powerpc: apm82181: add WD MyBook Live NAS

2020-08-12 Thread Christian Lamparter
This patch adds the device-tree definitions for Western Digital MyBook Live NAS devices. Technically, this devicetree file is shared by two, very similar devices. There's the My Book Live and the My Book Live Duo. WD's uboot on the device will enable/disable the nodes for the device. Ready to

Re: [PATCH v3 2/2] powerpc/uaccess: Add pre-update addressing to __get_user_asm() and __put_user_asm()

2020-08-12 Thread Segher Boessenkool
On Wed, Aug 12, 2020 at 12:25:17PM +, Christophe Leroy wrote: > Enable pre-update addressing mode in __get_user_asm() and __put_user_asm() > > Signed-off-by: Christophe Leroy > --- > v3: new, splited out from patch 1. It still looks fine to me, you can keep my Reviewed-by: :-) Segher

Re: [PATCH v2] powerpc/uaccess: Use flexible addressing with __put_user()/__get_user()

2020-08-12 Thread Segher Boessenkool
On Wed, Aug 12, 2020 at 02:32:51PM +0200, Christophe Leroy wrote: > Anyway, it seems that GCC doesn't make much use of the "m<>" and the > pre-update form. GCC does not use update form outside of inner loops much. Did you expect anything else? > Most of the benefit of flexible addressing seems

Re: [PATCH v2] powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

2020-08-12 Thread Tyrel Datwyler
On 8/11/20 6:20 PM, Nathan Lynch wrote: > The drmem lmb list can have hundreds of thousands of entries, and > unfortunately lookups take the form of linear searches. As long as > this is the case, traversals have the potential to monopolize the CPU > and provoke lockup reports, workqueue stalls,

Re: [PATCH v3 8/8] mm/vmalloc: Hugepage vmalloc mappings

2020-08-12 Thread Jonathan Cameron
On Wed, 12 Aug 2020 13:25:24 +0100 Jonathan Cameron wrote: > On Mon, 10 Aug 2020 12:27:32 +1000 > Nicholas Piggin wrote: > > > On platforms that define HAVE_ARCH_HUGE_VMAP and support PMD vmaps, > > vmalloc will attempt to allocate PMD-sized pages first, before falling > > back to small pages.

Re: [PATCH v2] powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

2020-08-12 Thread Christophe Leroy
Le 12/08/2020 à 15:46, Nathan Lynch a écrit : Hi Christophe, Christophe Leroy writes: +static inline struct drmem_lmb *drmem_lmb_next(struct drmem_lmb *lmb) +{ + const unsigned int resched_interval = 20; + + BUG_ON(lmb < drmem_info->lmbs); + BUG_ON(lmb >= drmem_info->lmbs

Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 7:04 PM, Anshuman Khandual wrote: On 08/12/2020 06:46 PM, Aneesh Kumar K.V wrote: On 8/12/20 6:33 PM, Anshuman Khandual wrote: On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: The seems to be missing quite a lot of details w.r.t allocating the correct pgtable_t page

Re: [PATCH v2] powerpc/pseries: explicitly reschedule during drmem_lmb list traversal

2020-08-12 Thread Nathan Lynch
Hi Christophe, Christophe Leroy writes: >> +static inline struct drmem_lmb *drmem_lmb_next(struct drmem_lmb *lmb) >> +{ >> +const unsigned int resched_interval = 20; >> + >> +BUG_ON(lmb < drmem_info->lmbs); >> +BUG_ON(lmb >= drmem_info->lmbs + drmem_info->n_lmbs); > > BUG_ON() shall

Re: [PATCH v2] powerpc/pseries/hotplug-cpu: wait indefinitely for vCPU death

2020-08-12 Thread Greg Kurz
On Tue, 11 Aug 2020 11:15:44 -0500 Michael Roth wrote: > For a power9 KVM guest with XIVE enabled, running a test loop > where we hotplug 384 vcpus and then unplug them, the following traces > can be seen (generally within a few loops) either from the unplugged > vcpu: > > [ 1767.353447] cpu

Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 06:46 PM, Aneesh Kumar K.V wrote: > On 8/12/20 6:33 PM, Anshuman Khandual wrote: >> >> >> On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: >>> The seems to be missing quite a lot of details w.r.t allocating >>> the correct pgtable_t page (huge_pte_alloc()), holding the right >>>

Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 6:33 PM, Anshuman Khandual wrote: On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: The seems to be missing quite a lot of details w.r.t allocating the correct pgtable_t page (huge_pte_alloc()), holding the right lock (huge_pte_lock()) etc. The vma used is also not a hugetlb VMA.

[Virtual ppce500] virtio_gpu virtio0: swiotlb buffer is full

2020-08-12 Thread Christian Zigotzky
Hello Daniel, The VirtIO-GPU doesn't work anymore with the latest Git kernel in a virtual e5500 PPC64 QEMU machine [1,2] after the commit "drm/virtio: Call the right shmem helpers". [3] The kernel 5.8 works with the VirtIO-GPU in this virtual machine. I bisected today [4]. Result:

Re: [PATCH 15/16] debug_vm_pgtable/savedwrite: Use savedwrite test with protnone ptes

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > Saved write support was added to track the write bit of a pte after marking > the > pte protnone. This was done so that AUTONUMA can convert a write pte to > protnone > and still track the old write bit. When converting it back we set the pte

Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > The seems to be missing quite a lot of details w.r.t allocating > the correct pgtable_t page (huge_pte_alloc()), holding the right > lock (huge_pte_lock()) etc. The vma used is also not a hugetlb VMA. > > ppc64 do have runtime checks within

Re: [PATCH 09/16] debug_vm_pgtable/set_pud: Don't use set_pud_at to update an existing pud entry

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > set_pud_at() should not be used to set a pte entry at locations that > already holds a valid pte entry. Architectures like ppc64 don't do TLB > invalidate in set_pud_at() and hence expect it to be used to set locations > that are not a valid

Re: [PATCH 08/16] debug_vm_pgtable/set_pmd: Don't use set_pmd_at to update an existing pmd entry

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > set_pmd_at() should not be used to set a pte entry at locations that > already holds a valid pte entry. Architectures like ppc64 don't do TLB > invalidate in set_pmd_at() and hence expect it to be used to set locations > that are not a valid

Re: [PATCH v2] powerpc/uaccess: Use flexible addressing with __put_user()/__get_user()

2020-08-12 Thread Christophe Leroy
Le 08/07/2020 à 06:49, Christophe Leroy a écrit : Le 07/07/2020 à 21:02, Christophe Leroy a écrit : Le 07/07/2020 à 14:44, Christophe Leroy a écrit : Le 30/06/2020 à 03:19, Michael Ellerman a écrit : Michael Ellerman writes: Christophe Leroy writes: Hi Michael, I see this patch

Re: [PATCH v3 8/8] mm/vmalloc: Hugepage vmalloc mappings

2020-08-12 Thread Jonathan Cameron
On Mon, 10 Aug 2020 12:27:32 +1000 Nicholas Piggin wrote: > On platforms that define HAVE_ARCH_HUGE_VMAP and support PMD vmaps, > vmalloc will attempt to allocate PMD-sized pages first, before falling > back to small pages. > > Allocations which use something other than PAGE_KERNEL protections

[PATCH v3 1/2] powerpc/uaccess: Use flexible addressing with __put_user()/__get_user()

2020-08-12 Thread Christophe Leroy
At the time being, __put_user()/__get_user() and friends only use D-form addressing, with 0 offset. Ex: lwz reg1, 0(reg2) Give the compiler the opportunity to use other adressing modes whenever possible, to get more optimised code. Hereunder is a small exemple: struct test {

[PATCH v3 2/2] powerpc/uaccess: Add pre-update addressing to __get_user_asm() and __put_user_asm()

2020-08-12 Thread Christophe Leroy
Enable pre-update addressing mode in __get_user_asm() and __put_user_asm() Signed-off-by: Christophe Leroy --- v3: new, splited out from patch 1. --- arch/powerpc/include/asm/uaccess.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h

[RFC PATCH v1 18/19] powerpc/signal32: Add and use unsafe_put_sigset_t()

2020-08-12 Thread Christophe Leroy
put_sigset_t() calls copy_to_user() for copying two words. Because INLINE_COPY_TO_USER is not defined on powerpc, copy_to_user() doesn't get optimised and falls back to copy_tofrom_user() with the relevant glue. This is terribly inefficient for copying two words. By switching to

[RFC PATCH v1 19/19] powerpc/signal32: Switch swap_context() to user_access_begin() logic

2020-08-12 Thread Christophe Leroy
As this was the last user of put_sigset_t(), remove it as well. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c

[RFC PATCH v1 17/19] signal: Add unsafe_put_compat_sigset()

2020-08-12 Thread Christophe Leroy
Implement 'unsafe' version of put_compat_sigset() For the bigendian, use unsafe_put_user() directly to avoid intermediate copy through the stack. For the littleendian, use a straight unsafe_copy_to_user(). Signed-off-by: Christophe Leroy Cc: Dmitry V. Levin Cc: Al Viro ---

[RFC PATCH v1 16/19] powerpc/signal32: Switch handle_rt_signal32() to user_access_begin() logic

2020-08-12 Thread Christophe Leroy
Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 47 + 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 4ea83578ba9d..d03ba3d8eb68 100644 ---

[RFC PATCH v1 11/19] powerpc/signal32: Simplify logging in handle_rt_signal32()

2020-08-12 Thread Christophe Leroy
If something is bad in the frame, there is no point in knowing which part of the frame exactly is wrong as it got allocated as a single block. Always print the root address of the frame in case on failed user access, just like handle_signal32(). Signed-off-by: Christophe Leroy ---

[RFC PATCH v1 15/19] powerpc/signal32: Switch handle_signal32() to user_access_begin() logic

2020-08-12 Thread Christophe Leroy
Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 0d076c2a9f6c..4ea83578ba9d 100644 ---

[RFC PATCH v1 14/19] powerpc/signal32: Switch save_user_regs() and save_tm_user_regs() to user_access_begin() logic

2020-08-12 Thread Christophe Leroy
Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 168 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 2c3d5d4400ec..0d076c2a9f6c 100644 ---

[RFC PATCH v1 13/19] powerpc/signal32: Create 'unsafe' versions of copy_[ck][fpr/vsx]_to_user()

2020-08-12 Thread Christophe Leroy
For the non VSX version, that's trivial. Just use unsafe_copy_to_user() instead of __copy_to_user(). For the VSX version, remove the intermediate step through a buffer and use unsafe_put_user() directly. This generates a far smaller code which is acceptable to inline, see below: Standard VSX

[RFC PATCH v1 12/19] powerpc/signal32: Regroup copies in save_user_regs() and save_tm_user_regs()

2020-08-12 Thread Christophe Leroy
Reorder actions in save_user_regs() and save_tm_user_regs() to regroup copies together in order to switch to user_access_begin() logic in a later patch. In save_tm_user_regs(), first perform copies to frame, then perform copies to tm_frame. Signed-off-by: Christophe Leroy ---

[RFC PATCH v1 05/19] powerpc/signal: Don't manage floating point regs when no FPU

2020-08-12 Thread Christophe Leroy
There is no point in copying floating point regs when there is no FPU and MATH_EMULATION is not selected. Create a new CONFIG_PPC_FPU_REGS bool that is selected by CONFIG_MATH_EMULATION and CONFIG_PPC_FPU, and use it to opt out everything related to fp_state in thread_struct. The asm const used

[RFC PATCH v1 10/19] powerpc/signal: Refactor bad frame logging

2020-08-12 Thread Christophe Leroy
The logging of bad frame appears half a dozen of times and is pretty similar. Create signal_fault() fonction to perform that logging. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 11 +++ arch/powerpc/kernel/signal.h| 3 +++ arch/powerpc/kernel/signal_32.c

[RFC PATCH v1 09/19] powerpc/signal: Call get_tm_stackpointer() from get_sigframe()

2020-08-12 Thread Christophe Leroy
Instead of calling get_tm_stackpointer() from the caller, call it directly from get_sigframe(). This avoids a double call and allows get_tm_stackpointer() to become static and be inlined into get_sigframe() by GCC. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 9

[RFC PATCH v1 06/19] powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x

2020-08-12 Thread Christophe Leroy
The e300c2 core which is embedded in mpc832x CPU doesn't have an FPU. Make it possible to not select CONFIG_PPC_FPU when building a kernel dedicated to that target. Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/Kconfig.cputype | 11 +-- 1 file changed, 9 insertions(+), 2

[RFC PATCH v1 07/19] powerpc/signal: Move access_ok() out of get_sigframe()

2020-08-12 Thread Christophe Leroy
This access_ok() will soon be performed by user_access_begin(). So move it out of get_sigframe() Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 4 arch/powerpc/kernel/signal_32.c | 4 ++-- arch/powerpc/kernel/signal_64.c | 2 +- 3 files changed, 3 insertions(+), 7

[RFC PATCH v1 08/19] powerpc/signal: Remove get_clean_sp()

2020-08-12 Thread Christophe Leroy
get_clean_sp() is only used once in kernel/signal.c . And GCC is smart enough to see that x & 0x is a nop calculation on PPC32, no need of a special PPC32 trivial version. Include the logic from the PPC64 version of get_clean_sp() directly in get_sigframe() Signed-off-by: Christophe

[RFC PATCH v1 01/19] powerpc/signal: Move inline functions in signal.h

2020-08-12 Thread Christophe Leroy
To really be inlined, the functions needs to be defined in the same C file as the caller, or in an included header. Move functions from signal .c defined inline in signal.h Signed-off-by: Christophe Leroy Fixes: 3dd4eb83a9c0 ("powerpc: move common register copy functions from signal_32.c to

[RFC PATCH v1 02/19] powerpc/ptrace: Move declaration of ptrace_get_reg() and ptrace_set_reg()

2020-08-12 Thread Christophe Leroy
ptrace_get_reg() and ptrace_set_reg() are only used internally by ptrace. Move them in arch/powerpc/kernel/ptrace/ptrace-decl.h Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ptrace.h| 6 -- arch/powerpc/kernel/ptrace/ptrace-decl.h | 3 +++ 2 files changed, 3

[RFC PATCH v1 00/19] powerpc: Switch signal 32 to using user_access_begin() and friends

2020-08-12 Thread Christophe Leroy
This series replaces copies to users by unsafe_put_user() and friends with user_write_access_begin() dance in signal32. The advantages are: - No KUAP unlock/lock at every copy - More readable code. - Better generated code. Copying Al Viro who did it on x86 and may have suggestions, and Dmitry V.

[RFC PATCH v1 04/19] powerpc/ptrace: Create ptrace_get_fpr() and ptrace_put_fpr()

2020-08-12 Thread Christophe Leroy
On the same model as ptrace_get_reg() and ptrace_put_reg(), create ptrace_get_fpr() and ptrace_put_fpr() to get/set the floating points registers. We move the boundary checkings in them. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/ptrace/Makefile | 1 +

[RFC PATCH v1 03/19] powerpc/ptrace: Consolidate reg index calculation

2020-08-12 Thread Christophe Leroy
Today we have: #ifdef CONFIG_PPC32 index = addr >> 2; if ((addr & 3) || child->thread.regs == NULL) #else index = addr >> 3; if ((addr & 7)) #endif sizeof(long) has value 4 for PPC32 and value 8 for PPC64.

Re: [PATCH 07/16] debug_vm_pgtable/THP: Mark the pte entry huge before using set_pud_at

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > kernel expect entries to be marked huge before we use set_pud_at(). > > Signed-off-by: Aneesh Kumar K.V > --- > mm/debug_vm_pgtable.c | 11 +++ > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c

Re: [PATCH 05/16] debug_vm_pgtable/savedwrite: Enable savedwrite test with CONFIG_NUMA_BALANCING

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > Saved write support was added to track the write bit of a pte after marking > the > pte protnone. This was done so that AUTONUMA can convert a write pte to > protnone > and still track the old write bit. When converting it back we set the pte

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-12 Thread peterz
On Wed, Aug 12, 2020 at 06:18:28PM +1000, Nicholas Piggin wrote: > Excerpts from pet...@infradead.org's message of August 7, 2020 9:11 pm: > > > > What's wrong with something like this? > > > > AFAICT there's no reason to actually try and add IRQ tracing here, it's > > just a hand full of

Re: [PATCH 04/16] debug_vm_pgtables/hugevmap: Use the arch helper to identify huge vmap support.

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > ppc64 supports huge vmap only with radix translation. Hence use arch helper > to determine the huge vmap support. > > Signed-off-by: Aneesh Kumar K.V > --- > mm/debug_vm_pgtable.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >

Re: [PATCH 03/16] debug_vm_pgtable/set_pte: Don't use set_pte_at to update an existing pte entry

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 2:42 PM, Anshuman Khandual wrote: On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: set_pte_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pte_at() and hence expect it to be used to

Re: [PATCH 03/16] debug_vm_pgtable/set_pte: Don't use set_pte_at to update an existing pte entry

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > set_pte_at() should not be used to set a pte entry at locations that > already holds a valid pte entry. Architectures like ppc64 don't do TLB > invalidate in set_pte_at() and hence expect it to be used to set locations > that are not a valid

Re: [PATCH 01/16] powerpc/mm: Add DEBUG_VM WARN for pmd_clear

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 1:16 PM, Anshuman Khandual wrote: On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: With the hash page table, the kernel should not use pmd_clear for clearing huge pte entries. Add a DEBUG_VM WARN to catch the wrong usage. Signed-off-by: Aneesh Kumar K.V This particular change is

Re: [PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 1:42 PM, Anshuman Khandual wrote: On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit in random value. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 5 - 1 file changed, 4 insertions(+),

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-12 Thread Nicholas Piggin
Excerpts from pet...@infradead.org's message of August 7, 2020 9:11 pm: > > What's wrong with something like this? > > AFAICT there's no reason to actually try and add IRQ tracing here, it's > just a hand full of instructions at the most. Because we may want to use that in other places as well,

Re: [PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit > in > random value. > > Signed-off-by: Aneesh Kumar K.V > --- > mm/debug_vm_pgtable.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git

Re: [PATCH v3 0/8] huge vmalloc mappings

2020-08-12 Thread Nicholas Piggin
Excerpts from Zefan Li's message of August 12, 2020 11:07 am: > On 2020/8/12 0:32, Jonathan Cameron wrote: >> On Mon, 10 Aug 2020 12:27:24 +1000 >> Nicholas Piggin wrote: >> >>> Not tested on x86 or arm64, would appreciate a quick test there so I can >>> ask Andrew to put it in -mm. Other option

[PATCH 2/2] powerpc: unrel_branch_check.sh: enable the use of llvm-objdump v9, 10 or 11

2020-08-12 Thread Stephen Rothwell
Currently, using llvm-objtool, this script just silently succeeds without actually do the intended checking. So this updates it to work properly. Firstly, llvm-objdump does not add target symbol names to the end of branches in its asm output, so we have to drop the branch to

[PATCH 1/2] powerpc: unrel_branch_check.sh: use nm to find symbol value

2020-08-12 Thread Stephen Rothwell
This is considerably faster then parsing the objdump asm output. It will also make the enabling of llvm-objdump a little easier. Cc: Nicholas Piggin Cc: Bill Wendling Signed-off-by: Stephen Rothwell --- arch/powerpc/Makefile.postlink | 2 +-

[PATCH 0/2] powerpc: unrel_branch_check.sh: enable llvm-objdump

2020-08-12 Thread Stephen Rothwell
These 2 patches enable this script to work properly when llvm-objtool is being used. They depend on my previos series that make this script suck less. Cc: Nicholas Piggin Cc: Bill Wendling

Re: [PATCH 01/16] powerpc/mm: Add DEBUG_VM WARN for pmd_clear

2020-08-12 Thread Anshuman Khandual
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > With the hash page table, the kernel should not use pmd_clear for clearing > huge pte entries. Add a DEBUG_VM WARN to catch the wrong usage. > > Signed-off-by: Aneesh Kumar K.V This particular change is very much powerpc specific. Hence please

Re: [PATCH] powerpc/papr_scm: Make access mode of 'perf_stats' attribute file to '0400'

2020-08-12 Thread Vaibhav Jain
Hi Mpe, Thanks for reviewing this patch. My responses below: Michael Ellerman writes: > Vaibhav Jain writes: >> The newly introduced 'perf_stats' attribute uses the default access >> mode of 0444 letting non-root users access performance stats of an >> nvdimm and potentially force the kernel

Re: [PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value

2020-08-12 Thread Aneesh Kumar K.V
On 8/12/20 12:10 PM, Christophe Leroy wrote: Le 12/08/2020 à 08:33, Aneesh Kumar K.V a écrit : ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit in random value. Signed-off-by: Aneesh Kumar K.V ---   mm/debug_vm_pgtable.c | 5 -   1 file changed, 4

Re: [PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value

2020-08-12 Thread Christophe Leroy
Le 12/08/2020 à 08:33, Aneesh Kumar K.V a écrit : ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit in random value. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH 16/16] debug_vm_pgtable/ppc64: Add a variant of pfn_pte/pmd

2020-08-12 Thread Aneesh Kumar K.V
The tests do expect _PAGE_PTE bit set by different page table accessors. This is not true for the kernel. Within the kernel, _PAGE_PTE bits are usually set by set_pte_at(). To make the below tests work correctly add test specific pfn_pte/pmd helpers that set _PAGE_PTE bit. pte_t pte =

[PATCH 15/16] debug_vm_pgtable/savedwrite: Use savedwrite test with protnone ptes

2020-08-12 Thread Aneesh Kumar K.V
Saved write support was added to track the write bit of a pte after marking the pte protnone. This was done so that AUTONUMA can convert a write pte to protnone and still track the old write bit. When converting it back we set the pte write bit correctly thereby avoiding a write fault again.

[PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64

2020-08-12 Thread Aneesh Kumar K.V
The seems to be missing quite a lot of details w.r.t allocating the correct pgtable_t page (huge_pte_alloc()), holding the right lock (huge_pte_lock()) etc. The vma used is also not a hugetlb VMA. ppc64 do have runtime checks within CONFIG_DEBUG_VM for most of these. Hence disable the test on

[PATCH 13/16] debug_vm_pgtable/pmd_clear: Don't use pmd/pud_clear on pte entries

2020-08-12 Thread Aneesh Kumar K.V
pmd_clear() should not be used to clear pmd level pte entries. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index 061c19bba7f0..529892b9be2f 100644 ---

[PATCH 12/16] debug_vm_pgtable/locks: Take correct page table lock

2020-08-12 Thread Aneesh Kumar K.V
Make sure we call pte accessors with correct lock held. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index

[PATCH 11/16] debug_vm_pgtable/locks: Move non page table modifying test together

2020-08-12 Thread Aneesh Kumar K.V
This will help in adding proper locks in a later patch Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 53 +++ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index

[PATCH 10/16] debug_vm_pgtable/thp: Use page table depost/withdraw with THP

2020-08-12 Thread Aneesh Kumar K.V
Architectures like ppc64 use deposited page table while updating the huge pte entries. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index

[PATCH 09/16] debug_vm_pgtable/set_pud: Don't use set_pud_at to update an existing pud entry

2020-08-12 Thread Aneesh Kumar K.V
set_pud_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pud_at() and hence expect it to be used to set locations that are not a valid PTE. Signed-off-by: Aneesh Kumar K.V ---

[PATCH 08/16] debug_vm_pgtable/set_pmd: Don't use set_pmd_at to update an existing pmd entry

2020-08-12 Thread Aneesh Kumar K.V
set_pmd_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pmd_at() and hence expect it to be used to set locations that are not a valid PTE. Signed-off-by: Aneesh Kumar K.V ---

[PATCH 07/16] debug_vm_pgtable/THP: Mark the pte entry huge before using set_pud_at

2020-08-12 Thread Aneesh Kumar K.V
kernel expect entries to be marked huge before we use set_pud_at(). Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index b6aca2526e01..cd609a212dd4 100644 ---

[PATCH 06/16] debug_vm_pgtable/THP: Mark the pte entry huge before using set_pmd_at

2020-08-12 Thread Aneesh Kumar K.V
kernel expect entries to be marked huge before we use set_pmd_at(). Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index de8a62d0a931..b6aca2526e01 100644 ---

[PATCH 05/16] debug_vm_pgtable/savedwrite: Enable savedwrite test with CONFIG_NUMA_BALANCING

2020-08-12 Thread Aneesh Kumar K.V
Saved write support was added to track the write bit of a pte after marking the pte protnone. This was done so that AUTONUMA can convert a write pte to protnone and still track the old write bit. When converting it back we set the pte write bit correctly thereby avoiding a write fault again. Hence

[PATCH 04/16] debug_vm_pgtables/hugevmap: Use the arch helper to identify huge vmap support.

2020-08-12 Thread Aneesh Kumar K.V
ppc64 supports huge vmap only with radix translation. Hence use arch helper to determine the huge vmap support. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index

[PATCH 03/16] debug_vm_pgtable/set_pte: Don't use set_pte_at to update an existing pte entry

2020-08-12 Thread Aneesh Kumar K.V
set_pte_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pte_at() and hence expect it to be used to set locations that are not a valid PTE. Signed-off-by: Aneesh Kumar K.V ---

[PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value

2020-08-12 Thread Aneesh Kumar K.V
ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit in random value. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index

[PATCH 01/16] powerpc/mm: Add DEBUG_VM WARN for pmd_clear

2020-08-12 Thread Aneesh Kumar K.V
With the hash page table, the kernel should not use pmd_clear for clearing huge pte entries. Add a DEBUG_VM WARN to catch the wrong usage. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 14 ++ 1 file changed, 14 insertions(+) diff --git

Re: [PATCH v5 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline

2020-08-12 Thread Srikar Dronamraju
Hi Andrew, Michal, David * Andrew Morton [2020-08-06 21:32:11]: > On Fri, 3 Jul 2020 18:28:23 +0530 Srikar Dronamraju > wrote: > > > > The memory hotplug changes that somehow because you can hotremove numa > > > nodes and therefore make the nodemask sparse but that is not a common > > >