[PATCH] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()

2022-01-24 Thread Nathan Lynch
Replace the outdated iteration and timeout calculations here with indefinite spin_until_cond()-wrapped poll of cpu_callin_map. __cpu_up() already does this when waiting for the cpu to set its online bit before returning, so this change is not really making the function more brittle. Removing the

Re: [PATCH v4 2/7] mm: page_isolation: move has_unmovable_pages() to mm/page_isolation.c

2022-01-24 Thread Oscar Salvador
On 2022-01-19 20:06, Zi Yan wrote: 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 -- Oscar Salvador SUSE Labs

Re: [PATCH 0/2] powerpc: Disable syscall emulation and stepping

2022-01-24 Thread Christophe Leroy
Le 25/01/2022 à 04:04, Nicholas Piggin a écrit : > +Naveen (sorry missed cc'ing you at first) > > Excerpts from Christophe Leroy's message of January 24, 2022 4:39 pm: >> >> >> Le 24/01/2022 à 06:57, Nicholas Piggin a écrit : >>> As discussed previously >>> >>>

Re: [PATCH 6/7] modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC

2022-01-24 Thread Christophe Leroy
Le 24/01/2022 à 22:43, Doug Anderson a écrit : > Hi, > > On Mon, Jan 24, 2022 at 1:22 AM Christophe Leroy > wrote: >> >> --- a/kernel/debug/kdb/kdb_main.c >> +++ b/kernel/debug/kdb/kdb_main.c >> @@ -2022,8 +2022,11 @@ static int kdb_lsmod(int argc, const char **argv) >> if

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Sachin Sant
> On 24-Jan-2022, at 10:15 PM, Steven Rostedt wrote: > > On Mon, 24 Jan 2022 20:15:06 +0800 > Yinan Liu wrote: > >> Hi, Steven and Sachin >> >> I don't have a powerpc machine for testing, I guess the ppc has a >> similar problem with the s390. It's not clear to me why the compiler >> does

Re: [PATCH 1/2] KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled

2022-01-24 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 25, 2022 8:49 am: > Nicholas Piggin writes: > >> PR KVM does not support running with AIL enabled, and SCV does is not >> supported with AIL disabled. >> >> Fix this by ensuring the SCV facility is disabled with FSCR while a >> CPU can be running

Re: [PATCH v2 4/4] KVM: PPC: Decrement module refcount if init_vm fails

2022-01-24 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 25, 2022 8:08 am: > We increment the reference count for KVM-HV/PR before the call to > kvmppc_core_init_vm. If that function fails we need to decrement the > refcount. > > Signed-off-by: Fabiano Rosas > --- > Caught this while testing Nick's LPID

Re: [PATCH v4 5/5] KVM: PPC: mmio: Deliver DSI after emulation failure

2022-01-24 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 22, 2022 8:26 am: > MMIO emulation can fail if the guest uses an instruction that we are > not prepared to emulate. Since these instructions can be and most > likely are valid ones, this is (slightly) closer to an access fault > than to an illegal

Re: [PATCH v4 4/5] KVM: PPC: mmio: Return to guest after emulation failure

2022-01-24 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 22, 2022 8:26 am: > If MMIO emulation fails we don't want to crash the whole guest by > returning to userspace. > > The original commit bbf45ba57eae ("KVM: ppc: PowerPC 440 KVM > implementation") added a todo: > > /* XXX Deliver Program

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Yinan Liu
Yeah, I think it's time to opt in, instead of opting out. Something like this: -- Steve diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c2724d986fa0..5256ebe57451 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -82,6 +82,7 @@ config ARM select HAVE_EBPF_JIT if

Re: [PATCH v4 3/5] KVM: PPC: mmio: Reject instructions that access more than mmio.data size

2022-01-24 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 22, 2022 8:26 am: > The MMIO interface between the kernel and userspace uses a structure > that supports a maximum of 8-bytes of data. Instructions that access > more than that need to be emulated in parts. > > We currently don't have generic

Re: [PATCH 0/2] powerpc: Disable syscall emulation and stepping

2022-01-24 Thread Nicholas Piggin
+Naveen (sorry missed cc'ing you at first) Excerpts from Christophe Leroy's message of January 24, 2022 4:39 pm: > > > Le 24/01/2022 à 06:57, Nicholas Piggin a écrit : >> As discussed previously >> >> https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-January/238946.html >> >> I'm wondering

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Randy Dunlap
On 1/24/22 17:23, Felix Kuehling wrote: > > Am 2022-01-24 um 14:11 schrieb Randy Dunlap: >> On 1/24/22 10:55, Geert Uytterhoeven wrote: >>> Hi Alex, >>> >>> On Mon, Jan 24, 2022 at 7:52 PM Alex Deucher wrote: On Mon, Jan 24, 2022 at 5:25 AM Geert Uytterhoeven wrote: > On Sun,

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Felix Kuehling
Am 2022-01-24 um 14:11 schrieb Randy Dunlap: On 1/24/22 10:55, Geert Uytterhoeven wrote: Hi Alex, On Mon, Jan 24, 2022 at 7:52 PM Alex Deucher wrote: On Mon, Jan 24, 2022 at 5:25 AM Geert Uytterhoeven wrote: On Sun, 23 Jan 2022, Geert Uytterhoeven wrote: +

Re: [PATCH 2/2] KVM: PPC: Book3S PR: Disallow AIL != 0

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > KVM PR does not implement address translation modes on interrupt, so it > must not allow H_SET_MODE to succeed. > > This is not compatible with QEMU behaviour. The solution might be to > have a cap-ail for this, but now it's broken either way so fix it in > KVM to start

Re: [PATCH 1/2] KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > PR KVM does not support running with AIL enabled, and SCV does is not > supported with AIL disabled. > > Fix this by ensuring the SCV facility is disabled with FSCR while a > CPU can be running with AIL=0. PowerNV host supports disabling AIL on a > per-CPU basis, so SCV

[PATCH v2 0/4] KVM: PPC: KVM module exit fixes

2022-01-24 Thread Fabiano Rosas
I stumbled upon another issue with our module exit so I'm sending another version to add a fix for it. - patches 1 and 3 are already reviewed; - patch 2 lacks a Reviewed-by. Nick asked about an issue Alexey might have encountered. I haven't heard of any issues with the module exit aside from

Re: [PATCH 6/6] KVM: PPC: Book3S HV: Remove KVMPPC_NR_LPIDS

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > KVMPPC_NR_LPIDS no longer represents any size restriction on the > LPID space and can be removed. A CPU with more than 12 LPID bits > implemented will now be able to create more than 4095 guests. > > Signed-off-by: Nicholas Piggin Reviewed-by: Fabiano Rosas > --- >

Re: [PATCH 5/6] KVM: PPC: Book3S Nested: Use explicit 4096 LPID maximum

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > Rather than tie this to KVMPPC_NR_LPIDS which is becoming more dynamic, > fix it to 4096 (12-bits) explicitly for now. > > kvmhv_get_nested() does not have to check against KVM_MAX_NESTED_GUESTS > because the L1 partition table registration hcall already did that, and >

Re: [PATCH 4/6] KVM: PPC: Book3S HV Nested: Change nested guest lookup to use idr

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > This removes the fixed sized kvm->arch.nested_guests array. > > Signed-off-by: Nicholas Piggin > --- Reviewed-by: Fabiano Rosas > arch/powerpc/include/asm/kvm_host.h | 3 +- > arch/powerpc/kvm/book3s_hv_nested.c | 110 +++- > 2 files

Re: [PATCH 3/6] KVM: PPC: Book3S HV: Use IDA allocator for LPID allocator

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > This removes the fixed-size lpid_inuse array. > > Signed-off-by: Nicholas Piggin > --- Reviewed-by: Fabiano Rosas > arch/powerpc/kvm/powerpc.c | 25 + > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git

Re: [PATCH 2/6] KVM: PPC: Book3S HV: Update LPID allocator init for POWER9, Nested

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > The LPID allocator init is changed to: > - use mmu_lpid_bits rather than hard-coding; > - use KVM_MAX_NESTED_GUESTS for nested hypervisors; > - not reserve the top LPID on POWER9 and newer CPUs. > > The reserved LPID is made a POWER7/8-specific detail. > >

[PATCH v2 4/4] KVM: PPC: Decrement module refcount if init_vm fails

2022-01-24 Thread Fabiano Rosas
We increment the reference count for KVM-HV/PR before the call to kvmppc_core_init_vm. If that function fails we need to decrement the refcount. Signed-off-by: Fabiano Rosas --- Caught this while testing Nick's LPID patches by looking at /sys/module/kvm_hv/refcnt --- arch/powerpc/kvm/powerpc.c

[PATCH v2 3/4] KVM: PPC: Book3S HV: Free allocated memory if module init fails

2022-01-24 Thread Fabiano Rosas
The module's exit function is not called when the init fails, we need to do cleanup before returning. Signed-off-by: Fabiano Rosas Reviewed-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git

[PATCH v2 2/4] KVM: PPC: Book3S HV: Delay setting of kvm ops

2022-01-24 Thread Fabiano Rosas
Delay the setting of kvm_hv_ops until after all init code has completed. This avoids leaving the ops still accessible if the init fails. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s_hv.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git

[PATCH v2 1/4] KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init

2022-01-24 Thread Fabiano Rosas
The return of the function is being shadowed by the call to kvmppc_uvmem_init. Fixes: ca9f4942670c ("KVM: PPC: Book3S HV: Support for running secure guests") Signed-off-by: Fabiano Rosas Reviewed-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 5 - 1 file changed, 4 insertions(+), 1

Re: [PATCH 6/7] modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC

2022-01-24 Thread Doug Anderson
Hi, On Mon, Jan 24, 2022 at 1:22 AM Christophe Leroy wrote: > > --- a/kernel/debug/kdb/kdb_main.c > +++ b/kernel/debug/kdb/kdb_main.c > @@ -2022,8 +2022,11 @@ static int kdb_lsmod(int argc, const char **argv) > if (mod->state == MODULE_STATE_UNFORMED) >

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Yinan Liu
在 2022/1/24 下午5:19, Sachin Sant 写道: While running stress_code_patching test from selftests/powerpc/mm against 5.17-rc1 booted on a POWER10 LPAR following ftrace warning is seen: WARNING: CPU: 1 PID: 2017392 at kernel/trace/ftrace.c:2068 ftrace_bug+0x274/0x2d8 Modules linked in: dm_mod bonding

[PATCH v4] powerpc/papr_scm: Implement initial support for injecting smart errors

2022-01-24 Thread Vaibhav Jain
Presently PAPR doesn't support injecting smart errors on an NVDIMM. This makes testing the NVDIMM health reporting functionality difficult as simulating NVDIMM health related events need a hacked up qemu version. To solve this problem this patch proposes simulating certain set of NVDIMM health

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Randy Dunlap
On 1/24/22 10:55, Geert Uytterhoeven wrote: > Hi Alex, > > On Mon, Jan 24, 2022 at 7:52 PM Alex Deucher wrote: >> On Mon, Jan 24, 2022 at 5:25 AM Geert Uytterhoeven >> wrote: >>> On Sun, 23 Jan 2022, Geert Uytterhoeven wrote: +

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Geert Uytterhoeven
Hi Alex, On Mon, Jan 24, 2022 at 7:52 PM Alex Deucher wrote: > On Mon, Jan 24, 2022 at 5:25 AM Geert Uytterhoeven > wrote: > > On Sun, 23 Jan 2022, Geert Uytterhoeven wrote: > > > + /kisskb/src/drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c: > > > error: control reaches end of non-void

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Alex Deucher
On Mon, Jan 24, 2022 at 5:25 AM Geert Uytterhoeven wrote: > > On Sun, 23 Jan 2022, Geert Uytterhoeven wrote: > > Below is the list of build error/warning regressions/improvements in > > v5.17-rc1[1] compared to v5.16[2]. > > > > Summarized: > > - build errors: +17/-2 > > - build warnings:

Re: [PATCH] KVM: PPC: Book3S HV P9: Optimise loads around context switch

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > It is better to get all loads for the register values in flight > before starting to switch LPID, PID, and LPCR because those > mtSPRs are expensive and serialising. > > This also just tidies up the code for a potential future change > to the context switching sequence.

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Jakub Kicinski
On Mon, 24 Jan 2022 09:04:33 -0800 Jakub Kicinski wrote: > On Mon, 24 Jan 2022 08:55:40 +0100 (CET) Geert Uytterhoeven wrote: > > > + /kisskb/src/drivers/net/ethernet/freescale/fec_mpc52xx.c: error: > > > passing argument 2 of 'mpc52xx_fec_set_paddr' discards 'const' qualifier > > > from

Re: [PATCH] KVM: PPC: Book3S HV: HFSCR[PREFIX] does not exist

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > This facility is controlled by FSCR only. Reserved bits should not be > set in the HFSCR register (although it's likely harmless as this > position would not be re-used, and the L0 is forgiving here too). > > Signed-off-by: Nicholas Piggin Reviewed-by: Fabiano Rosas

Re: [PATCH] KVM: PPC: Book3S HV Nested: Fix nested HFSCR being clobbered with multiple vCPUs

2022-01-24 Thread Fabiano Rosas
Nicholas Piggin writes: > The L0 is storing HFSCR requested by the L1 for the L2 in struct > kvm_nested_guest when the L1 requests a vCPU enter L2. kvm_nested_guest > is not a per-vCPU structure. Hilarity ensues. > > Fix it by moving the nested hfscr into the vCPU structure together with > the

Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages

2022-01-24 Thread Zi Yan
On 24 Jan 2022, at 4:55, Oscar Salvador wrote: > On 2022-01-19 20:06, Zi Yan wrote: >> 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,

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Jakub Kicinski
On Mon, 24 Jan 2022 08:55:40 +0100 (CET) Geert Uytterhoeven wrote: > > + /kisskb/src/drivers/net/ethernet/freescale/fec_mpc52xx.c: error: passing > > argument 2 of 'mpc52xx_fec_set_paddr' discards 'const' qualifier from > > pointer target type [-Werror=discarded-qualifiers]: => 659:29 > >

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Mel Gorman
On Mon, Jan 24, 2022 at 11:12:07AM -0500, Zi Yan wrote: > On 24 Jan 2022, at 9:02, Mel Gorman wrote: > > > On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: > >> From: Zi Yan > >> > >> This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. > >> It prepares for the upcoming

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Steven Rostedt
On Mon, 24 Jan 2022 20:15:06 +0800 Yinan Liu wrote: > Hi, Steven and Sachin > > I don't have a powerpc machine for testing, I guess the ppc has a > similar problem with the s390. It's not clear to me why the compiler > does this. Maybe we can handle ppc like you did with the s390 before, >

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Zi Yan
On 24 Jan 2022, at 9:02, Mel Gorman wrote: > On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: >> From: Zi Yan >> >> This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. >> It prepares for the upcoming removal of the MAX_ORDER-1 alignment >> requirement for CMA and

[PATCH 3/3] powerpc/time: improve decrementer clockevent processing

2022-01-24 Thread Nicholas Piggin
The stop/shutdown op should not use decrementer_set_next_event because that sets decrementers_next_tb to now + decrementer_max, which means a decrementer interrupt that occurs after that time will call the clockevent event handler unexpectedly. Set next_tb to ~0 here to prevent any clock event

[PATCH 2/3] powerpc/time: Fix KVM host re-arming a timer beyond decrementer range

2022-01-24 Thread Nicholas Piggin
If the next host timer is beyond decrementer range, timer_rearm_host_dec will leave decrementer not programmed. This will not cause a problem for the host it will just set the decrementer correctly when the decrementer interrupt hits, it seems safer not to leave the next host decrementer interrupt

[PATCH 1/3] powerpc/64s/interrupt: Fix decrementer storm

2022-01-24 Thread Nicholas Piggin
The decrementer exception can fail to be cleared when the interrupt returns in the case where the decrementer wraps with the next timer still beyond decrementer_max. This results in a decrementer interrupt storm. This is triggerable with small decrementer system with hard and soft watchdogs

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Mel Gorman
On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: > From: Zi Yan > > This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. > It prepares for the upcoming removal of the MAX_ORDER-1 alignment > requirement for CMA and alloc_contig_range(). > > MIGRARTE_HIGHATOMIC should

Re: [PATCH kernel v5] KVM: PPC: Merge powerpc's debugfs entry content into generic entry

2022-01-24 Thread Cédric Le Goater
On 1/11/22 01:54, Alexey Kardashevskiy wrote: At the moment KVM on PPC creates 4 types of entries under the kvm debugfs: 1) "%pid-%fd" per a KVM instance (for all platforms); 2) "vm%pid" (for PPC Book3s HV KVM); 3) "vm%u_vcpu%u_timing" (for PPC Book3e KVM); 4) "kvm-xive-%p" (for XIVE PPC Book3s

[PATCH] powerpc/64: Move paca allocation later in boot

2022-01-24 Thread Michael Ellerman
Mahesh & Sourabh identified two problems[1][2] with ppc64_bolted_size() and paca allocation. The first is that on a Radix capable machine but with "disable_radix" on the command line, there is a window during early boot where early_radix_enabled() is true, even though it will later become false.

[RFC V1 04/31] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT

2022-01-24 Thread Anshuman Khandual
This defines and exports a platform specific custom vm_get_page_prot() via subscribing ARCH_HAS_VM_GET_PAGE_PROT. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. While here, this also localizes arch_vm_get_page_prot() as powerpc_vm_get_page_prot(). Cc: Michael

Re: [PATCH 1/7] modules: Refactor within_module_core() and within_module_init()

2022-01-24 Thread Christophe Leroy
Le 24/01/2022 à 13:32, Christoph Hellwig a écrit : > On Mon, Jan 24, 2022 at 09:22:15AM +, Christophe Leroy wrote: >> +static inline bool within_range(unsigned long addr, void *base, unsigned >> int size) > > Please avoid the overly long line. > > .. But given that this function only has

Re: [PATCH 1/7] modules: Refactor within_module_core() and within_module_init()

2022-01-24 Thread Christoph Hellwig
On Mon, Jan 24, 2022 at 09:22:15AM +, Christophe Leroy wrote: > +static inline bool within_range(unsigned long addr, void *base, unsigned int > size) Please avoid the overly long line. .. But given that this function only has a single caller I see no point in factoring it out anyway.

Re: [PATCH 7/7] powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx

2022-01-24 Thread kernel test robot
Hi Christophe, I love your patch! Perhaps something to improve: [auto build test WARNING on mcgrof/modules-next] [also build test WARNING on powerpc/next linus/master jeyu/modules-next v5.17-rc1 next-20220124] [If your patch is applied to the wrong git tree, kindly drop us a note. And when

[PATCH 2/2] KVM: PPC: Book3S PR: Disallow AIL != 0

2022-01-24 Thread Nicholas Piggin
KVM PR does not implement address translation modes on interrupt, so it must not allow H_SET_MODE to succeed. This is not compatible with QEMU behaviour. The solution might be to have a cap-ail for this, but now it's broken either way so fix it in KVM to start with. This allows PR Linux guests

[PATCH 1/2] KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled

2022-01-24 Thread Nicholas Piggin
PR KVM does not support running with AIL enabled, and SCV does is not supported with AIL disabled. Fix this by ensuring the SCV facility is disabled with FSCR while a CPU can be running with AIL=0. PowerNV host supports disabling AIL on a per-CPU basis, so SCV just needs to be disabled when a

[PATCH 0/2] KVM: PPC: Book3S PR: SCV fixes

2022-01-24 Thread Nicholas Piggin
These patches seem to be the quickest and easiest way to avoid the host crash and to get recent Linux images (that use scv) to run under PR. These are independent of the syscall emulation series. Those just came about when looking at ways to fix the host problem and seeing emulation was broken.

Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages

2022-01-24 Thread Oscar Salvador
On 2022-01-19 20:06, Zi Yan wrote: 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

[PATCH 7/7] powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx

2022-01-24 Thread Christophe Leroy
book3s/32 and 8xx have a separate area for allocating modules, defined by MODULES_VADDR / MODULES_END. On book3s/32, it is not possible to protect against execution on a page basis. A full 256M segment is either Exec or NoExec. The module area is in an Exec segment while vmalloc area is in a

[PATCH 6/7] modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC

2022-01-24 Thread Christophe Leroy
Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC to allow architectures to request having modules data in vmalloc area instead of module area. This is required on powerpc book3s/32 in order to set data non executable, because it is not possible to set executability on page basis, this is done per

[PATCH 5/7] modules: Introduce data_layout

2022-01-24 Thread Christophe Leroy
In order to allow separation of data from text, add another layout, called data_layout. For architectures requesting separation of text and data, only text will go in core_layout and data will go in data_layout. For architectures which keep text and data together, make data_layout an alias of

[PATCH 4/7] modules: Prepare for handling several RB trees

2022-01-24 Thread Christophe Leroy
In order to separate text and data, we need to setup two rb trees. So modify functions to give the tree as a parameter. Signed-off-by: Christophe Leroy --- kernel/module.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git

[PATCH 3/7] modules: Always have struct mod_tree_root

2022-01-24 Thread Christophe Leroy
In order to separate text and data, we need to setup two rb trees. This also means that struct mod_tree_root is required even without MODULES_TREE_LOOKUP. Also remove module_addr_min and module_addr_max as there will be one min and one max for each tree. Signed-off-by: Christophe Leroy ---

[PATCH 2/7] modules: Add within_module_text() macro

2022-01-24 Thread Christophe Leroy
Add a macro to check whether an address is within module's text. Signed-off-by: Christophe Leroy --- include/linux/module.h | 13 + kernel/module.c| 17 + 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/linux/module.h

[PATCH 0/7] Allocate module text and data separately

2022-01-24 Thread Christophe Leroy
This series allow architectures to request having modules data in vmalloc area instead of module area. This is required on powerpc book3s/32 in order to set data non executable, because it is not possible to set executability on page basis, this is done per 256 Mbytes segments. The module area

[PATCH 1/7] modules: Refactor within_module_core() and within_module_init()

2022-01-24 Thread Christophe Leroy
within_module_core() and within_module_init() are doing the exact same test, one on core_layout, the second on init_layout. In preparation of increasing the complexity of that verification, refactor it into a single function called within_module_layout(). Signed-off-by: Christophe Leroy ---

Re: Build regressions/improvements in v5.17-rc1

2022-01-24 Thread Geert Uytterhoeven
On Sun, 23 Jan 2022, Geert Uytterhoeven wrote: Below is the list of build error/warning regressions/improvements in v5.17-rc1[1] compared to v5.16[2]. Summarized: - build errors: +17/-2 - build warnings: +23/-25 Note that there may be false regressions, as some logs are incomplete. Still,