2023-03-07 22:45:25

by Bjorn Helgaas

[permalink] [raw]
Subject: [PATCH v2 0/2] 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.

v1 is at:
https://lore.kernel.org/all/[email protected]/

This v2 is trivially rebased to v6.3-rc1 and the commit log expanded
slightly.


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



2023-03-07 22:45:34

by Bjorn Helgaas

[permalink] [raw]
Subject: [PATCH v2 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():

arch_kexec_kernel_image_load # x86
if (!image->fops || !image->fops->load)
return ERR_PTR(-ENOEXEC);
return image->fops->load(image, image->kernel_buf, ...)

arch_kexec_kernel_image_load # generic
kexec_image_load_default
if (!image->fops || !image->fops->load)
return ERR_PTR(-ENOEXEC);
return image->fops->load(image, image->kernel_buf, ...)

Remove the x86-specific version and use the generic
arch_kexec_kernel_image_load(). No functional change intended.

Signed-off-by: Bjorn Helgaas <[email protected]>
---
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 6883c5922701..4746bc9d39c9 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


2023-03-07 22:45:40

by Bjorn Helgaas

[permalink] [raw]
Subject: [PATCH v2 2/2] kexec: Remove unnecessary arch_kexec_kernel_image_load()

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.

Signed-off-by: Bjorn Helgaas <[email protected]>
---
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 4746bc9d39c9..22b5cd24f581 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 f1a0e4e3fb5c..f989f5f1933b 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


2023-03-08 00:39:35

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] kexec: Remove unnecessary arch hook

On 03/07/23 at 04:44pm, Bjorn Helgaas wrote:
> 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.
>
> v1 is at:
> https://lore.kernel.org/all/[email protected]/
>
> This v2 is trivially rebased to v6.3-rc1 and the commit log expanded
> slightly.

Acked-by: Baoquan He <[email protected]>

>
>
> 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
>


2023-03-08 10:45:14

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load()

On Tue, Mar 07, 2023 at 04:44:15PM -0600, Bjorn Helgaas wrote:
> 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():
>
> arch_kexec_kernel_image_load # x86
> if (!image->fops || !image->fops->load)
> return ERR_PTR(-ENOEXEC);
> return image->fops->load(image, image->kernel_buf, ...)
>
> arch_kexec_kernel_image_load # generic
> kexec_image_load_default
> if (!image->fops || !image->fops->load)
> return ERR_PTR(-ENOEXEC);
> return image->fops->load(image, image->kernel_buf, ...)
>
> Remove the x86-specific version and use the generic
> arch_kexec_kernel_image_load(). No functional change intended.
>
> Signed-off-by: Bjorn Helgaas <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

2023-03-08 10:46:06

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] kexec: Remove unnecessary arch_kexec_kernel_image_load()

On Tue, Mar 07, 2023 at 04:44:16PM -0600, Bjorn Helgaas wrote:
> 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.
>
> Signed-off-by: Bjorn Helgaas <[email protected]>

Reviewed-by: Simon Horman <[email protected]>


2023-03-23 07:50:57

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] kexec: Remove unnecessary arch hook

Hi,

On 03/07/23 at 04:44pm, Bjorn Helgaas wrote:
> 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.
>
> v1 is at:
> https://lore.kernel.org/all/[email protected]/
>
> This v2 is trivially rebased to v6.3-rc1 and the commit log expanded
> slightly.

This is an obvious and good cleanup patchset, who should I ping to ask
for accepting? It's touching kexec generic code, while the hook
only exists on x86 ARCH.

Thanks
Baoquan

2023-03-23 22:11:08

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] kexec: Remove unnecessary arch hook

On Thu, 23 Mar 2023 15:49:20 +0800 Baoquan He <[email protected]> wrote:

> Hi,
>
> On 03/07/23 at 04:44pm, Bjorn Helgaas wrote:
> > 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.
> >
> > v1 is at:
> > https://lore.kernel.org/all/[email protected]/
> >
> > This v2 is trivially rebased to v6.3-rc1 and the commit log expanded
> > slightly.
>
> This is an obvious and good cleanup patchset, who should I ping to ask
> for accepting? It's touching kexec generic code, while the hook
> only exists on x86 ARCH.

I grabbed them

2023-03-24 01:47:09

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] kexec: Remove unnecessary arch hook

On 03/23/23 at 03:07pm, Andrew Morton wrote:
> On Thu, 23 Mar 2023 15:49:20 +0800 Baoquan He <[email protected]> wrote:
>
> > Hi,
> >
> > On 03/07/23 at 04:44pm, Bjorn Helgaas wrote:
> > > 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.
> > >
> > > v1 is at:
> > > https://lore.kernel.org/all/[email protected]/
> > >
> > > This v2 is trivially rebased to v6.3-rc1 and the commit log expanded
> > > slightly.
> >
> > This is an obvious and good cleanup patchset, who should I ping to ask
> > for accepting? It's touching kexec generic code, while the hook
> > only exists on x86 ARCH.
>
> I grabbed them

Thanks a lot, Andrew.