debuggers.hg
changeset 6646:2e2611af05c6
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@cl.cam.ac.uk>
- 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@cl.cam.ac.uk>
author | cl349@firebug.cl.cam.ac.uk |
---|---|
date | Sat Sep 03 18:48:39 2005 +0000 (2005-09-03) |
parents | f27205ea60ef |
children | b6c98fe62e1a |
files | linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xenguest.h tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomainInfo.py tools/xcutils/xc_restore.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Sep 03 16:58:50 2005 +0000 1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Sep 03 18:48:39 2005 +0000 1.3 @@ -96,6 +96,9 @@ static int __do_suspend(void *ignore) 1.4 int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt); 1.5 #endif 1.6 1.7 + extern void xencons_suspend(void); 1.8 + extern void xencons_resume(void); 1.9 + 1.10 int err = 0; 1.11 1.12 BUG_ON(smp_processor_id() != 0); 1.13 @@ -169,6 +172,8 @@ static int __do_suspend(void *ignore) 1.14 smp_suspend(); 1.15 #endif 1.16 1.17 + xencons_suspend(); 1.18 + 1.19 xenbus_suspend(); 1.20 1.21 ctrl_if_suspend(); 1.22 @@ -214,6 +219,8 @@ static int __do_suspend(void *ignore) 1.23 1.24 xenbus_resume(); 1.25 1.26 + xencons_resume(); 1.27 + 1.28 #ifdef CONFIG_SMP 1.29 smp_resume(); 1.30 #endif
2.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Sat Sep 03 16:58:50 2005 +0000 2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Sat Sep 03 18:48:39 2005 +0000 2.3 @@ -101,19 +101,17 @@ int xencons_ring_init(void) 2.4 if (!xen_start_info.console_evtchn) 2.5 return 0; 2.6 2.7 - err = bind_evtchn_to_irqhandler( 2.8 - xen_start_info.console_evtchn, handle_input, 2.9 - 0, "xencons", inring()); 2.10 + err = bind_evtchn_to_irqhandler(xen_start_info.console_evtchn, 2.11 + handle_input, 0, "xencons", inring()); 2.12 if (err) { 2.13 xprintk("XEN console request irq failed %i\n", err); 2.14 - unbind_evtchn_from_irq(xen_start_info.console_evtchn); 2.15 return err; 2.16 } 2.17 2.18 return 0; 2.19 } 2.20 2.21 -void xencons_suspend_comms(void) 2.22 +void xencons_suspend(void) 2.23 { 2.24 2.25 if (!xen_start_info.console_evtchn) 2.26 @@ -122,3 +120,8 @@ void xencons_suspend_comms(void) 2.27 unbind_evtchn_from_irqhandler(xen_start_info.console_evtchn, inring()); 2.28 } 2.29 2.30 +void xencons_resume(void) 2.31 +{ 2.32 + 2.33 + (void)xencons_ring_init(); 2.34 +}
3.1 --- a/tools/libxc/xc_linux_restore.c Sat Sep 03 16:58:50 2005 +0000 3.2 +++ b/tools/libxc/xc_linux_restore.c Sat Sep 03 18:48:39 2005 +0000 3.3 @@ -53,7 +53,8 @@ read_exact(int fd, void *buf, size_t cou 3.4 } 3.5 3.6 int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, 3.7 - unsigned int store_evtchn, unsigned long *store_mfn) 3.8 + unsigned int store_evtchn, unsigned long *store_mfn, 3.9 + unsigned int console_evtchn, unsigned long *console_mfn) 3.10 { 3.11 dom0_op_t op; 3.12 int rc = 1, i, n, k; 3.13 @@ -486,6 +487,9 @@ int xc_linux_restore(int xc_handle, int 3.14 *store_mfn = p_srec->resume_info.store_mfn = 3.15 pfn_to_mfn_table[p_srec->resume_info.store_mfn]; 3.16 p_srec->resume_info.store_evtchn = store_evtchn; 3.17 + *console_mfn = p_srec->resume_info.console_mfn = 3.18 + pfn_to_mfn_table[p_srec->resume_info.console_mfn]; 3.19 + p_srec->resume_info.console_evtchn = console_evtchn; 3.20 munmap(p_srec, PAGE_SIZE); 3.21 3.22 /* Uncanonicalise each GDT frame number. */
4.1 --- a/tools/libxc/xc_linux_save.c Sat Sep 03 16:58:50 2005 +0000 4.2 +++ b/tools/libxc/xc_linux_save.c Sat Sep 03 18:48:39 2005 +0000 4.3 @@ -686,6 +686,12 @@ int xc_linux_save(int xc_handle, int io_ 4.4 goto out; 4.5 } 4.6 4.7 + /* Canonicalize console mfn. */ 4.8 + if ( !translate_mfn_to_pfn(&p_srec->resume_info.console_mfn) ) { 4.9 + ERR("Console frame is not in range of pseudophys map"); 4.10 + goto out; 4.11 + } 4.12 + 4.13 print_stats( xc_handle, dom, 0, &stats, 0 ); 4.14 4.15 /* Now write out each data page, canonicalising page tables as we go... */
5.1 --- a/tools/libxc/xenguest.h Sat Sep 03 16:58:50 2005 +0000 5.2 +++ b/tools/libxc/xenguest.h Sat Sep 03 18:48:39 2005 +0000 5.3 @@ -37,7 +37,8 @@ int xc_linux_save(int xc_handle, int fd, 5.4 */ 5.5 int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, 5.6 unsigned long nr_pfns, unsigned int store_evtchn, 5.7 - unsigned long *store_mfn); 5.8 + unsigned long *store_mfn, unsigned int console_evtchn, 5.9 + unsigned long *console_mfn); 5.10 5.11 int xc_linux_build(int xc_handle, 5.12 uint32_t domid,
6.1 --- a/tools/python/xen/xend/XendCheckpoint.py Sat Sep 03 16:58:50 2005 +0000 6.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Sat Sep 03 18:48:39 2005 +0000 6.3 @@ -127,12 +127,18 @@ def restore(xd, fd): 6.4 "not a valid guest state file: pfn count out of range") 6.5 6.6 if dominfo.store_channel: 6.7 - evtchn = dominfo.store_channel.port2 6.8 + store_evtchn = dominfo.store_channel.port2 6.9 else: 6.10 - evtchn = 0 6.11 + store_evtchn = 0 6.12 + 6.13 + if dominfo.console_channel: 6.14 + console_evtchn = dominfo.console_channel.port2 6.15 + else: 6.16 + console_evtchn = 0 6.17 6.18 cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd), 6.19 - str(dominfo.id), str(nr_pfns), str(evtchn)] 6.20 + str(dominfo.id), str(nr_pfns), 6.21 + str(store_evtchn), str(console_evtchn)] 6.22 log.info("[xc_restore] " + join(cmd)) 6.23 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 6.24 child.tochild.close() 6.25 @@ -153,6 +159,7 @@ def restore(xd, fd): 6.26 if fd == child.fromchild.fileno(): 6.27 l = child.fromchild.readline() 6.28 while l: 6.29 + log.info(l.rstrip()) 6.30 m = re.match(r"^(store-mfn) (\d+)\n$", l) 6.31 if m: 6.32 if dominfo.store_channel: 6.33 @@ -162,7 +169,11 @@ def restore(xd, fd): 6.34 dominfo.store_mfn, 6.35 dominfo.store_channel) 6.36 dominfo.exportToDB(save=True, sync=True) 6.37 - log.info(l.rstrip()) 6.38 + m = re.match(r"^(console-mfn) (\d+)\n$", l) 6.39 + if m: 6.40 + dominfo.console_mfn = int(m.group(2)) 6.41 + dominfo.exportToDB(save=True, sync=True) 6.42 + dominfo.publish_console() 6.43 try: 6.44 l = child.fromchild.readline() 6.45 except:
7.1 --- a/tools/python/xen/xend/XendDomainInfo.py Sat Sep 03 16:58:50 2005 +0000 7.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Sat Sep 03 18:48:39 2005 +0000 7.3 @@ -661,6 +661,7 @@ class XendDomainInfo: 7.4 self.configure_restart() 7.5 self.construct_image() 7.6 self.configure() 7.7 + self.publish_console() 7.8 self.exportToDB(save=True) 7.9 except Exception, ex: 7.10 # Catch errors, cleanup and re-raise. 7.11 @@ -1084,7 +1085,6 @@ class XendDomainInfo: 7.12 self.configure_fields() 7.13 self.create_devices() 7.14 self.create_blkif() 7.15 - self.publish_console() 7.16 7.17 def create_blkif(self): 7.18 """Create the block device interface (blkif) for the vm.
8.1 --- a/tools/xcutils/xc_restore.c Sat Sep 03 16:58:50 2005 +0000 8.2 +++ b/tools/xcutils/xc_restore.c Sat Sep 03 18:48:39 2005 +0000 8.3 @@ -17,22 +17,27 @@ 8.4 int 8.5 main(int argc, char **argv) 8.6 { 8.7 - unsigned int xc_fd, io_fd, domid, nr_pfns, evtchn; 8.8 + unsigned int xc_fd, io_fd, domid, nr_pfns, store_evtchn, console_evtchn; 8.9 int ret; 8.10 - unsigned long mfn; 8.11 + unsigned long store_mfn, console_mfn; 8.12 8.13 - if (argc != 6) 8.14 - errx(1, "usage: %s xcfd iofd domid nr_pfns evtchn", argv[0]); 8.15 + if (argc != 7) 8.16 + errx(1, 8.17 + "usage: %s xcfd iofd domid nr_pfns store_evtchn console_evtchn", 8.18 + argv[0]); 8.19 8.20 xc_fd = atoi(argv[1]); 8.21 io_fd = atoi(argv[2]); 8.22 domid = atoi(argv[3]); 8.23 nr_pfns = atoi(argv[4]); 8.24 - evtchn = atoi(argv[5]); 8.25 + store_evtchn = atoi(argv[5]); 8.26 + console_evtchn = atoi(argv[6]); 8.27 8.28 - ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, evtchn, &mfn); 8.29 + ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, store_evtchn, 8.30 + &store_mfn, console_evtchn, &console_mfn); 8.31 if (ret == 0) { 8.32 - printf("store-mfn %li\n", mfn); 8.33 + printf("store-mfn %li\n", store_mfn); 8.34 + printf("console-mfn %li\n", console_mfn); 8.35 fflush(stdout); 8.36 } 8.37 return ret;