mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
2c44b67e2e
In kdump kernel, /proc/vmcore is an elf file mapping the crashed kernel's old memory content. Its elf header is constructed in 1st kernel and passed to kdump kernel via elfcorehdr_addr. Config CRASH_DUMP enables the code of 1st kernel's old memory accessing in different architectures. Currently, config FA_DUMP has dependency on CRASH_DUMP because fadump needs access global variable 'elfcorehdr_addr' to judge if it's in kdump kernel within function is_kdump_kernel(). In the current kernel/crash_dump.c, variable 'elfcorehdr_addr' is defined, and function setup_elfcorehdr() used to parse kernel parameter to fetch the passed value of elfcorehdr_addr. Only for accessing elfcorehdr_addr, FA_DUMP really doesn't have to depends on CRASH_DUMP. To remove the dependency of FA_DUMP on CRASH_DUMP to avoid confusion, rename kernel/crash_dump.c to kernel/elfcorehdr.c, and build it when CONFIG_VMCORE_INFO is ebabled. With this, FA_DUMP doesn't need to depend on CRASH_DUMP. [bhe@redhat.com: power/fadump: make FA_DUMP select CRASH_DUMP] Link: https://lkml.kernel.org/r/Zb8D1ASrgX0qVm9z@MiWiFi-R3L-srv Link: https://lkml.kernel.org/r/20240124051254.67105-4-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Hari Bathini <hbathini@linux.ibm.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Pingfan Liu <piliu@redhat.com> Cc: Klara Modin <klarasmodin@gmail.com> Cc: Michael Kelley <mhklinux@outlook.com> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef LINUX_KEXEC_INTERNAL_H
|
|
#define LINUX_KEXEC_INTERNAL_H
|
|
|
|
#include <linux/kexec.h>
|
|
|
|
struct kexec_segment;
|
|
|
|
struct kimage *do_kimage_alloc_init(void);
|
|
int sanity_check_segment_list(struct kimage *image);
|
|
void kimage_free_page_list(struct list_head *list);
|
|
void kimage_free(struct kimage *image);
|
|
int kimage_load_segment(struct kimage *image, struct kexec_segment *segment);
|
|
void kimage_terminate(struct kimage *image);
|
|
int kimage_is_destination_range(struct kimage *image,
|
|
unsigned long start, unsigned long end);
|
|
|
|
/*
|
|
* Whatever is used to serialize accesses to the kexec_crash_image needs to be
|
|
* NMI safe, as __crash_kexec() can happen during nmi_panic(), so here we use a
|
|
* "simple" atomic variable that is acquired with a cmpxchg().
|
|
*/
|
|
extern atomic_t __kexec_lock;
|
|
static inline bool kexec_trylock(void)
|
|
{
|
|
return atomic_cmpxchg_acquire(&__kexec_lock, 0, 1) == 0;
|
|
}
|
|
static inline void kexec_unlock(void)
|
|
{
|
|
atomic_set_release(&__kexec_lock, 0);
|
|
}
|
|
|
|
#ifdef CONFIG_KEXEC_FILE
|
|
#include <linux/purgatory.h>
|
|
void kimage_file_post_load_cleanup(struct kimage *image);
|
|
extern char kexec_purgatory[];
|
|
extern size_t kexec_purgatory_size;
|
|
#else /* CONFIG_KEXEC_FILE */
|
|
static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
|
|
#endif /* CONFIG_KEXEC_FILE */
|
|
#endif /* LINUX_KEXEC_INTERNAL_H */
|