[PATCH] powerpc: Reduce csum_add() complexity for PPC64

2022-02-11 Thread Christophe Leroy
PPC64 does everything in C, gcc is able to skip calculation when one of the operands in zero. Move the constant folding in PPC32 part. This helps GCC and reduces ppc64_defconfig by 170 bytes. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/checksum.h | 9 - 1 file

[PATCH v5 5/6] drivers: virtio_mem: use pageblock size as the minimum virtio_mem size.

2022-02-11 Thread Zi Yan
From: Zi Yan alloc_contig_range() now only needs to be aligned to pageblock_order, drop virtio_mem size requirement that it needs to be the max of pageblock_order and MAX_ORDER. Signed-off-by: Zi Yan --- drivers/virtio/virtio_mem.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-)

[PATCH v5 6/6] arch: powerpc: adjust fadump alignment to be pageblock aligned.

2022-02-11 Thread Zi Yan
From: Zi Yan CMA only requires pageblock alignment now. Change CMA alignment in fadump too. Signed-off-by: Zi Yan --- arch/powerpc/include/asm/fadump-internal.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/fadump-internal.h

[PATCH v5 4/6] mm: cma: use pageblock_order as the single alignment

2022-02-11 Thread Zi Yan
From: Zi Yan Now alloc_contig_range() works at pageblock granularity. Change CMA allocation, which uses alloc_contig_range(), to use pageblock_order alignment. Signed-off-by: Zi Yan --- include/linux/mmzone.h | 5 + kernel/dma/contiguous.c | 2 +- mm/cma.c| 6 ++

[PATCH v5 3/6] mm: make alloc_contig_range work at pageblock granularity

2022-02-11 Thread Zi Yan
From: Zi Yan alloc_contig_range() worked at MAX_ORDER-1 granularity to avoid merging pageblocks with different migratetypes. It might unnecessarily convert extra pageblocks at the beginning and at the end of the range. Change alloc_contig_range() to work at pageblock granularity. Special

[PATCH v5 0/6] Use pageblock_order for cma and alloc_contig_range alignment.

2022-02-11 Thread Zi Yan
From: Zi Yan Hi all, This patchset tries to remove the MAX_ORDER-1 alignment requirement for CMA and alloc_contig_range(). It prepares for my upcoming changes to make MAX_ORDER adjustable at boot time[1]. It is on top of mmotm-2022-02-08-15-31. Changelog === V5 --- 1. Moved isolation address

[PATCH v5 1/6] mm: page_isolation: move has_unmovable_pages() to mm/page_isolation.c

2022-02-11 Thread Zi Yan
From: Zi Yan has_unmovable_pages() is only used in mm/page_isolation.c. Move it from mm/page_alloc.c and make it static. Signed-off-by: Zi Yan Reviewed-by: Oscar Salvador --- include/linux/page-isolation.h | 2 - mm/page_alloc.c| 119 -

[PATCH v5 2/6] mm: page_isolation: check specified range for unmovable pages

2022-02-11 Thread Zi Yan
From: Zi Yan Enable set_migratetype_isolate() to check specified sub-range for unmovable pages during isolation. Page isolation is done at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all pages within that granularity are intended to be isolated. For example,

Re: rcutorture’s init segfaults in ppc64le VM

2022-02-11 Thread Paul Menzel
Dear Michael, Am 11.02.22 um 15:19 schrieb Paul Menzel: Am 11.02.22 um 02:48 schrieb Michael Ellerman: Paul Menzel writes: Am 08.02.22 um 11:09 schrieb Michael Ellerman: Paul Menzel writes: […] On the POWER8 server IBM S822LC running Ubuntu 21.10, building Linux 5.17-rc2+ with

Re: [PATCH v5 2/6] powerpc/kexec_file: Add KEXEC_SIG support.

2022-02-11 Thread Paul Menzel
Dear Michal, Am 09.02.22 um 13:01 schrieb Michal Suchánek: On Wed, Feb 09, 2022 at 07:44:15AM +0100, Paul Menzel wrote: Am 11.01.22 um 12:37 schrieb Michal Suchanek: […] How can this be tested? Apparently KEXEC_SIG_FORCE is x86 only although the use of the option is arch neutral:

Re: [RFC PATCH 0/3] powerpc64/bpf: Add support for BPF Trampolines

2022-02-11 Thread Christophe Leroy
Le 07/02/2022 à 08:07, Naveen N. Rao a écrit : > This is an early RFC series that adds support for BPF Trampolines on > powerpc64. Some of the selftests are passing for me, but this needs more > testing and I've likely missed a few things as well. A review of the > patches and feedback about the

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread Aneesh Kumar K.V
Aneesh Kumar K.V writes: > David Hildenbrand writes: > >> On 11.02.22 10:16, Aneesh Kumar K V wrote: >>> On 2/11/22 14:00, David Hildenbrand wrote: On 11.02.22 07:52, Aneesh Kumar K.V wrote: > commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by > mobility")

[PATCH] powerpc/64: Rewrite loading of AMR_KUAP_BLOCKED in assembly

2022-02-11 Thread Christophe Leroy
Constant loading of AMR_KUAP_BLOCKED takes 5 instructions: c0016a40: 4c 00 01 2c isync c0016a44: 3d 20 fc ff lis r9,-769 c0016a48: 61 29 ff ff ori r9,r9,65535 c0016a4c: 79 29 07 c6

Re: rcutorture’s init segfaults in ppc64le VM

2022-02-11 Thread Paul Menzel
Dear Michael, Am 11.02.22 um 02:48 schrieb Michael Ellerman: Paul Menzel writes: Am 08.02.22 um 11:09 schrieb Michael Ellerman: Paul Menzel writes: […] On the POWER8 server IBM S822LC running Ubuntu 21.10, building Linux 5.17-rc2+ with rcutorture tests I'm not sure if that's the host

[PATCH] powerpc/64: Force inlining of prevent_user_access() and set_kuap()

2022-02-11 Thread Christophe Leroy
A ppc64_defconfig build exhibits about 10 copied of prevent_user_access(). It also have one copy of set_kuap(). c0017340 <.prevent_user_access.constprop.0>: c001a038: 4b ff d3 09 bl c0017340 <.prevent_user_access.constprop.0>

Re: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-11 Thread Aneesh Kumar K V
On 2/11/22 18:58, Mike Rapoport wrote: Hi Aneesh, On Fri, Feb 11, 2022 at 05:22:13PM +0530, Aneesh Kumar K V wrote: On 2/11/22 16:03, Mike Rapoport wrote: On Fri, Feb 11, 2022 at 12:03:28PM +0530, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M.

Re: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-11 Thread Mike Rapoport
Hi Aneesh, On Fri, Feb 11, 2022 at 05:22:13PM +0530, Aneesh Kumar K V wrote: > On 2/11/22 16:03, Mike Rapoport wrote: > > On Fri, Feb 11, 2022 at 12:03:28PM +0530, Aneesh Kumar K.V wrote: > > > Keep it simple by using a #define and limiting hugepage size to 2M. > > > This keeps the test simpler

Re: [RFC] Upstreaming Linux for Nintendo Wii U

2022-02-11 Thread Christophe Leroy
Hi Ash, Le 11/02/2022 à 12:29, Michael Ellerman a écrit : > Ash Logan writes: >> - Like the Wii before it, the Wii U has a small amount of RAM at address >> zero, a gap, then a large amount of RAM at a higher address. Instead of >> the "map everything and reserve the gap" approach of the Wii, we

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread David Hildenbrand
On 11.02.22 13:23, Aneesh Kumar K.V wrote: > David Hildenbrand writes: > >> On 11.02.22 10:16, Aneesh Kumar K V wrote: >>> On 2/11/22 14:00, David Hildenbrand wrote: On 11.02.22 07:52, Aneesh Kumar K.V wrote: > commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread Aneesh Kumar K.V
David Hildenbrand writes: > On 11.02.22 10:16, Aneesh Kumar K V wrote: >> On 2/11/22 14:00, David Hildenbrand wrote: >>> On 11.02.22 07:52, Aneesh Kumar K.V wrote: commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by mobility") introduced pageblock_order which

Re: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-11 Thread Aneesh Kumar K V
On 2/11/22 16:03, Mike Rapoport wrote: On Fri, Feb 11, 2022 at 12:03:28PM +0530, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are

Re: [PATCH kernel 2/3] powerpc/llvm: Sample config for LLVM LTO

2022-02-11 Thread Naveen N. Rao
Alexey Kardashevskiy wrote: Disables CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT as CONFIG_HAS_LTO_CLANG depends on it being disabled. In order to avoid disabling way too many options (like DYNAMIC_FTRACE/FUNCTION_TRACER), this converts FTRACE_MCOUNT_USE_RECORDMCOUNT from def_bool to bool.

Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL

2022-02-11 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 10 Feb 2022 16:40:28 + "Naveen N. Rao" wrote: The other option is to mark ftrace_cmp_recs() as a __weak function, but I have a vague recollection of you suggesting #ifdef rather than a __weak function in the past. I might be mis-remembering, so if you think

Re: [RFC] Upstreaming Linux for Nintendo Wii U

2022-02-11 Thread Michael Ellerman
Ash Logan writes: > Hello, Hi Ash, I can't really answer all your questions, but I can chime in on one or two things ... > - Right now I've made a new platform (like ps3) rather than joining the > GameCube and Wii in embedded6xx, since that is marked as BROKEN_ON_SMP. > The Wii U is a 3-core

Re: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-11 Thread Mike Rapoport
On Fri, Feb 11, 2022 at 12:03:28PM +0530, Aneesh Kumar K.V wrote: > Keep it simple by using a #define and limiting hugepage size to 2M. > This keeps the test simpler instead of dynamically finding the page size > and huge page size. > > Without this tests are broken w.r.t reading

[PATCH 1/2] net: Allow csum_sub() to be provided in arch

2022-02-11 Thread Christophe Leroy
In the same spirit as commit 07064c6e022b ("net: Allow csum_add to be provided in arch"), allow csum_sub() to be provided by arch. The generic implementation of csum_sub() call csum_add() with the complement of the addendum. Some architectures can do it directly. This will also avoid getting

[PATCH 2/2] powerpc/32: Implement csum_sub

2022-02-11 Thread Christophe Leroy
When building kernel with CONFIG_CC_OPTIMISE_FOR_SIZE, several copies of csum_sub() are generated, with the following code: 0170 : 170: 7c 84 20 f8 not r4,r4 174: 7c 63 20 14 addcr3,r3,r4 178: 7c 63 01 94

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread David Hildenbrand
On 11.02.22 10:16, Aneesh Kumar K V wrote: > On 2/11/22 14:00, David Hildenbrand wrote: >> On 11.02.22 07:52, Aneesh Kumar K.V wrote: >>> commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by >>> mobility") >>> introduced pageblock_order which will be used to group pages

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread Aneesh Kumar K V
On 2/11/22 14:00, David Hildenbrand wrote: On 11.02.22 07:52, Aneesh Kumar K.V wrote: commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by mobility") introduced pageblock_order which will be used to group pages better. The kernel now groups pages based on the value of

[PATCH] powerpc/bitops: Force inlining of fls()

2022-02-11 Thread Christophe Leroy
Building a kernel with CONFIG_CC_OPTIMISE_FOR_SIZE leads to the following functions being copied several times in vmlinux: 31 times __ilog2_u32() 34 times fls() Disassembly follows: c00f476c : c00f476c: 7c 63 00 34 cntlzw r3,r3 c00f4770:

[PATCH] net: Remove branch in csum_shift()

2022-02-11 Thread Christophe Leroy
Today's implementation of csum_shift() leads to branching based on parity of 'offset' 02f8 : 2f8: 70 a5 00 01 andi. r5,r5,1 2fc: 41 a2 00 08 beq 304 300: 54 84 c0 3e rotlwi r4,r4,24 304: 7c

Re: [PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-11 Thread David Hildenbrand
On 11.02.22 07:52, Aneesh Kumar K.V wrote: > commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by > mobility") > introduced pageblock_order which will be used to group pages better. > The kernel now groups pages based on the value of HPAGE_SHIFT. Hence > HPAGE_SHIFT > should