Re: [PATCH V2 2/2] kexec: split kexec_load syscall from kexec core code
On 07/21/15 at 09:03am, Vivek Goyal wrote: > On Mon, Jul 20, 2015 at 04:37:15PM +0800, dyo...@redhat.com wrote: > > Now there's two kexec load syscall, one is kexec_load another is > > kexec_file_load, kexec_file_load has been splited as kernel/kexec_file.c. > > In this patch I split kexec_load syscall code to kernel/kexec.c. > > Hi Dave, > > Nice work. Thanks for doing this. I have couple of minor comments. > > - We might have to audit kernel/kexec_core.c. I think there are some > functions in there which are used by only old syscall and not the new > one. All that code should be in kernel/kexec.c. Only the code which is > shared between two syscalls should be in kernel/kexec_core.c. > > For example, I think kimage_alloc_init() is used by old syscall only. > New syscall uses kimage_file_alloc_init(). You are right, actually two functions copy_user_segment_list and kimage_alloc_init are used by kexec.c only Will move them to kexec.c from kexec_core.c, it works well during my testing > > [..] > > --- linux.orig/include/linux/kexec.h > > +++ linux/include/linux/kexec.h > > @@ -16,7 +16,7 @@ > > > > #include > > > > -#ifdef CONFIG_KEXEC > > +#ifdef CONFIG_KEXEC_CORE > > #include > > #include > > #include > > @@ -318,12 +318,18 @@ int crash_shrink_memory(unsigned long ne > > size_t crash_get_memory_size(void); > > void crash_free_reserved_phys_range(unsigned long begin, unsigned long > > end); > > > > -#else /* !CONFIG_KEXEC */ > > +#ifdef CONFIG_KEXEC > > +int kimage_alloc_init(struct kimage **rimage, unsigned long entry, > > +unsigned long nr_segments, > > +struct kexec_segment __user *segments, > > +unsigned long flags); > > +#endif > > I am wondering why this needs to be in kexec.h. Who needs this? Even if > somebody needs this, this should probably be outside of KEXEC_CORE. It was added here in 1st version before adding kexec_internal.h, later I moved most of them to kexec_internal.h, but yes it is not used by any file other than kexec.c, will drop this chunk. Thanks a lot Dave -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V2 2/2] kexec: split kexec_load syscall from kexec core code
On Mon, Jul 20, 2015 at 04:37:15PM +0800, dyo...@redhat.com wrote: > Now there's two kexec load syscall, one is kexec_load another is > kexec_file_load, kexec_file_load has been splited as kernel/kexec_file.c. > In this patch I split kexec_load syscall code to kernel/kexec.c. Hi Dave, Nice work. Thanks for doing this. I have couple of minor comments. - We might have to audit kernel/kexec_core.c. I think there are some functions in there which are used by only old syscall and not the new one. All that code should be in kernel/kexec.c. Only the code which is shared between two syscalls should be in kernel/kexec_core.c. For example, I think kimage_alloc_init() is used by old syscall only. New syscall uses kimage_file_alloc_init(). [..] > --- linux.orig/include/linux/kexec.h > +++ linux/include/linux/kexec.h > @@ -16,7 +16,7 @@ > > #include > > -#ifdef CONFIG_KEXEC > +#ifdef CONFIG_KEXEC_CORE > #include > #include > #include > @@ -318,12 +318,18 @@ int crash_shrink_memory(unsigned long ne > size_t crash_get_memory_size(void); > void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); > > -#else /* !CONFIG_KEXEC */ > +#ifdef CONFIG_KEXEC > +int kimage_alloc_init(struct kimage **rimage, unsigned long entry, > + unsigned long nr_segments, > + struct kexec_segment __user *segments, > + unsigned long flags); > +#endif I am wondering why this needs to be in kexec.h. Who needs this? Even if somebody needs this, this should probably be outside of KEXEC_CORE. #ifdef CONFIG_KEXEC int kimage_alloc_init(struct kimage **rimage, unsigned long entry, #else #endif #ifdef CONFIG_KEXEC_CORE . .. Thanks Vivek -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 2/2] kexec: split kexec_load syscall from kexec core code
Now there's two kexec load syscall, one is kexec_load another is kexec_file_load, kexec_file_load has been splited as kernel/kexec_file.c. In this patch I split kexec_load syscall code to kernel/kexec.c. And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and use kexec_file_load only, or vice verse. The original requirement is from Tedso, he want kexec kernel signature being checked with CONFIG_KEXEC_VERIFY_SIG enabled. But kexec-tools use kexec_load syscall can bypass the checking. Vivek Goyal proposed to create a common kconfig option so user can compile in only one syscall for loading kexec kernel. KEXEC/KEXEC_FILE selects KEXEC_CORE so that old config files still work. Because there's general code need CONFIG_KEXEC_CORE, so I updated all the architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects KEXEC_CORE in arch Kconfig. Also updated general kernel code with to kexec_load syscall. Signed-off-by: Dave Young --- arch/Kconfig |3 arch/arm/Kconfig |1 arch/ia64/Kconfig |1 arch/m68k/Kconfig |1 arch/mips/Kconfig |1 arch/powerpc/Kconfig |1 arch/s390/Kconfig |1 arch/sh/Kconfig |1 arch/tile/Kconfig |1 arch/x86/Kconfig |3 arch/x86/boot/header.S|2 arch/x86/include/asm/kdebug.h |2 arch/x86/kernel/Makefile |4 arch/x86/kernel/kvmclock.c|4 arch/x86/kernel/reboot.c |4 arch/x86/kernel/setup.c |2 arch/x86/kernel/vmlinux.lds.S |2 arch/x86/kvm/vmx.c|8 arch/x86/platform/efi/efi.c |4 arch/x86/platform/uv/uv_nmi.c |6 drivers/firmware/efi/Kconfig |2 drivers/pci/pci-driver.c |2 include/linux/kexec.h | 12 init/initramfs.c |4 kernel/Makefile |1 kernel/events/core.c |2 kernel/kexec.c| 1578 - kernel/kexec_core.c | 1594 ++ kernel/ksysfs.c |6 kernel/printk/printk.c|2 kernel/reboot.c |2 kernel/sysctl.c |2 32 files changed, 1648 insertions(+), 1611 deletions(-) create mode 100644 kernel/kexec_core.c --- linux.orig/arch/Kconfig +++ linux/arch/Kconfig @@ -2,6 +2,9 @@ # General architecture dependent options # +config KEXEC_CORE + bool + config OPROFILE tristate "OProfile system profiling" depends on PROFILING --- linux.orig/arch/arm/Kconfig +++ linux/arch/arm/Kconfig @@ -2005,6 +2005,7 @@ config KEXEC bool "Kexec system call (EXPERIMENTAL)" depends on (!SMP || PM_SLEEP_SMP) depends on !CPU_V7M + select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot --- linux.orig/arch/ia64/Kconfig +++ linux/arch/ia64/Kconfig @@ -518,6 +518,7 @@ source "drivers/sn/Kconfig" config KEXEC bool "kexec system call" depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) + select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot --- linux.orig/arch/m68k/Kconfig +++ linux/arch/m68k/Kconfig @@ -95,6 +95,7 @@ config MMU_SUN3 config KEXEC bool "kexec system call" depends on M68KCLASSIC + select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot --- linux.orig/arch/mips/Kconfig +++ linux/arch/mips/Kconfig @@ -2592,6 +2592,7 @@ source "kernel/Kconfig.preempt" config KEXEC bool "Kexec system call" + select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot --- linux.orig/arch/powerpc/Kconfig +++ linux/arch/powerpc/Kconfig @@ -415,6 +415,7 @@ config PPC64_SUPPORTS_MEMORY_FAILURE config KEXEC bool "kexec system call" depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) + select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot --- linux.orig/arch/s390/Kconfig +++ linux/arch/s390/Kconfig @@ -48,6 +48,7 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC config KEXEC def_bool y + select KEXEC_CORE config AUDIT_ARCH def_bool y --- linux.orig/arch/sh/Kconfig +++ linux/arch/sh/Kconfig @@ -602,6 +602,7 @@ source kernel/Kconfig.hz config KEXEC bool "kexec system call (EXPERIMENTAL)" depends on