On Thu, 28 Jul 2011, Olaf Hering wrote:
> Add a new function kexec_is_loaded to be used by subsequent changes for
> kexec in Xen HVM guests with PV drivers loaded.
>
> A kexec reboot in a HVM guest needs to unregister all resources such as
> xenstore watches and virqs, otherwise the kexec kernel can not bind to
> these resources again. But the unregister only needs to happen during a
> kexec boot because the guest remains the same from the Xen point of
> view. A normal reboot will shutdown and destroy the entire guest with
> all its resources, then the guest will start again with a different
> domain_id number. So doing all the unregister work would only delay
> normal reboots.
>
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
>
> ---
> include/linux/kexec.h | 3 ++-
> kernel/kexec.c | 8 +++++++-
> kernel/ksysfs.c | 2 +-
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> Index: linux-3.0/include/linux/kexec.h
> ===================================================================
> --- linux-3.0.orig/include/linux/kexec.h
> +++ linux-3.0/include/linux/kexec.h
> @@ -126,6 +126,7 @@ extern asmlinkage long compat_sys_kexec_
> extern struct page *kimage_alloc_control_pages(struct kimage *image,
> unsigned int order);
> extern void crash_kexec(struct pt_regs *);
> +extern int kexec_is_loaded(void);
> int kexec_should_crash(struct task_struct *);
> void crash_save_cpu(struct pt_regs *regs, int cpu);
> void crash_save_vmcoreinfo(void);
> @@ -156,7 +157,6 @@ unsigned long paddr_vmcoreinfo_note(void
> #define VMCOREINFO_CONFIG(name) \
> vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
>
> -extern struct kimage *kexec_image;
> extern struct kimage *kexec_crash_image;
>
> #ifndef kexec_flush_icache_page
> @@ -214,6 +214,7 @@ void crash_free_reserved_phys_range(unsi
> struct pt_regs;
> struct task_struct;
> static inline void crash_kexec(struct pt_regs *regs) { }
> +static inline int kexec_is_loaded(void) { return 0; }
> static inline int kexec_should_crash(struct task_struct *p) { return 0; }
> #endif /* CONFIG_KEXEC */
> #endif /* LINUX_KEXEC_H */
> Index: linux-3.0/kernel/kexec.c
> ===================================================================
> --- linux-3.0.orig/kernel/kexec.c
> +++ linux-3.0/kernel/kexec.c
> @@ -934,7 +934,7 @@ static int kimage_load_segment(struct ki
> * kexec does not sync, or unmount filesystems so if you need
> * that to happen you need to do that yourself.
> */
> -struct kimage *kexec_image;
> +static struct kimage *kexec_image;
> struct kimage *kexec_crash_image;
>
> static DEFINE_MUTEX(kexec_mutex);
> @@ -1567,3 +1567,9 @@ int kernel_kexec(void)
> mutex_unlock(&kexec_mutex);
> return error;
> }
> +
> +int kexec_is_loaded(void)
> +{
> + return !!kexec_image;
> +}
> +EXPORT_SYMBOL_GPL(kexec_is_loaded);
Wouldn't this return true just if a kexec_image is loaded no matter if
this is a normal shutdown or if it is an actually kexec reboot?
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|