Re: [PATCHv8 3/5] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus
On 11/10/23 8:35 am, Pingfan Liu wrote: On Tue, Oct 10, 2023 at 01:56:13PM +0530, Hari Bathini wrote: On 09/10/23 5:00 pm, Pingfan Liu wrote: If the boot_cpuid is smaller than nr_cpus, it requires extra effort to ensure the boot_cpu is in cpu_present_mask. This can be achieved by reserving the last quota for the boot cpu. Note: the restriction on nr_cpus will be lifted with more effort in the successive patches Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linuxppc-...@lists.ozlabs.org --- arch/powerpc/kernel/setup-common.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 81291e13dec0..f9ef0a2666b0 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -454,8 +454,8 @@ struct interrupt_server_node { void __init smp_setup_cpu_maps(void) { struct device_node *dn; - int shift = 0, cpu = 0; - int j, nthreads = 1; + int terminate, shift = 0, cpu = 0; + int j, bt_thread = 0, nthreads = 1; int len; struct interrupt_server_node *intserv_node, *n; struct list_head *bt_node, head; @@ -518,6 +518,7 @@ void __init smp_setup_cpu_maps(void) for (j = 0 ; j < nthreads; j++) { if (be32_to_cpu(intserv[j]) == boot_cpu_hwid) { bt_node = _node->node; + bt_thread = j; found_boot_cpu = true; /* * Record the round-shift between dt @@ -537,11 +538,21 @@ void __init smp_setup_cpu_maps(void) /* Select the primary thread, the boot cpu's slibing, as the logic 0 */ list_add_tail(, bt_node); pr_info("the round shift between dt seq and the cpu logic number: %d\n", shift); + terminate = nr_cpu_ids; list_for_each_entry(intserv_node, , node) { + j = 0; + /* Choose a start point to cover the boot cpu */ + if (nr_cpu_ids - 1 < bt_thread) { + /* +* The processor core puts assumption on the thread id, +* not to breach the assumption. +*/ + terminate = nr_cpu_ids - 1; nthreads is anyway assumed to be same for all cores. So, enforcing nr_cpu_ids to a minimum of nthreads (and multiple of nthreads) should make the code much simpler without the need for above check and the other complexities addressed in the subsequent patches... Indeed, this series can be splited into two partsk, [1-2/5] and [3-5/5]. In [1-2/5], if smaller, the nr_cpu_ids is enforced to be equal to nthreads. I will make it align upward on nthreads in the next version. So [1-2/5] can be totally independent from the rest patches in this series. Yup. Would prefer it that way. From an engineer's perspective, [3-5/5] are added to maintain the nr_cpus semantics. (Finally, nr_cpus=1 can be achieved but requiring effort on other subsystem) I understand it would be nice to maintain semantics but not worth the complexity it brings, IMHO. So, my suggest would be to drop [3-5/5]. Thanks Hari ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH] kexec: Fix reboot race during device_shutdown()
On Tue, Oct 10, 2023 at 5:08 PM Eric W. Biederman wrote: > > Joel Fernandes writes: [...] > >> That way you can get the orderly shutdown > >> of userspace daemons/services along with an orderly shutdown of > >> everything the kernel is responsible for. > > > > Fixing in userspace is an option but people are not happy that the > > kernel can crash like that. > > In a kexec on panic scenario the kernel needs to perform that absolute > bare essential shutdown before calling kexec (basically nothing). > During kexec-on-panic nothing can be relied upon because we don't know > what is broken. If that is what you care about (as suggested by the > unit test) you need to fix the device initialization. > > In a normal kexec scenario the whole normal reboot process is expected. > I have no problems with fixing the kernel to handle that scenario, > but in the real world the entire orderly shutdown both, kernel > and userspace should be performed. Sounds good. Since you mentioned you have no problem with fixing regular reboot in the kernel, we will work on reproducing the issue with regular reboot as well and fix that. I think a syscall causing the kernel to crash instead of operate normally is a cause of concern, so let us fix the kernel as well (other than improving the test case as you mentioned). > >> At the kernel level a kexec reboot and a normal reboot have been > >> deliberately kept as close as possible. Which is why I say we should > >> fix it in reboot. > > > > You mean fix it in userspace? > > No. I mean in the kernel the orderly shutdown for a kexec reboot and an > ordinary reboot are kept as close to the same as possible. > > It should be the case that the only differences between the two is that > in once case system firmware takes over after the orderly shutdown, > and in the other case a new kernel takes over after the orderly shutdown. Agreed. thanks, - Joel ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 09/13] x86/tdx: Account shared memory
On Tue, Oct 10, 2023 at 10:05:21AM +, Huang, Kai wrote: > > > +#ifdef CONFIG_DEBUG_FS > > +static int tdx_shared_memory_show(struct seq_file *m, void *p) > > +{ > > + unsigned long addr, end; > > + unsigned long found = 0; > > + > > + addr = PAGE_OFFSET; > > + end = PAGE_OFFSET + get_max_mapped(); > > + > > + while (addr < end) { > > + unsigned long size; > > + unsigned int level; > > + pte_t *pte; > > + > > + pte = lookup_address(addr, ); > > + size = page_level_size(level); > > + > > + if (pte && pte_decrypted(*pte)) > > + found += size / PAGE_SIZE; > > + > > + addr += size; > > This could be a long loop, perhaps add cond_resched() here? Sure. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled
On Tue, Oct 10, 2023 at 06:53:27AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/5/2023 6:13 AM, Kirill A. Shutemov wrote: > > kvm_guest_cpu_offline() tries to disable kvmclock regardless if it is > > present in the VM. It leads to write to a MSR that doesn't exist on some > > configurations, namely in TDX guest: > > > > unchecked MSR access error: WRMSR to 0x12 (tried to write > > 0x) > > at rIP: 0x8110687c (kvmclock_disable+0x1c/0x30) > > > > kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt > > features. > > > > Do not disable kvmclock if it was not enumerated or disabled by user > > from kernel command line. > > For the above warning, check for CLOCKSOURCE and CLOCKSOURCE2 > feature is sufficient, right? Do we need to include user/command-line > disable check here? The command line disables kvmclock, even if it is enumerated, so disabling it is not needed. Anyway, I reworked the patch already based on Sean's feedback. No need in taking parameter into account directly now. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 03/13] cpu/hotplug, x86/acpi: Disable CPU hotplug for ACPI MADT wakeup
On Thu, Oct 05 2023 at 16:13, Kirill A. Shutemov wrote: > > + /* Disable CPU onlining/offlining */ That's not what the function does. > + cpu_hotplug_not_supported(); Thanks, tglx ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 02/13] kernel/cpu: Add support for declaring CPU hotplug not supported
On Tue, Oct 10, 2023 at 06:35:59AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/5/2023 6:13 AM, Kirill A. Shutemov wrote: > > The function cpu_hotplug_not_supported() can be called to indicate that > > CPU hotplug should be disabled. It does not prevent the initial bring up > > of the CPU, but it stops subsequent offlining. > > > > This function is intended to replace CC_ATTR_HOTPLUG_DISABLED. > > > > Looks good to me. > > Reviewed-by: Kuppuswamy Sathyanarayanan > Thanks. > > @@ -543,6 +546,18 @@ static void lockdep_release_cpus_lock(void) > > rwsem_release(_hotplug_lock.dep_map, _THIS_IP_); > > } > > > > +/* > > + * Declare CPU hotplug not supported. > > + * > > + * It doesn't prevent initial bring up of the CPU, but stops offlining. > > + */ > > +void cpu_hotplug_not_supported(void) > > +{ > > + cpu_maps_update_begin(); > > + cpu_hotplug_supported = false; > > + cpu_maps_update_done(); > > +} > > Since this function is not used in this patch, do you need to add > __maybe_unused to > avoid warnings? Hm? I don't think compiler complains about non-static unused functions. It has no visibility if it is used. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 02/13] kernel/cpu: Add support for declaring CPU hotplug not supported
On Thu, Oct 05 2023 at 16:13, Kirill A. Shutemov wrote: > The function cpu_hotplug_not_supported() can be called to indicate that > CPU hotplug should be disabled. It does not prevent the initial bring up > of the CPU, but it stops subsequent offlining. This tells me what the patch is doing, but not the why. > This function is intended to replace CC_ATTR_HOTPLUG_DISABLED. > --- a/include/linux/cpu.h > +++ b/include/linux/cpu.h > @@ -132,6 +132,7 @@ extern void cpus_read_lock(void); > extern void cpus_read_unlock(void); > extern int cpus_read_trylock(void); > extern void lockdep_assert_cpus_held(void); > +extern void cpu_hotplug_not_supported(void); This function name sucks. The point is as you explained to prevent offlining, but not onlining. So can we please make this very clear? Something like: cpu_hotplug_disable_offlining() > +/* Cleared if platform declares CPU hotplug not supported */ > +static bool cpu_hotplug_supported = true; Again. This is not about disabling hotplug all together. Something like: static bool cpu_hotplug_offline_disabled; Which expresses clearly what this is about and does not require this awkward negation. Thanks, tglx ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32
Hello Pingfan, With this patch series applied, the kdump kernel fails to boot on powerpc with nr_cpus=1. Console logs: --- [root]# echo c > /proc/sysrq-trigger [ 74.783235] sysrq: Trigger a crash [ 74.783244] Kernel panic - not syncing: sysrq triggered crash [ 74.783252] CPU: 58 PID: 3838 Comm: bash Kdump: loaded Not tainted 6.6.0-rc5pf-nr-cpus+ #3 [ 74.783259] Hardware name: POWER10 (raw) phyp pSeries [ 74.783275] Call Trace: [ 74.783280] [c0020f4ebac0] [c0ed9f38] dump_stack_lvl+0x6c/0x9c (unreliable) [ 74.783291] [c0020f4ebaf0] [c0150300] panic+0x178/0x438 [ 74.783298] [c0020f4ebb90] [c0936d48] sysrq_handle_crash+0x28/0x30 [ 74.783304] [c0020f4ebbf0] [c093773c] __handle_sysrq+0x10c/0x250 [ 74.783309] [c0020f4ebc90] [c0937fa8] write_sysrq_trigger+0xc8/0x168 [ 74.783314] [c0020f4ebcd0] [c0665d8c] proc_reg_write+0x10c/0x1b0 [ 74.783321] [c0020f4ebd00] [c058da54] vfs_write+0x104/0x4b0 [ 74.783326] [c0020f4ebdc0] [c058dfdc] ksys_write+0x7c/0x140 [ 74.783331] [c0020f4ebe10] [c0033a64] system_call_exception+0x144/0x3a0 [ 74.783337] [c0020f4ebe50] [c000c554] system_call_common+0xf4/0x258 [ 74.783343] --- interrupt: c00 at 0x7fffa0721594 [ 74.783352] NIP: 7fffa0721594 LR: 7fffa0697bf4 CTR: [ 74.783364] REGS: c0020f4ebe80 TRAP: 0c00 Not tainted (6.6.0-rc5pf-nr-cpus+) [ 74.783376] MSR: 8280f033 CR: 2802 XER: [ 74.783394] IRQMASK: 0 [ 74.783394] GPR00: 0004 7c4b6800 7fffa0807300 0001 [ 74.783394] GPR04: 00013549ea60 0002 0010 [ 74.783394] GPR08: [ 74.783394] GPR12: 7fffa0abaf70 4000 00011a0f9798 [ 74.783394] GPR16: 00011a0f9724 00011a097688 00011a02ff70 00011a0fd568 [ 74.783394] GPR20: 000135554bf0 0001 00011a0aa478 7c4b6a24 [ 74.783394] GPR24: 7c4b6a20 00011a0faf94 0002 00013549ea60 [ 74.783394] GPR28: 0002 7fffa08017a0 00013549ea60 0002 [ 74.783440] NIP [7fffa0721594] 0x7fffa0721594 [ 74.783443] LR [7fffa0697bf4] 0x7fffa0697bf4 [ 74.783447] --- interrupt: c00 I'm in purgatory [ 0.00] radix-mmu: Page sizes from device-tree: [ 0.00] radix-mmu: Page size shift = 12 AP=0x0 [ 0.00] radix-mmu: Page size shift = 16 AP=0x5 [ 0.00] radix-mmu: Page size shift = 21 AP=0x1 [ 0.00] radix-mmu: Page size shift = 30 AP=0x2 [ 0.00] Activating Kernel Userspace Access Prevention [ 0.00] Activating Kernel Userspace Execution Prevention [ 0.00] radix-mmu: Mapped 0x-0x0001 with 64.0 KiB pages (exec) [ 0.00] radix-mmu: Mapped 0x0001-0x0020 with 64.0 KiB pages [ 0.00] radix-mmu: Mapped 0x0020-0x2000 with 2.00 MiB pages [ 0.00] radix-mmu: Mapped 0x2000-0x2260 with 2.00 MiB pages (exec) [ 0.00] radix-mmu: Mapped 0x2260-0x4000 with 2.00 MiB pages [ 0.00] radix-mmu: Mapped 0x4000-0x00018000 with 1.00 GiB pages [ 0.00] radix-mmu: Mapped 0x00018000-0x0001a000 with 2.00 MiB pages [ 0.00] lpar: Using radix MMU under hypervisor [ 0.00] Linux version 6.6.0-rc5pf-nr-cpus+ (r...@ltcever7x0-lp1.aus.stglabs.ibm.com) (gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), GNU ld version 2.30-123.el8) #3 SMP Mon Oct 9 11:07: 41 CDT 2023 [ 0.00] Found initrd at 0xc00022e6:0xc000248f08d8 [ 0.00] Hardware name: IBM,9043-MRX POWER10 (raw) 0x800200 0xf06 of:IBM,FW1060.00 (NM1060_016) hv:phyp pSeries [ 0.00] printk: bootconsole [udbg0] enabled [ 0.00] the round shift between dt seq and the cpu logic number: 56 [ 0.00] BUG: Unable to handle kernel data access on write at 0xc001a000 [ 0.00] Faulting instruction address: 0xc00022009c64 [ 0.00] Oops: Kernel access of bad area, sig: 11 [#1] [ 0.00] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries [ 0.00] Modules linked in: [ 0.00] CPU: 2 PID: 0 Comm: swapper Not tainted 6.6.0-rc5pf-nr-cpus+ #3 [ 0.00] Hardware name: POWER10 (raw) hv:phyp pSeries [ 0.00] NIP: c00022009c64 LR: c00022009c54 CTR: c000201ff348 [ 0.00] REGS: c00022aebb00 TRAP: 0300 Not tainted (6.6.0-rc5pf-nr-cpus+) [ 0.00] MSR: 80001033 CR: 28222824 XER: 0001 [ 0.00] CFAR: c00020031574 DAR: c001a000 DSISR: 4200 IRQMASK: 1 [ 0.00] GPR00: c00022009ba0 c00022aebda0 c000213d1300 0004 [ 0.00] GPR04: 0001
[PATCH kexec-tools] workflow: update to Ubuntu 22.04
Bump workflow to use latest LTS release. Signed-off-by: Simon Horman --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c6e9d730488..d0007f14b274 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: push jobs: build: name: Build -runs-on: ubuntu-20.04 +runs-on: ubuntu-22.04 strategy: matrix: arch: -- 2.30.2 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH] kexec/loongarch64: fix 'make dist' file loss issue
On Wed, Oct 11, 2023 at 11:56:21AM +0800, Ming Wang wrote: > The Makefile omits the iomem.h file, causing the archive file > generated by 'make dist' to lose iomem.h. This patch is used to > fix this problem. > > Signed-off-by: Ming Wang Thanks, applied. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH 2/2] riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS
With CONFIG_RELOCATABLE enabled, KBUILD_CFLAGS had a -fPIE option and then the purgatory/string.o was built to reference _ctype symbol via R_RISCV_GOT_HI20 relocations which can't be handled by purgatory. As a consequence, the kernel failed kexec_load_file() with: [ 880.386562] kexec_image: The entry point of kernel at 0x8020 [ 880.388650] kexec_image: Unknown rela relocation: 20 [ 880.389173] kexec_image: Error loading purgatory ret=-8 So remove the -fPIE option for PURGATORY_CFLAGS to generate R_RISCV_PCREL_HI20 relocations type making puragtory work as it was. Fixes: 39b33072941f ("riscv: Introduce CONFIG_RELOCATABLE") Signed-off-by: Song Shuai --- arch/riscv/purgatory/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index 9e6476719abb..982fc8e77108 100644 --- a/arch/riscv/purgatory/Makefile +++ b/arch/riscv/purgatory/Makefile @@ -81,6 +81,10 @@ ifdef CONFIG_CFI_CLANG PURGATORY_CFLAGS_REMOVE+= $(CC_FLAGS_CFI) endif +ifdef CONFIG_RELOCATABLE +PURGATORY_CFLAGS_REMOVE+= -fPIE +endif + CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) -- 2.20.1 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH 1/2] riscv: kexec: Cleanup riscv_kexec_relocate
For readability and simplicity, cleanup the riscv_kexec_relocate code: - Re-sort the first 4 `mv` instructions against `riscv_kexec_method()` - Eliminate registers for debugging (s9,s10,s11) and storing const-value (s5,s6) - Replace `jalr` with `jr` for no-link jump I tested this on Qemu virt machine and works as it was. Signed-off-by: Song Shuai --- arch/riscv/kernel/kexec_relocate.S | 54 +- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/arch/riscv/kernel/kexec_relocate.S b/arch/riscv/kernel/kexec_relocate.S index 059c5e216ae7..ece5591abc4e 100644 --- a/arch/riscv/kernel/kexec_relocate.S +++ b/arch/riscv/kernel/kexec_relocate.S @@ -17,27 +17,17 @@ SYM_CODE_START(riscv_kexec_relocate) * s1: (const) Phys address to jump to after relocation * s2: (const) Phys address of the FDT image * s3: (const) The hartid of the current hart -* s4: Pointer to the destination address for the relocation -* s5: (const) Number of words per page -* s6: (const) 1, used for subtraction -* s7: (const) kernel_map.va_pa_offset, used when switching MMU off -* s8: (const) Physical address of the main loop -* s9: (debug) indirection page counter -* s10: (debug) entry counter -* s11: (debug) copied words counter +* s4: (const) kernel_map.va_pa_offset, used when switching MMU off +* s5: Pointer to the destination address for the relocation +* s6: (const) Physical address of the main loop */ mv s0, a0 mv s1, a1 mv s2, a2 mv s3, a3 - mv s4, zero - li s5, (PAGE_SIZE / RISCV_SZPTR) - li s6, 1 - mv s7, a4 - mv s8, zero - mv s9, zero - mv s10, zero - mv s11, zero + mv s4, a4 + mv s5, zero + mv s6, zero /* Disable / cleanup interrupts */ csrwCSR_SIE, zero @@ -52,21 +42,27 @@ SYM_CODE_START(riscv_kexec_relocate) * the start of the loop below so that we jump there in * any case. */ - la s8, 1f - sub s8, s8, s7 - csrwCSR_STVEC, s8 + la s6, 1f + sub s6, s6, s4 + csrwCSR_STVEC, s6 + + /* +* With C-extension, here we get 42 Bytes and the next +* .balign directive would pad zeros here up to 44 Bytes. +* So manually put a nop here to avoid zeros padding. + */ + nop /* Process entries in a loop */ -.align 2 +.balign 4 1: - addis10, s10, 1 REG_L t0, 0(s0) /* t0 = *image->entry */ addis0, s0, RISCV_SZPTR /* image->entry++ */ /* IND_DESTINATION entry ? -> save destination address */ andit1, t0, 0x1 beqzt1, 2f - andis4, t0, ~0x1 + andis5, t0, ~0x1 j 1b 2: @@ -74,9 +70,8 @@ SYM_CODE_START(riscv_kexec_relocate) andit1, t0, 0x2 beqzt1, 2f andis0, t0, ~0x2 - addis9, s9, 1 csrwCSR_SATP, zero - jalrzero, s8, 0 + jr s6 2: /* IND_DONE entry ? -> jump to done label */ @@ -92,14 +87,13 @@ SYM_CODE_START(riscv_kexec_relocate) andit1, t0, 0x8 beqzt1, 1b /* Unknown entry type, ignore it */ andit0, t0, ~0x8 - mv t3, s5 /* i = num words per page */ + li t3, (PAGE_SIZE / RISCV_SZPTR) /* i = num words per page */ 3: /* copy loop */ REG_L t1, (t0)/* t1 = *src_ptr */ - REG_S t1, (s4)/* *dst_ptr = *src_ptr */ + REG_S t1, (s5)/* *dst_ptr = *src_ptr */ addit0, t0, RISCV_SZPTR /* stc_ptr++ */ - addis4, s4, RISCV_SZPTR /* dst_ptr++ */ - sub t3, t3, s6 /* i-- */ - addis11, s11, 1 /* c++ */ + addis5, s5, RISCV_SZPTR /* dst_ptr++ */ + addit3, t3, -0x1/* i-- */ beqzt3, 1b /* copy done ? */ j 3b @@ -146,7 +140,7 @@ SYM_CODE_START(riscv_kexec_relocate) */ fence.i - jalrzero, a2, 0 + jr a2 SYM_CODE_END(riscv_kexec_relocate) riscv_kexec_relocate_end: -- 2.20.1 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH V2 0/2] riscv: kexec: cleanup and fixups
Changes since V1: https://lore.kernel.org/linux-riscv/20230907103304.590739-1-songshuaish...@tinylab.org/ - the old Patch2 in V1 had been merged to riscv/fixes, so take it out of this series - Patch1 : replace `.align 2` with `.balign 4` as Andreas suggested - Patch2 : fix the conflict caused by commit a72ab0361110 ("riscv/purgatory: Disable CFI") riscv: kexec: Cleanup riscv_kexec_relocate (Patch1) == For readability and simplicity, cleanup the riscv_kexec_relocate code: - Re-sort the first 4 `mv` instructions against `riscv_kexec_method()` - Eliminate registers for debugging (s9,s10,s11) and storing const-value (s5,s6) - Replace `jalr` with `jr` for no-link jump riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS (Patch2 : the Patch3 in V1) == With CONFIG_RELOCATABLE enabled, KBUILD_CFLAGS had a -fPIE option and then the purgatory/string.o was built to reference _ctype symbol via R_RISCV_GOT_HI20 relocations which can't be handled by purgatory. As a consequence, the kernel failed kexec_load_file() with: [ 880.386562] kexec_image: The entry point of kernel at 0x8020 [ 880.388650] kexec_image: Unknown rela relocation: 20 [ 880.389173] kexec_image: Error loading purgatory ret=-8 So remove the -fPIE option for PURGATORY_CFLAGS to generate R_RISCV_PCREL_HI20 relocations type making puragtory work as it was. Song Shuai (2): riscv: kexec: Cleanup riscv_kexec_relocate riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS arch/riscv/kernel/kexec_relocate.S | 54 +- arch/riscv/purgatory/Makefile | 4 +++ 2 files changed, 28 insertions(+), 30 deletions(-) -- 2.20.1 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec