Skip to contentSkip to conversation

kexec: Remove unnecessary arch hook

PATCH Superseded Bjorn Helgaas 3 participants 11 messages Dec 15, 2022 – Jan 9, 2023

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover kexec: Remove unnecessary arch hook

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

Bjorn Helgaas (2):
x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()
kexec: Remove unnecessary arch_kexec_kernel_image_load()

 arch/x86/include/asm/kexec.h       |  3 ---
 arch/x86/kernel/machine_kexec_64.c | 11 -----------
 include/linux/kexec.h              |  8 --------
 kernel/kexec_file.c                |  6 +++---
 4 files changed, 3 insertions(+), 25 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()

From: Bjorn Helgaas <[email protected]>

The x86 implementation of arch_kexec_kernel_image_load() is functionally identical to the generic arch_kexec_kernel_image_load().

Remove it and use the generic arch_kexec_kernel_image_load(). No functional change intended.

---
 arch/x86/include/asm/kexec.h       |  3 ---
 arch/x86/kernel/machine_kexec_64.c | 11 -----------
 include/linux/kexec.h              |  2 --
 3 files changed, 16 deletions(-)
arch/x86/include/asm/kexec.h +0 -3
index a3760ca796aa..5b77bbc28f96 100644
@@ -200,9 +200,6 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
 				     const Elf_Shdr *symtab);
 #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
 
-void *arch_kexec_kernel_image_load(struct kimage *image);
-#define arch_kexec_kernel_image_load arch_kexec_kernel_image_load
-
 int arch_kimage_file_post_load_cleanup(struct kimage *image);
 #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
 #endif
arch/x86/kernel/machine_kexec_64.c +0 -11
index 0611fd83858e..1a3e2c05a8a5 100644
@@ -374,17 +374,6 @@ void machine_kexec(struct kimage *image)
 /* arch-dependent functionality related to kexec file-based syscall */
 
 #ifdef CONFIG_KEXEC_FILE
-void *arch_kexec_kernel_image_load(struct kimage *image)
-{
-	if (!image->fops || !image->fops->load)
-		return ERR_PTR(-ENOEXEC);
-
-	return image->fops->load(image, image->kernel_buf,
-				 image->kernel_buf_len, image->initrd_buf,
-				 image->initrd_buf_len, image->cmdline_buf,
-				 image->cmdline_buf_len);
-}
-
 /*
  * Apply purgatory relocations.
  *
include/linux/kexec.h +0 -2
index 5dd4343c1bbe..c08d5d52223a 100644
@@ -207,12 +207,10 @@ static inline int arch_kimage_file_post_load_cleanup(struct kimage *image)
 }
 #endif
 
-#ifndef arch_kexec_kernel_image_load
 static inline void *arch_kexec_kernel_image_load(struct kimage *image)
 {
 	return kexec_image_load_default(image);
 }
-#endif
 
 #ifdef CONFIG_KEXEC_SIG
 #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION
Signature · 7 lines
2.25.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

PATCH 2/2 kexec: Remove unnecessary arch_kexec_kernel_image_load()

In reply to Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

arch_kexec_kernel_image_load() only calls kexec_image_load_default(), and there are no arch-specific implementations.

Remove the unnecessary arch_kexec_kernel_image_load() and make kexec_image_load_default() static .

No functional change intended.

kexec: make static

---
 include/linux/kexec.h | 6 ------
 kernel/kexec_file.c   | 6 +++---
 2 files changed, 3 insertions(+), 9 deletions(-)
include/linux/kexec.h +0 -6
index c08d5d52223a..8844e7debfa4 100644
@@ -190,7 +190,6 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name,
 				   void *buf, unsigned int size,
 				   bool get_value);
 void *kexec_purgatory_get_symbol_addr(struct kimage *image, const char *name);
-void *kexec_image_load_default(struct kimage *image);
 
 #ifndef arch_kexec_kernel_image_probe
 static inline int
@@ -207,11 +206,6 @@ static inline int arch_kimage_file_post_load_cleanup(struct kimage *image)
 }
 #endif
 
-static inline void *arch_kexec_kernel_image_load(struct kimage *image)
-{
-	return kexec_image_load_default(image);
-}
-
 #ifdef CONFIG_KEXEC_SIG
 #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION
 int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
kernel/kexec_file.c +3 -3
index dd5983010b7b..39ddf09ab573 100644
@@ -65,7 +65,7 @@ int kexec_image_probe_default(struct kimage *image, void *buf,
 	return ret;
 }
 
-void *kexec_image_load_default(struct kimage *image)
+static void *kexec_image_load_default(struct kimage *image)
 {
 	if (!image->fops || !image->fops->load)
 		return ERR_PTR(-ENOEXEC);
@@ -249,8 +249,8 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd,
 	/* IMA needs to pass the measurement list to the next kernel. */
 	ima_add_kexec_buffer(image);
 
-	/* Call arch image load handlers */
-	ldata = arch_kexec_kernel_image_load(image);
+	/* Call image load handler */
+	ldata = kexec_image_load_default(image);
 
 	if (IS_ERR(ldata)) {
 		ret = PTR_ERR(ldata);
Signature · 7 lines
2.25.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw
In reply to Bjorn Helgaas
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

I ever posted below patch to do the same thing, Andrew only picked the memory leak fixing patch.

[PATCH v2 2/2] kexec_file: clean up arch_kexec_kernel_image_load
https://lore.kernel.org/all/[email protected]/T/#u

Quoted 5 lines

Bjorn Helgaas (2):
x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()
kexec: Remove unnecessary arch_kexec_kernel_image_load()

Quoted 15 lines
 arch/x86/include/asm/kexec.h       |  3 ---
 arch/x86/kernel/machine_kexec_64.c | 11 -----------
 include/linux/kexec.h              |  8 --------
 kernel/kexec_file.c                |  6 +++---
 4 files changed, 3 insertions(+), 25 deletions(-)
Signature · 7 lines
2.25.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 11 lines · Baoquan He
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

I ever posted below patch to do the same thing, Andrew only picked the memory leak fixing patch.

[PATCH v2 2/2] kexec_file: clean up arch_kexec_kernel_image_load
https://lore.kernel.org/all/[email protected]/T/#u

Indeed! Sorry, I wasn't aware of your previous work. If you repost it, cc me and I'll be glad to help review it.

Quoted 9 lines
Quoted 9 lines

Bjorn Helgaas (2):
x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()
kexec: Remove unnecessary arch_kexec_kernel_image_load()

 arch/x86/include/asm/kexec.h       |  3 ---
 arch/x86/kernel/machine_kexec_64.c | 11 -----------
 include/linux/kexec.h              |  8 --------
 kernel/kexec_file.c                |  6 +++---
 4 files changed, 3 insertions(+), 25 deletions(-)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Baoquan He
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

Quoted 8 lines
Quoted 5 lines

I ever posted below patch to do the same thing, Andrew only picked the memory leak fixing patch.

[PATCH v2 2/2] kexec_file: clean up arch_kexec_kernel_image_load
https://lore.kernel.org/all/[email protected]/T/#u

Indeed! Sorry, I wasn't aware of your previous work. If you repost it, cc me and I'll be glad to help review it.

Sure, I will repost the patch for reviewing, thanks a lot.

Quoted 11 lines
Quoted 10 lines
Quoted 10 lines

Bjorn Helgaas (2):
x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()
kexec: Remove unnecessary arch_kexec_kernel_image_load()

 arch/x86/include/asm/kexec.h       |  3 ---
 arch/x86/kernel/machine_kexec_64.c | 11 -----------
 include/linux/kexec.h              |  8 --------
 kernel/kexec_file.c                |  6 +++---
 4 files changed, 3 insertions(+), 25 deletions(-)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw
In reply to Bjorn Helgaas
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Baoquan He
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

Quoted 8 lines
Quoted 5 lines

I ever posted below patch to do the same thing, Andrew only picked the memory leak fixing patch.

[PATCH v2 2/2] kexec_file: clean up arch_kexec_kernel_image_load
https://lore.kernel.org/all/[email protected]/T/#u

Indeed! Sorry, I wasn't aware of your previous work. If you repost it, cc me and I'll be glad to help review it.

When tried to rebase my old patch to the latest kernel, I realized this patchset is what I can end up with. I would like to ack this patchset to make it merged. Thanks a lot for the effort.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Acked-by on the v1 series
#7 lore raw
In reply to Bjorn Helgaas
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

This patchset looks good to me, thx.

Since it cleans up the last arch specific version of arch_kexec_kernel_image_load in x86, maybe this patchset can go into x86 branch?

Thanks
Baoquan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#8 lore raw

Hi Ingo, Boris,

Quoted 6 lines · Baoquan He
Quoted 4 lines · Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

There are no arch-specific things in arch_kexec_kernel_image_load(), so remove it and just use the generic version.

Quoted 7 lines

This patchset looks good to me, thx.

Since it cleans up the last arch specific version of arch_kexec_kernel_image_load in x86, maybe this patchset can go into x86 branch?

Could you consider picking this patchset into x86 branch? This is a clean up on kexec, while the last ARCH using it is x86.

Thanks
Baoquan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw
Quoted 5 lines · Baoquan He
Quoted 3 lines

Since it cleans up the last arch specific version of arch_kexec_kernel_image_load in x86, maybe this patchset can go into x86 branch?

Could you consider picking this patchset into x86 branch? This is a clean up on kexec, while the last ARCH using it is x86.

I'll stick it in my queue to take a closer look.

#10 lore raw
Quoted 8 lines · Dave Hansen
Quoted 5 lines · Baoquan He
Quoted 3 lines

Since it cleans up the last arch specific version of arch_kexec_kernel_image_load in x86, maybe this patchset can go into x86 branch?

Could you consider picking this patchset into x86 branch? This is a clean up on kexec, while the last ARCH using it is x86.

I'll stick it in my queue to take a closer look.

Thanks.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec