We've tried to shutdown and resume the domU kernel based on the code from xen-tools and reboot.c.
The DomU has been suspended and got the status "s" in xm list, but we can't resume it. Who can tell us how the HYPERVISOR_suspend and its parameter "srec" works on the suspend/shutdown procedure?

The code list here:

file: linux-ppc-2.6.hg/drivers/xen/core/reboot.c
static int __do_suspend(void *ignore)
{
.....
/*
* We'll stop somewhere inside this hypercall. When it returns,
* we'll start resuming after the restore.
*/
// HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
------------------------------>// We don't know what's this parameter for, so comment it out in the routine calls.
printk("HYPERVISOR_shutdown(SHUTDOWN_suspend)\n");
HYPERVISOR_shutdown(SHUTDOWN_suspend);
--------------------------------> Here the kernel suspended.
printk("SUSPEND!!?? restoring...\n");
shutting_down = SHUTDOWN_INVALID;
// set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
// HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
--------------------------------> Here to resume the kernel.
memset(empty_zero_page, 0, PAGE_SIZE);
gnttab_resume();
irq_resume();
// time_resume();
// switch_idle_mm();
// __sti();
xencons_resume();
xenbus_resume();
smp_resume();
return err;
}

file: xenppc-unstable.hg/tools/libxc/powerpc64/xc_ppc_linux_save.c
int
xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags, int (*suspend)(int))
{
.......

/* This is a non-live suspend. Issue the call back to get the
domain suspended */
---------------------------------------> call the suspend routine to halt the domU kernel.
if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info)) {
ERR("Domain appears not to have suspended");
goto out;
}

........
---------------------------------------> Here we expect to begin the resume procedure.
fprintf (stderr, "All memory is saved\n");
/* Success! */
rc = 0;


DPRINTF("Domain ready to be built.\n");

domctl.cmd = XEN_DOMCTL_setvcpucontext;
domctl.domain = (domid_t)dom;
domctl.u.vcpucontext.vcpu = 0;
set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
rc = xc_domctl(xc_handle, &domctl);

if (rc != 0) {
ERR("Couldn't build the domain");
goto out;
}

rc = 1;


out:
......
}

Best Regards,
Yi Ge, PhD
IBM China Research Lab
Tel: (86-10) 58748024
Fax: (86-10) 58748230
E-Mail : [EMAIL PROTECTED]
Notes Mail: Yi Ge/China/[EMAIL PROTECTED]

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


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to