* [PATCH 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()
2022-12-15 18:23 [PATCH 0/2] kexec: Remove unnecessary arch hook Bjorn Helgaas
@ 2022-12-15 18:23 ` Bjorn Helgaas
2022-12-15 18:23 ` [PATCH 2/2] kexec: " Bjorn Helgaas
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2022-12-15 18:23 UTC (permalink / raw)
To: Eric Biederman
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H . Peter Anvin, x86, kexec, linux-kernel, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
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.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
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(-)
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index a3760ca796aa..5b77bbc28f96 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -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
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 0611fd83858e..1a3e2c05a8a5 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -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.
*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 5dd4343c1bbe..c08d5d52223a 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -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
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/2] kexec: Remove unnecessary arch_kexec_kernel_image_load()
2022-12-15 18:23 [PATCH 0/2] kexec: Remove unnecessary arch hook Bjorn Helgaas
2022-12-15 18:23 ` [PATCH 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load() Bjorn Helgaas
@ 2022-12-15 18:23 ` Bjorn Helgaas
2022-12-17 9:48 ` [PATCH 0/2] kexec: Remove unnecessary arch hook Baoquan He
2022-12-21 6:05 ` Baoquan He
3 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2022-12-15 18:23 UTC (permalink / raw)
To: Eric Biederman
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H . Peter Anvin, x86, kexec, linux-kernel, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
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.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
kexec: make static
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
include/linux/kexec.h | 6 ------
kernel/kexec_file.c | 6 +++---
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c08d5d52223a..8844e7debfa4 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -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);
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index dd5983010b7b..39ddf09ab573 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-15 18:23 [PATCH 0/2] kexec: Remove unnecessary arch hook Bjorn Helgaas
2022-12-15 18:23 ` [PATCH 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load() Bjorn Helgaas
2022-12-15 18:23 ` [PATCH 2/2] kexec: " Bjorn Helgaas
@ 2022-12-17 9:48 ` Baoquan He
2022-12-17 15:58 ` Bjorn Helgaas
2022-12-21 6:05 ` Baoquan He
3 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2022-12-17 9:48 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Eric Biederman, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H . Peter Anvin, x86, kexec, linux-kernel,
Bjorn Helgaas
On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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/20220223113225.63106-3-bhe@redhat.com/T/#u
>
> 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(-)
>
> --
> 2.25.1
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-17 9:48 ` [PATCH 0/2] kexec: Remove unnecessary arch hook Baoquan He
@ 2022-12-17 15:58 ` Bjorn Helgaas
2022-12-19 7:01 ` Baoquan He
2022-12-21 6:02 ` Baoquan He
0 siblings, 2 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2022-12-17 15:58 UTC (permalink / raw)
To: Baoquan He
Cc: Eric Biederman, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H . Peter Anvin, x86, kexec, linux-kernel,
Bjorn Helgaas
On Sat, Dec 17, 2022 at 05:48:51PM +0800, Baoquan He wrote:
> On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > 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/20220223113225.63106-3-bhe@redhat.com/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.
> > 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(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-17 15:58 ` Bjorn Helgaas
@ 2022-12-19 7:01 ` Baoquan He
2022-12-21 6:02 ` Baoquan He
1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2022-12-19 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Eric Biederman, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H . Peter Anvin, x86, kexec, linux-kernel,
Bjorn Helgaas
On 12/17/22 at 09:58am, Bjorn Helgaas wrote:
> On Sat, Dec 17, 2022 at 05:48:51PM +0800, Baoquan He wrote:
> > On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> > > From: Bjorn Helgaas <bhelgaas@google.com>
> > >
> > > 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/20220223113225.63106-3-bhe@redhat.com/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.
>
> > > 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(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-17 15:58 ` Bjorn Helgaas
2022-12-19 7:01 ` Baoquan He
@ 2022-12-21 6:02 ` Baoquan He
1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2022-12-21 6:02 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Eric Biederman, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H . Peter Anvin, x86, kexec, linux-kernel,
Bjorn Helgaas
On 12/17/22 at 09:58am, Bjorn Helgaas wrote:
> On Sat, Dec 17, 2022 at 05:48:51PM +0800, Baoquan He wrote:
> > On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> > > From: Bjorn Helgaas <bhelgaas@google.com>
> > >
> > > 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/20220223113225.63106-3-bhe@redhat.com/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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-15 18:23 [PATCH 0/2] kexec: Remove unnecessary arch hook Bjorn Helgaas
` (2 preceding siblings ...)
2022-12-17 9:48 ` [PATCH 0/2] kexec: Remove unnecessary arch hook Baoquan He
@ 2022-12-21 6:05 ` Baoquan He
2023-01-04 3:21 ` Baoquan He
3 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2022-12-21 6:05 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Eric Biederman, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H . Peter Anvin, x86, kexec, linux-kernel,
Bjorn Helgaas
On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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.
Acked-by: Baoquan He <bhe@redhat.com>
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
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2022-12-21 6:05 ` Baoquan He
@ 2023-01-04 3:21 ` Baoquan He
2023-01-04 18:37 ` Dave Hansen
0 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2023-01-04 3:21 UTC (permalink / raw)
To: Bjorn Helgaas, Ingo Molnar, Borislav Petkov
Cc: Eric Biederman, Thomas Gleixner, Dave Hansen, H . Peter Anvin,
x86, kexec, linux-kernel, Bjorn Helgaas
Hi Ingo, Boris,
On 12/21/22 at 02:05pm, Baoquan He wrote:
> On 12/15/22 at 12:23pm, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > 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.
>
> Acked-by: Baoquan He <bhe@redhat.com>
>
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2023-01-04 3:21 ` Baoquan He
@ 2023-01-04 18:37 ` Dave Hansen
2023-01-09 1:38 ` Baoquan He
0 siblings, 1 reply; 11+ messages in thread
From: Dave Hansen @ 2023-01-04 18:37 UTC (permalink / raw)
To: Baoquan He, Bjorn Helgaas, Ingo Molnar, Borislav Petkov
Cc: Eric Biederman, Thomas Gleixner, Dave Hansen, H . Peter Anvin,
x86, kexec, linux-kernel, Bjorn Helgaas
On 1/3/23 19:21, Baoquan He wrote:
>> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] kexec: Remove unnecessary arch hook
2023-01-04 18:37 ` Dave Hansen
@ 2023-01-09 1:38 ` Baoquan He
0 siblings, 0 replies; 11+ messages in thread
From: Baoquan He @ 2023-01-09 1:38 UTC (permalink / raw)
To: Dave Hansen
Cc: Bjorn Helgaas, Ingo Molnar, Borislav Petkov, Eric Biederman,
Thomas Gleixner, Dave Hansen, H . Peter Anvin, x86, kexec,
linux-kernel, Bjorn Helgaas
On 01/04/23 at 10:37am, Dave Hansen wrote:
> On 1/3/23 19:21, Baoquan He wrote:
> >> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread