# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 2e2611af05c62a45acf46f1a14891c29ba970108
# Parent f27205ea60ef4b47734e4a8b8177ca1c2b25fa5d
Update suspend/resume for new console code.
- translate console mfn to pfn
- unbind/bind console evtchn
- recover console mfn on restore
- trigger xenconsoled refresh after mfn is put in store
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r f27205ea60ef -r 2e2611af05c6
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Sep 3 16:58:50 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Sep 3 18:48:39 2005
@@ -95,6 +95,9 @@
void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt);
int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt);
#endif
+
+ extern void xencons_suspend(void);
+ extern void xencons_resume(void);
int err = 0;
@@ -169,6 +172,8 @@
smp_suspend();
#endif
+ xencons_suspend();
+
xenbus_suspend();
ctrl_if_suspend();
@@ -213,6 +218,8 @@
ctrl_if_resume();
xenbus_resume();
+
+ xencons_resume();
#ifdef CONFIG_SMP
smp_resume();
diff -r f27205ea60ef -r 2e2611af05c6
linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Sat Sep 3
16:58:50 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Sat Sep 3
18:48:39 2005
@@ -101,19 +101,17 @@
if (!xen_start_info.console_evtchn)
return 0;
- err = bind_evtchn_to_irqhandler(
- xen_start_info.console_evtchn, handle_input,
- 0, "xencons", inring());
+ err = bind_evtchn_to_irqhandler(xen_start_info.console_evtchn,
+ handle_input, 0, "xencons", inring());
if (err) {
xprintk("XEN console request irq failed %i\n", err);
- unbind_evtchn_from_irq(xen_start_info.console_evtchn);
return err;
}
return 0;
}
-void xencons_suspend_comms(void)
+void xencons_suspend(void)
{
if (!xen_start_info.console_evtchn)
@@ -122,3 +120,8 @@
unbind_evtchn_from_irqhandler(xen_start_info.console_evtchn, inring());
}
+void xencons_resume(void)
+{
+
+ (void)xencons_ring_init();
+}
diff -r f27205ea60ef -r 2e2611af05c6 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Sat Sep 3 16:58:50 2005
+++ b/tools/libxc/xc_linux_restore.c Sat Sep 3 18:48:39 2005
@@ -53,7 +53,8 @@
}
int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
- unsigned int store_evtchn, unsigned long *store_mfn)
+ unsigned int store_evtchn, unsigned long *store_mfn,
+ unsigned int console_evtchn, unsigned long *console_mfn)
{
dom0_op_t op;
int rc = 1, i, n, k;
@@ -486,6 +487,9 @@
*store_mfn = p_srec->resume_info.store_mfn =
pfn_to_mfn_table[p_srec->resume_info.store_mfn];
p_srec->resume_info.store_evtchn = store_evtchn;
+ *console_mfn = p_srec->resume_info.console_mfn =
+ pfn_to_mfn_table[p_srec->resume_info.console_mfn];
+ p_srec->resume_info.console_evtchn = console_evtchn;
munmap(p_srec, PAGE_SIZE);
/* Uncanonicalise each GDT frame number. */
diff -r f27205ea60ef -r 2e2611af05c6 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Sat Sep 3 16:58:50 2005
+++ b/tools/libxc/xc_linux_save.c Sat Sep 3 18:48:39 2005
@@ -686,6 +686,12 @@
goto out;
}
+ /* Canonicalize console mfn. */
+ if ( !translate_mfn_to_pfn(&p_srec->resume_info.console_mfn) ) {
+ ERR("Console frame is not in range of pseudophys map");
+ goto out;
+ }
+
print_stats( xc_handle, dom, 0, &stats, 0 );
/* Now write out each data page, canonicalising page tables as we go... */
diff -r f27205ea60ef -r 2e2611af05c6 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h Sat Sep 3 16:58:50 2005
+++ b/tools/libxc/xenguest.h Sat Sep 3 18:48:39 2005
@@ -37,7 +37,8 @@
*/
int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
unsigned long nr_pfns, unsigned int store_evtchn,
- unsigned long *store_mfn);
+ unsigned long *store_mfn, unsigned int console_evtchn,
+ unsigned long *console_mfn);
int xc_linux_build(int xc_handle,
uint32_t domid,
diff -r f27205ea60ef -r 2e2611af05c6 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Sat Sep 3 16:58:50 2005
+++ b/tools/python/xen/xend/XendCheckpoint.py Sat Sep 3 18:48:39 2005
@@ -127,12 +127,18 @@
"not a valid guest state file: pfn count out of range")
if dominfo.store_channel:
- evtchn = dominfo.store_channel.port2
+ store_evtchn = dominfo.store_channel.port2
else:
- evtchn = 0
+ store_evtchn = 0
+
+ if dominfo.console_channel:
+ console_evtchn = dominfo.console_channel.port2
+ else:
+ console_evtchn = 0
cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd),
- str(dominfo.id), str(nr_pfns), str(evtchn)]
+ str(dominfo.id), str(nr_pfns),
+ str(store_evtchn), str(console_evtchn)]
log.info("[xc_restore] " + join(cmd))
child = xPopen3(cmd, True, -1, [fd, xc.handle()])
child.tochild.close()
@@ -153,6 +159,7 @@
if fd == child.fromchild.fileno():
l = child.fromchild.readline()
while l:
+ log.info(l.rstrip())
m = re.match(r"^(store-mfn) (\d+)\n$", l)
if m:
if dominfo.store_channel:
@@ -162,7 +169,11 @@
dominfo.store_mfn,
dominfo.store_channel)
dominfo.exportToDB(save=True, sync=True)
- log.info(l.rstrip())
+ m = re.match(r"^(console-mfn) (\d+)\n$", l)
+ if m:
+ dominfo.console_mfn = int(m.group(2))
+ dominfo.exportToDB(save=True, sync=True)
+ dominfo.publish_console()
try:
l = child.fromchild.readline()
except:
diff -r f27205ea60ef -r 2e2611af05c6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Sat Sep 3 16:58:50 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py Sat Sep 3 18:48:39 2005
@@ -661,6 +661,7 @@
self.configure_restart()
self.construct_image()
self.configure()
+ self.publish_console()
self.exportToDB(save=True)
except Exception, ex:
# Catch errors, cleanup and re-raise.
@@ -1084,7 +1085,6 @@
self.configure_fields()
self.create_devices()
self.create_blkif()
- self.publish_console()
def create_blkif(self):
"""Create the block device interface (blkif) for the vm.
diff -r f27205ea60ef -r 2e2611af05c6 tools/xcutils/xc_restore.c
--- a/tools/xcutils/xc_restore.c Sat Sep 3 16:58:50 2005
+++ b/tools/xcutils/xc_restore.c Sat Sep 3 18:48:39 2005
@@ -17,22 +17,27 @@
int
main(int argc, char **argv)
{
- unsigned int xc_fd, io_fd, domid, nr_pfns, evtchn;
+ unsigned int xc_fd, io_fd, domid, nr_pfns, store_evtchn, console_evtchn;
int ret;
- unsigned long mfn;
+ unsigned long store_mfn, console_mfn;
- if (argc != 6)
- errx(1, "usage: %s xcfd iofd domid nr_pfns evtchn", argv[0]);
+ if (argc != 7)
+ errx(1,
+ "usage: %s xcfd iofd domid nr_pfns store_evtchn console_evtchn",
+ argv[0]);
xc_fd = atoi(argv[1]);
io_fd = atoi(argv[2]);
domid = atoi(argv[3]);
nr_pfns = atoi(argv[4]);
- evtchn = atoi(argv[5]);
+ store_evtchn = atoi(argv[5]);
+ console_evtchn = atoi(argv[6]);
- ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, evtchn, &mfn);
+ ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, store_evtchn,
+ &store_mfn, console_evtchn, &console_mfn);
if (ret == 0) {
- printf("store-mfn %li\n", mfn);
+ printf("store-mfn %li\n", store_mfn);
+ printf("console-mfn %li\n", console_mfn);
fflush(stdout);
}
return ret;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|