direct-io.hg
changeset 4503:08cf72b95611
bitkeeper revision 1.1277.1.1 (425a8650v0vw6cLK5BguR8GpBzOj-A)
Add domU restart capability.
Signed-off by: Dan Magenheimer (dan.magenheimer@hp.com)
Add domU restart capability.
Signed-off by: Dan Magenheimer (dan.magenheimer@hp.com)
author | djm@djmnc4000.(none) |
---|---|
date | Mon Apr 11 14:14:40 2005 +0000 (2005-04-11) |
parents | 0c8a248ff045 |
children | f1c946e1226a |
files | xen/arch/ia64/domain.c xen/arch/ia64/hypercall.c xen/arch/ia64/process.c xen/arch/ia64/xenmisc.c xen/include/asm-ia64/config.h xen/include/asm-ia64/domain.h |
line diff
1.1 --- a/xen/arch/ia64/domain.c Tue Apr 05 19:59:15 2005 +0000 1.2 +++ b/xen/arch/ia64/domain.c Mon Apr 11 14:14:40 2005 +0000 1.3 @@ -258,8 +258,8 @@ void new_thread(struct exec_domain *ed, 1.4 sw->ar_pfs = 0; 1.5 sw->ar_bspstore = new_rbs; 1.6 //regs->r13 = (unsigned long) ed; 1.7 -printf("new_thread: ed=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n", 1.8 -ed,regs,sw,new_rbs,IA64_STK_OFFSET,®s->r8); 1.9 +printf("new_thread: ed=%p, start_pc=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n", 1.10 +ed,start_pc,regs,sw,new_rbs,IA64_STK_OFFSET,®s->r8); 1.11 sw->b0 = (unsigned long) &ia64_ret_from_clone; 1.12 ed->thread.ksp = (unsigned long) sw - 16; 1.13 //ed->thread_info->flags = 0; 1.14 @@ -428,6 +428,7 @@ void loaddomainelfimage(struct domain *d 1.15 int h, filesz, memsz, paddr; 1.16 unsigned long elfaddr, dom_mpaddr, dom_imva; 1.17 struct page *p; 1.18 + unsigned long pteval; 1.19 1.20 copy_memory(&ehdr,image_start,sizeof(Elf_Ehdr)); 1.21 for ( h = 0; h < ehdr.e_phnum; h++ ) { 1.22 @@ -456,9 +457,15 @@ void loaddomainelfimage(struct domain *d 1.23 else 1.24 #endif 1.25 while (memsz > 0) { 1.26 +#ifdef DOMU_AUTO_RESTART 1.27 + pteval = lookup_domain_mpa(d,dom_mpaddr); 1.28 + if (pteval) dom_imva = __va(pteval & _PFN_MASK); 1.29 + else { printf("loaddomainelfimage: BAD!\n"); while(1); } 1.30 +#else 1.31 p = map_new_domain_page(d,dom_mpaddr); 1.32 if (unlikely(!p)) BUG(); 1.33 dom_imva = __va(page_to_phys(p)); 1.34 +#endif 1.35 if (filesz > 0) { 1.36 if (filesz >= PAGE_SIZE) 1.37 copy_memory(dom_imva,elfaddr,PAGE_SIZE); 1.38 @@ -774,7 +781,9 @@ int construct_domU(struct domain *d, 1.39 struct exec_domain *ed = d->exec_domain[0]; 1.40 unsigned long pkern_entry; 1.41 1.42 +#ifndef DOMU_AUTO_RESTART 1.43 if ( test_bit(DF_CONSTRUCTED, &d->d_flags) ) BUG(); 1.44 +#endif 1.45 1.46 printk("*** LOADING DOMAIN %d ***\n",d->id); 1.47 1.48 @@ -808,7 +817,12 @@ int construct_domU(struct domain *d, 1.49 1.50 set_bit(DF_CONSTRUCTED, &d->d_flags); 1.51 1.52 - printk("calling new_thread\n"); 1.53 + printk("calling new_thread, entry=%p\n",pkern_entry); 1.54 +#ifdef DOMU_AUTO_RESTART 1.55 + ed->domain->arch.image_start = image_start; 1.56 + ed->domain->arch.image_len = image_len; 1.57 + ed->domain->arch.entry = pkern_entry; 1.58 +#endif 1.59 new_thread(ed, pkern_entry, 0, 0); 1.60 printk("new_thread returns\n"); 1.61 __set_bit(0x30,ed->vcpu_info->arch.delivery_mask); 1.62 @@ -816,6 +830,17 @@ int construct_domU(struct domain *d, 1.63 return 0; 1.64 } 1.65 1.66 +#ifdef DOMU_AUTO_RESTART 1.67 +void reconstruct_domU(struct exec_domain *ed) 1.68 +{ 1.69 + /* re-copy the OS image to reset data values to original */ 1.70 + printk("reconstruct_domU: restarting domain %d...\n", 1.71 + ed->domain->id); 1.72 + loaddomainelfimage(ed->domain,ed->domain->arch.image_start); 1.73 + new_thread(ed, ed->domain->arch.entry, 0, 0); 1.74 +} 1.75 +#endif 1.76 + 1.77 // FIXME: When dom0 can construct domains, this goes away (or is rewritten) 1.78 int launch_domainU(unsigned long size) 1.79 {
2.1 --- a/xen/arch/ia64/hypercall.c Tue Apr 05 19:59:15 2005 +0000 2.2 +++ b/xen/arch/ia64/hypercall.c Mon Apr 11 14:14:40 2005 +0000 2.3 @@ -21,7 +21,7 @@ extern struct ia64_sal_retval sal_emulat 2.4 2.5 void fooefi(void) {} 2.6 2.7 -void 2.8 +int 2.9 ia64_hypercall (struct pt_regs *regs) 2.10 { 2.11 struct exec_domain *ed = (struct domain *) current; 2.12 @@ -50,8 +50,15 @@ ia64_hypercall (struct pt_regs *regs) 2.13 printf("(by dom0)\n "); 2.14 (*efi.reset_system)(EFI_RESET_WARM,0,0,NULL); 2.15 } 2.16 +#ifdef DOMU_AUTO_RESTART 2.17 + else { 2.18 + reconstruct_domU(current); 2.19 + return 0; // don't increment ip! 2.20 + } 2.21 +#else 2.22 printf("(not supported for non-0 domain)\n"); 2.23 regs->r8 = EFI_UNSUPPORTED; 2.24 +#endif 2.25 break; 2.26 case FW_HYPERCALL_EFI_GET_TIME: 2.27 fooefi(); 2.28 @@ -105,4 +112,5 @@ ia64_hypercall (struct pt_regs *regs) 2.29 regs->r8 = domU_staging_read_8(vcpu_get_gr(ed,32)); 2.30 break; 2.31 } 2.32 + return 1; 2.33 }
3.1 --- a/xen/arch/ia64/process.c Tue Apr 05 19:59:15 2005 +0000 3.2 +++ b/xen/arch/ia64/process.c Mon Apr 11 14:14:40 2005 +0000 3.3 @@ -714,8 +714,8 @@ ia64_handle_break (unsigned long ifa, st 3.4 else do_ssc(vcpu_get_gr(current,36), regs); 3.5 } 3.6 else if (iim == d->breakimm) { 3.7 - ia64_hypercall(regs); 3.8 - vcpu_increment_iip(current); 3.9 + if (ia64_hypercall(regs)) 3.10 + vcpu_increment_iip(current); 3.11 } 3.12 else reflect_interruption(ifa,isr,iim,regs,IA64_BREAK_VECTOR); 3.13 }
4.1 --- a/xen/arch/ia64/xenmisc.c Tue Apr 05 19:59:15 2005 +0000 4.2 +++ b/xen/arch/ia64/xenmisc.c Mon Apr 11 14:14:40 2005 +0000 4.3 @@ -276,6 +276,7 @@ void panic_domain(struct pt_regs *regs, 4.4 extern spinlock_t console_lock; 4.5 unsigned long flags; 4.6 4.7 +loop: 4.8 printf("$$$$$ PANIC in domain %d (k6=%p): ", 4.9 ed->domain->id, ia64_get_kr(IA64_KR_CURRENT)); 4.10 va_start(args, fmt); 4.11 @@ -285,5 +286,11 @@ void panic_domain(struct pt_regs *regs, 4.12 if (regs) show_registers(regs); 4.13 domain_pause_by_systemcontroller(current->domain); 4.14 set_bit(DF_CRASHED, ed->domain->d_flags); 4.15 - //while(test); 4.16 + if (ed->domain->id == 0) { 4.17 + int i = 1000000000L; 4.18 + // if domain0 crashes, just periodically print out panic 4.19 + // message to make post-mortem easier 4.20 + while(i--); 4.21 + goto loop; 4.22 + } 4.23 }
5.1 --- a/xen/include/asm-ia64/config.h Tue Apr 05 19:59:15 2005 +0000 5.2 +++ b/xen/include/asm-ia64/config.h Mon Apr 11 14:14:40 2005 +0000 5.3 @@ -1,8 +1,9 @@ 5.4 // control flags for turning on/off features under test 5.5 #undef CLONE_DOMAIN0 5.6 -//#define CLONE_DOMAIN0 5 5.7 +//#define CLONE_DOMAIN0 1 5.8 #define DOMU_BUILD_STAGING 5.9 #define VHPT_GLOBAL 5.10 +#define DOMU_AUTO_RESTART 5.11 5.12 // manufactured from component pieces 5.13
6.1 --- a/xen/include/asm-ia64/domain.h Tue Apr 05 19:59:15 2005 +0000 6.2 +++ b/xen/include/asm-ia64/domain.h Mon Apr 11 14:14:40 2005 +0000 6.3 @@ -21,6 +21,11 @@ struct arch_domain { 6.4 u64 xen_vastart; 6.5 u64 xen_vaend; 6.6 u64 shared_info_va; 6.7 +#ifdef DOMU_AUTO_RESTART 6.8 + u64 image_start; 6.9 + u64 image_len; 6.10 + u64 entry; 6.11 +#endif 6.12 }; 6.13 #define metaphysical_rid arch.metaphysical_rid 6.14 #define starting_rid arch.starting_rid