debuggers.hg
changeset 14616:7eff43986c3a
Merge
author | Tom Wilkie <tom.wilkie@gmail.com> |
---|---|
date | Tue Mar 27 14:02:17 2007 +0100 (2007-03-27) |
parents | c815f6553816 79449efbdd80 |
children | e43a9c52c843 |
files |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Tue Mar 27 13:45:30 2007 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Tue Mar 27 14:02:17 2007 +0100 1.3 @@ -123,7 +123,7 @@ static void post_suspend(int suspend_can 1.4 static int take_machine_down(void *p_fast_suspend) 1.5 { 1.6 int fast_suspend = *(int *)p_fast_suspend; 1.7 - int suspend_cancelled, err, cpu; 1.8 + int suspend_cancelled, err; 1.9 extern void time_resume(void); 1.10 1.11 if (fast_suspend) {
2.1 --- a/xen/acm/acm_policy.c Tue Mar 27 13:45:30 2007 +0100 2.2 +++ b/xen/acm/acm_policy.c Tue Mar 27 14:02:17 2007 +0100 2.3 @@ -62,6 +62,7 @@ int 2.4 do_acm_set_policy(void *buf, u32 buf_size) 2.5 { 2.6 struct acm_policy_buffer *pol = (struct acm_policy_buffer *)buf; 2.7 + uint32_t offset, length; 2.8 /* some sanity checking */ 2.9 if ((be32_to_cpu(pol->magic) != ACM_MAGIC) || 2.10 (buf_size != be32_to_cpu(pol->len)) || 2.11 @@ -92,22 +93,27 @@ do_acm_set_policy(void *buf, u32 buf_siz 2.12 /* get bin_policy lock and rewrite policy (release old one) */ 2.13 write_lock(&acm_bin_pol_rwlock); 2.14 2.15 + offset = be32_to_cpu(pol->policy_reference_offset); 2.16 + length = be32_to_cpu(pol->primary_buffer_offset) - offset; 2.17 + 2.18 /* set label reference name */ 2.19 - if (acm_set_policy_reference(buf + be32_to_cpu(pol->policy_reference_offset), 2.20 - be32_to_cpu(pol->primary_buffer_offset) - 2.21 - be32_to_cpu(pol->policy_reference_offset))) 2.22 + if ( (offset + length) > buf_size || 2.23 + acm_set_policy_reference(buf + offset, length)) 2.24 goto error_lock_free; 2.25 2.26 /* set primary policy data */ 2.27 - if (acm_primary_ops->set_binary_policy(buf + be32_to_cpu(pol->primary_buffer_offset), 2.28 - be32_to_cpu(pol->secondary_buffer_offset) - 2.29 - be32_to_cpu(pol->primary_buffer_offset))) 2.30 + offset = be32_to_cpu(pol->primary_buffer_offset); 2.31 + length = be32_to_cpu(pol->secondary_buffer_offset) - offset; 2.32 + 2.33 + if ( (offset + length) > buf_size || 2.34 + acm_primary_ops->set_binary_policy(buf + offset, length)) 2.35 goto error_lock_free; 2.36 2.37 /* set secondary policy data */ 2.38 - if (acm_secondary_ops->set_binary_policy(buf + be32_to_cpu(pol->secondary_buffer_offset), 2.39 - be32_to_cpu(pol->len) - 2.40 - be32_to_cpu(pol->secondary_buffer_offset))) 2.41 + offset = be32_to_cpu(pol->secondary_buffer_offset); 2.42 + length = be32_to_cpu(pol->len) - offset; 2.43 + if ( (offset + length) > buf_size || 2.44 + acm_secondary_ops->set_binary_policy(buf + offset, length)) 2.45 goto error_lock_free; 2.46 2.47 write_unlock(&acm_bin_pol_rwlock);
3.1 --- a/xen/arch/x86/hvm/svm/svm.c Tue Mar 27 13:45:30 2007 +0100 3.2 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Mar 27 14:02:17 2007 +0100 3.3 @@ -64,8 +64,8 @@ extern void svm_dump_inst(unsigned long 3.4 extern int svm_dbg_on; 3.5 void svm_dump_regs(const char *from, struct cpu_user_regs *regs); 3.6 3.7 -static int svm_do_vmmcall_reset_to_realmode(struct vcpu *v, 3.8 - struct cpu_user_regs *regs); 3.9 +static int svm_reset_to_realmode(struct vcpu *v, 3.10 + struct cpu_user_regs *regs); 3.11 3.12 /* va of hardware host save area */ 3.13 static void *hsa[NR_CPUS] __read_mostly; 3.14 @@ -749,19 +749,21 @@ static void svm_init_ap_context( 3.15 struct vcpu_guest_context *ctxt, int vcpuid, int trampoline_vector) 3.16 { 3.17 struct vcpu *v; 3.18 + struct vmcb_struct *vmcb; 3.19 cpu_user_regs_t *regs; 3.20 u16 cs_sel; 3.21 3.22 /* We know this is safe because hvm_bringup_ap() does it */ 3.23 v = current->domain->vcpu[vcpuid]; 3.24 + vmcb = v->arch.hvm_svm.vmcb; 3.25 regs = &v->arch.guest_context.user_regs; 3.26 3.27 memset(ctxt, 0, sizeof(*ctxt)); 3.28 3.29 /* 3.30 * We execute the trampoline code in real mode. The trampoline vector 3.31 - * passed to us is page alligned and is the physicall frame number for 3.32 - * the code. We will execute this code in real mode. 3.33 + * passed to us is page alligned and is the physical frame number for 3.34 + * the code. We will execute this code in real mode. 3.35 */ 3.36 cs_sel = trampoline_vector << 8; 3.37 ctxt->user_regs.eip = 0x0; 3.38 @@ -771,11 +773,11 @@ static void svm_init_ap_context( 3.39 * This is the launch of an AP; set state so that we begin executing 3.40 * the trampoline code in real-mode. 3.41 */ 3.42 - svm_do_vmmcall_reset_to_realmode(v, regs); 3.43 + svm_reset_to_realmode(v, regs); 3.44 /* Adjust the vmcb's hidden register state. */ 3.45 - v->arch.hvm_svm.vmcb->rip = 0; 3.46 - v->arch.hvm_svm.vmcb->cs.sel = cs_sel; 3.47 - v->arch.hvm_svm.vmcb->cs.base = (cs_sel << 4); 3.48 + vmcb->rip = 0; 3.49 + vmcb->cs.sel = cs_sel; 3.50 + vmcb->cs.base = (cs_sel << 4); 3.51 } 3.52 3.53 static void svm_init_hypercall_page(struct domain *d, void *hypercall_page) 3.54 @@ -2494,8 +2496,8 @@ void svm_handle_invlpg(const short invlp 3.55 * 3.56 * returns 0 on success, non-zero otherwise 3.57 */ 3.58 -static int svm_do_vmmcall_reset_to_realmode(struct vcpu *v, 3.59 - struct cpu_user_regs *regs) 3.60 +static int svm_reset_to_realmode(struct vcpu *v, 3.61 + struct cpu_user_regs *regs) 3.62 { 3.63 struct vmcb_struct *vmcb; 3.64
4.1 --- a/xen/arch/x86/time.c Tue Mar 27 13:45:30 2007 +0100 4.2 +++ b/xen/arch/x86/time.c Tue Mar 27 14:02:17 2007 +0100 4.3 @@ -670,14 +670,20 @@ static inline void version_update_end(u3 4.4 (*version)++; 4.5 } 4.6 4.7 -static inline void __update_vcpu_system_time(struct vcpu *v) 4.8 +void update_vcpu_system_time(struct vcpu *v) 4.9 { 4.10 struct cpu_time *t; 4.11 struct vcpu_time_info *u; 4.12 4.13 + if ( v->vcpu_info == NULL ) 4.14 + return; 4.15 + 4.16 t = &this_cpu(cpu_time); 4.17 u = &vcpu_info(v, time); 4.18 4.19 + if ( u->tsc_timestamp == t->local_tsc_stamp ) 4.20 + return; 4.21 + 4.22 version_update_begin(&u->version); 4.23 4.24 u->tsc_timestamp = t->local_tsc_stamp; 4.25 @@ -688,13 +694,6 @@ static inline void __update_vcpu_system_ 4.26 version_update_end(&u->version); 4.27 } 4.28 4.29 -void update_vcpu_system_time(struct vcpu *v) 4.30 -{ 4.31 - if ( vcpu_info(v, time.tsc_timestamp) != 4.32 - this_cpu(cpu_time).local_tsc_stamp ) 4.33 - __update_vcpu_system_time(v); 4.34 -} 4.35 - 4.36 void update_domain_wallclock_time(struct domain *d) 4.37 { 4.38 spin_lock(&wc_lock); 4.39 @@ -771,9 +770,10 @@ static void local_time_calibration(void 4.40 local_irq_enable(); 4.41 4.42 #if 0 4.43 - printk("PRE%d: tsc=%lld stime=%lld master=%lld\n", 4.44 + printk("PRE%d: tsc=%"PRIu64" stime=%"PRIu64" master=%"PRIu64"\n", 4.45 smp_processor_id(), prev_tsc, prev_local_stime, prev_master_stime); 4.46 - printk("CUR%d: tsc=%lld stime=%lld master=%lld -> %lld\n", 4.47 + printk("CUR%d: tsc=%"PRIu64" stime=%"PRIu64" master=%"PRIu64 4.48 + " -> %"PRId64"\n", 4.49 smp_processor_id(), curr_tsc, curr_local_stime, curr_master_stime, 4.50 curr_master_stime - curr_local_stime); 4.51 #endif 4.52 @@ -855,6 +855,8 @@ static void local_time_calibration(void 4.53 t->stime_local_stamp = curr_local_stime; 4.54 t->stime_master_stamp = curr_master_stime; 4.55 4.56 + update_vcpu_system_time(current); 4.57 + 4.58 out: 4.59 set_timer(&t->calibration_timer, NOW() + EPOCH); 4.60
5.1 --- a/xen/common/domain.c Tue Mar 27 13:45:30 2007 +0100 5.2 +++ b/xen/common/domain.c Tue Mar 27 14:02:17 2007 +0100 5.3 @@ -96,14 +96,16 @@ struct vcpu *alloc_vcpu( 5.4 5.5 v->domain = d; 5.6 v->vcpu_id = vcpu_id; 5.7 - v->vcpu_info = shared_info_addr(d, vcpu_info[vcpu_id]); 5.8 spin_lock_init(&v->pause_lock); 5.9 5.10 v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline; 5.11 v->runstate.state_entry_time = NOW(); 5.12 5.13 if ( !is_idle_domain(d) ) 5.14 + { 5.15 set_bit(_VCPUF_down, &v->vcpu_flags); 5.16 + v->vcpu_info = shared_info_addr(d, vcpu_info[vcpu_id]); 5.17 + } 5.18 5.19 if ( sched_init_vcpu(v, cpu_id) != 0 ) 5.20 {
6.1 --- a/xen/common/schedule.c Tue Mar 27 13:45:30 2007 +0100 6.2 +++ b/xen/common/schedule.c Tue Mar 27 14:02:17 2007 +0100 6.3 @@ -659,11 +659,8 @@ static void schedule(void) 6.4 stop_timer(&prev->periodic_timer); 6.5 6.6 /* Ensure that the domain has an up-to-date time base. */ 6.7 - if ( !is_idle_vcpu(next) ) 6.8 - { 6.9 - update_vcpu_system_time(next); 6.10 - vcpu_periodic_timer_work(next); 6.11 - } 6.12 + update_vcpu_system_time(next); 6.13 + vcpu_periodic_timer_work(next); 6.14 6.15 TRACE_4D(TRC_SCHED_SWITCH, 6.16 prev->domain->domain_id, prev->vcpu_id,