Message ID | 20250104-elf-v2-5-77dc2e06db4e@daynix.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | elf: Define note name macros | expand |
Hi, On Sat, Jan 04, 2025 at 11:38:38PM +0900, Akihiko Odaki wrote: > Now KEXEC_CORE_NOTE_NAME is only used at one place and it does not seem > to provide any value anymore. Replace the remaining usage with the > literal and remove the macro. > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > --- > arch/s390/kernel/crash_dump.c | 2 +- > include/linux/kexec.h | 2 -- > include/linux/vmcore_info.h | 1 - > 3 files changed, 1 insertion(+), 4 deletions(-) > > diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c > index cd0c93a8fb8b..4a9817489e35 100644 > --- a/arch/s390/kernel/crash_dump.c > +++ b/arch/s390/kernel/crash_dump.c > @@ -253,7 +253,7 @@ static const char *nt_name(Elf64_Word type) > const char *name = "LINUX"; > > if (type == NT_PRPSINFO || type == NT_PRSTATUS || type == NT_PRFPREG) > - name = KEXEC_CORE_NOTE_NAME; > + name = "CORE"; If I've understood the code here correctly, the note type is supplied at all the nt_init() and nt_size() call sites, so instead of this hack can we wrap those in macros that get the formal name from elf.h rather than guessing it here? e.g.: #define nt_size(..., note, ...) \ __nt_size(..., NT ## _ ## note, NN ## _ ## note, ...) etc. The compiler is quite likely to fold away most of the implied duplication of code (it would be interesting to look at the compiler output) -- but anyway, this is super-slow-path: nobody expects realtime response when the kernel has crashed. [...] Cheers ---Dave
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index cd0c93a8fb8b..4a9817489e35 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -253,7 +253,7 @@ static const char *nt_name(Elf64_Word type) const char *name = "LINUX"; if (type == NT_PRPSINFO || type == NT_PRSTATUS || type == NT_PRFPREG) - name = KEXEC_CORE_NOTE_NAME; + name = "CORE"; return name; } diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3..c840431eadda 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -68,8 +68,6 @@ extern note_buf_t __percpu *crash_notes; #define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE #endif -#define KEXEC_CORE_NOTE_NAME CRASH_CORE_NOTE_NAME - /* * This structure is used to hold the arguments that are used when loading * kernel binaries. diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h index 1672801fd98c..37e003ae5262 100644 --- a/include/linux/vmcore_info.h +++ b/include/linux/vmcore_info.h @@ -6,7 +6,6 @@ #include <linux/elfcore.h> #include <linux/elf.h> -#define CRASH_CORE_NOTE_NAME "CORE" #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4) #define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4) #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
Now KEXEC_CORE_NOTE_NAME is only used at one place and it does not seem to provide any value anymore. Replace the remaining usage with the literal and remove the macro. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> --- arch/s390/kernel/crash_dump.c | 2 +- include/linux/kexec.h | 2 -- include/linux/vmcore_info.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-)