Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kexec: drop weak attribute from functions

Drop __weak attribute from functions in kexec_core.c:
- machine_kexec_post_load()
- arch_kexec_protect_crashkres()
- arch_kexec_unprotect_crashkres()
- crash_free_reserved_phys_range()

Link: https://lkml.kernel.org/r/c0f6219e03cb399d166d518ab505095218a902dd.1656659357.git.naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Suggested-by: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>

authored by

Naveen N. Rao and committed by
Mimi Zohar
0738eceb 65d9a9a6

+64 -33
+14 -2
arch/arm64/include/asm/kexec.h
··· 84 84 extern bool crash_is_nosave(unsigned long pfn); 85 85 extern void crash_prepare_suspend(void); 86 86 extern void crash_post_resume(void); 87 + 88 + void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 89 + #define crash_free_reserved_phys_range crash_free_reserved_phys_range 87 90 #else 88 91 static inline bool crash_is_nosave(unsigned long pfn) {return false; } 89 92 static inline void crash_prepare_suspend(void) {} 90 93 static inline void crash_post_resume(void) {} 91 94 #endif 92 95 96 + struct kimage; 97 + 93 98 #if defined(CONFIG_KEXEC_CORE) 94 99 void cpu_soft_restart(unsigned long el2_switch, unsigned long entry, 95 100 unsigned long arg0, unsigned long arg1, 96 101 unsigned long arg2); 102 + 103 + int machine_kexec_post_load(struct kimage *image); 104 + #define machine_kexec_post_load machine_kexec_post_load 105 + 106 + void arch_kexec_protect_crashkres(void); 107 + #define arch_kexec_protect_crashkres arch_kexec_protect_crashkres 108 + 109 + void arch_kexec_unprotect_crashkres(void); 110 + #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres 97 111 #endif 98 112 99 113 #define ARCH_HAS_KIMAGE_ARCH ··· 126 112 127 113 #ifdef CONFIG_KEXEC_FILE 128 114 extern const struct kexec_file_ops kexec_image_ops; 129 - 130 - struct kimage; 131 115 132 116 int arch_kimage_file_post_load_cleanup(struct kimage *image); 133 117 #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
+5
arch/powerpc/include/asm/kexec.h
··· 98 98 99 99 void kexec_copy_flush(struct kimage *image); 100 100 101 + #if defined(CONFIG_CRASH_DUMP) && defined(CONFIG_PPC_RTAS) 102 + void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 103 + #define crash_free_reserved_phys_range crash_free_reserved_phys_range 104 + #endif 105 + 101 106 #ifdef CONFIG_KEXEC_FILE 102 107 extern const struct kexec_file_ops kexec_elf64_ops; 103 108
+11
arch/s390/include/asm/kexec.h
··· 85 85 extern const struct kexec_file_ops s390_kexec_image_ops; 86 86 extern const struct kexec_file_ops s390_kexec_elf_ops; 87 87 88 + #ifdef CONFIG_CRASH_DUMP 89 + void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 90 + #define crash_free_reserved_phys_range crash_free_reserved_phys_range 91 + 92 + void arch_kexec_protect_crashkres(void); 93 + #define arch_kexec_protect_crashkres arch_kexec_protect_crashkres 94 + 95 + void arch_kexec_unprotect_crashkres(void); 96 + #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres 97 + #endif 98 + 88 99 #ifdef CONFIG_KEXEC_FILE 89 100 struct purgatory_info; 90 101 int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
+6
arch/x86/include/asm/kexec.h
··· 186 186 extern void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages); 187 187 #define arch_kexec_pre_free_pages arch_kexec_pre_free_pages 188 188 189 + void arch_kexec_protect_crashkres(void); 190 + #define arch_kexec_protect_crashkres arch_kexec_protect_crashkres 191 + 192 + void arch_kexec_unprotect_crashkres(void); 193 + #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres 194 + 189 195 #ifdef CONFIG_KEXEC_FILE 190 196 struct purgatory_info; 191 197 int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
+28 -4
include/linux/kexec.h
··· 390 390 extern int kernel_kexec(void); 391 391 extern struct page *kimage_alloc_control_pages(struct kimage *image, 392 392 unsigned int order); 393 - int machine_kexec_post_load(struct kimage *image); 393 + 394 + #ifndef machine_kexec_post_load 395 + static inline int machine_kexec_post_load(struct kimage *image) { return 0; } 396 + #endif 394 397 395 398 extern void __crash_kexec(struct pt_regs *); 396 399 extern void crash_kexec(struct pt_regs *); ··· 426 423 427 424 int crash_shrink_memory(unsigned long new_size); 428 425 size_t crash_get_memory_size(void); 429 - void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 430 426 431 - void arch_kexec_protect_crashkres(void); 432 - void arch_kexec_unprotect_crashkres(void); 427 + #ifndef arch_kexec_protect_crashkres 428 + /* 429 + * Protection mechanism for crashkernel reserved memory after 430 + * the kdump kernel is loaded. 431 + * 432 + * Provide an empty default implementation here -- architecture 433 + * code may override this 434 + */ 435 + static inline void arch_kexec_protect_crashkres(void) { } 436 + #endif 437 + 438 + #ifndef arch_kexec_unprotect_crashkres 439 + static inline void arch_kexec_unprotect_crashkres(void) { } 440 + #endif 433 441 434 442 #ifndef page_to_boot_pfn 435 443 static inline unsigned long page_to_boot_pfn(struct page *page) ··· 467 453 static inline phys_addr_t boot_phys_to_phys(unsigned long boot_phys) 468 454 { 469 455 return boot_phys; 456 + } 457 + #endif 458 + 459 + #ifndef crash_free_reserved_phys_range 460 + static inline void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) 461 + { 462 + unsigned long addr; 463 + 464 + for (addr = begin; addr < end; addr += PAGE_SIZE) 465 + free_reserved_page(boot_pfn_to_page(addr >> PAGE_SHIFT)); 470 466 } 471 467 #endif 472 468
-27
kernel/kexec_core.c
··· 591 591 592 592 } 593 593 594 - int __weak machine_kexec_post_load(struct kimage *image) 595 - { 596 - return 0; 597 - } 598 - 599 594 void kimage_terminate(struct kimage *image) 600 595 { 601 596 if (*image->entry != 0) ··· 1015 1020 return size; 1016 1021 } 1017 1022 1018 - void __weak crash_free_reserved_phys_range(unsigned long begin, 1019 - unsigned long end) 1020 - { 1021 - unsigned long addr; 1022 - 1023 - for (addr = begin; addr < end; addr += PAGE_SIZE) 1024 - free_reserved_page(boot_pfn_to_page(addr >> PAGE_SHIFT)); 1025 - } 1026 - 1027 1023 int crash_shrink_memory(unsigned long new_size) 1028 1024 { 1029 1025 int ret = 0; ··· 1211 1225 mutex_unlock(&kexec_mutex); 1212 1226 return error; 1213 1227 } 1214 - 1215 - /* 1216 - * Protection mechanism for crashkernel reserved memory after 1217 - * the kdump kernel is loaded. 1218 - * 1219 - * Provide an empty default implementation here -- architecture 1220 - * code may override this 1221 - */ 1222 - void __weak arch_kexec_protect_crashkres(void) 1223 - {} 1224 - 1225 - void __weak arch_kexec_unprotect_crashkres(void) 1226 - {}