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

[XenPPC][RFC/PATCH] DomU kernel update for Xen tools save & restore

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC][RFC/PATCH] DomU kernel update for Xen tools save & restore
From: Yi Ge <geyi@xxxxxxxxxx>
Date: Thu, 5 Oct 2006 17:50:21 -0400
Cc: Jimi Xenidis <jimix@xxxxxxxxxx>
Delivery-date: Thu, 05 Oct 2006 14:47:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx

This code has been tested under simple suspend & resume scenario:
The xc_save doesn't destroy the domain, and domU resume from the memory.

diff -r 933613959bf6 drivers/xen/core/reboot.c
--- a/drivers/xen/core/reboot.c Wed Oct 04 11:20:16 2006 -0400
+++ b/drivers/xen/core/reboot.c Thu Oct 05 16:11:06 2006 -0400
@@ -83,7 +83,6 @@ static void __shutdown_handler(void *unu
static void __shutdown_handler(void *unused);
static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);

-#ifndef CONFIG_PPC_XEN
/* Ensure we run on the idle task page tables so that we will
switch page tables before running user space. This is needed
on architectures with separate kernel and user page tables
@@ -105,21 +104,24 @@ static int __do_suspend(void *ignore)
{
int i, j, k, fpp, err;

+#ifndef CONFIG_PPC_XEN
extern unsigned long max_pfn;
extern unsigned long *pfn_to_mfn_frame_list_list;
extern unsigned long *pfn_to_mfn_frame_list[];

extern void time_resume(void);
-
+#endif
BUG_ON(smp_processor_id() != 0);
BUG_ON(in_interrupt());

+ printk("Entering do_suspend \n"); //DEBUG
+#ifndef CONFIG_PPC_XEN
if (xen_feature(XENFEAT_auto_translated_physmap)) {
printk(KERN_WARNING "Cannot suspend in "
"auto_translated_physmap mode.\n");
return -EOPNOTSUPP;
}
-
+#endif
err = smp_suspend();
if (err)
return err;
@@ -131,15 +133,18 @@ static int __do_suspend(void *ignore)
#ifdef __i386__
kmem_cache_shrink(pgd_cache);
#endif
+#ifndef CONFIG_PPC_XEN
mm_pin_all();
-
+#endif
__cli();
preempt_enable();

gnttab_suspend();

HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
+#ifndef CONFIG_PPC_XEN
clear_fixmap(FIX_SHARED_INFO);
+#endif

xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
@@ -151,13 +156,19 @@ static int __do_suspend(void *ignore)
HYPERVISOR_suspend(virt_to_mfn(xen_start_info));

shutting_down = SHUTDOWN_INVALID;
-
+
+ printk("Here we're resuming \n"); //DEBUG
+
+#ifndef CONFIG_PPC_XEN
set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);

HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
-
+#else
+ HYPERVISOR_shared_info = (shared_info_t *)__va(xen_start_info->shared_info);
+#endif
memset(empty_zero_page, 0, PAGE_SIZE);

+#ifndef CONFIG_PPC_XEN
HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
virt_to_mfn(pfn_to_mfn_frame_list_list);

@@ -173,13 +184,15 @@ static int __do_suspend(void *ignore)
virt_to_mfn(&phys_to_machine_mapping[i]);
}
HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
+#endif

gnttab_resume();

irq_resume();

+#ifndef CONFIG_PPC_XEN
time_resume();
-
+#endif
switch_idle_mm();

__sti();
@@ -192,13 +205,6 @@ static int __do_suspend(void *ignore)

return err;
}
-#else /* CONFIG_PPC_XEN */
-static int __do_suspend(void *ignore)
-{
- printk("SUSPEND!!??\n");
- return 0;
-}
-#endif /* CONFIG_PPC_XEN */

static int shutdown_process(void *__unused)
{
diff -r 933613959bf6 include/asm-powerpc/system.h
--- a/include/asm-powerpc/system.h Wed Oct 04 11:20:16 2006 -0400
+++ b/include/asm-powerpc/system.h Thu Oct 05 16:13:38 2006 -0400
@@ -433,5 +433,12 @@ extern void account_system_vtime(struct
extern void account_system_vtime(struct task_struct *);
#endif

+#ifndef __cli
+
+#define __cli() local_irq_disable()
+#define __sti() local_irq_enable()
+#endif /* __cli */
+
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SYSTEM_H */
diff -r 933613959bf6 include/asm-powerpc/xen/asm/hypercall.h
--- a/include/asm-powerpc/xen/asm/hypercall.h Wed Oct 04 11:20:16 2006 -0400
+++ b/include/asm-powerpc/xen/asm/hypercall.h Thu Oct 05 16:16:40 2006 -0400
@@ -60,6 +60,16 @@ static inline int HYPERVISOR_shutdown(un
return HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
}

+
+static inline int HYPERVISOR_suspend(unsigned long srec)
+{
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ return HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+}
+
static inline int HYPERVISOR_set_timer_op(unsigned long arg)
{
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_set_timer_op), arg);


Best Regards,
Yi Ge, PhD
IBM China Research Lab
Tel: (86-10) 58748024
Fax: (86-10) 58748230
E-Mail : geyi@xxxxxxxxxx
Notes Mail: Yi Ge/China/IBM@IBMCN

Building 19 Zhongguancun Software Park,
8 Dongbeiwang WestRoad, Haidian District,
Beijing,P.R.C.100094


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
<Prev in Thread] Current Thread [Next in Thread>