WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 01/11] kexec: add kexec_is_loaded function

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 01/11] kexec: add kexec_is_loaded function
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 29 Jul 2011 15:45:23 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 29 Jul 2011 07:40:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110728132300.620721927@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20110728132300.248098023@xxxxxxxxx> <20110728132300.620721927@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
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

<Prev in Thread] Current Thread [Next in Thread>