[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 7/7] xen/vm-events: move arch_domain.monitor bits to common
This patch moves bitfield members for single-step, software-breakpoint and guest-request monitor vm-events from the arch-side (arch_domain.monitor) to the common-side (domain.monitor). Ctrl-reg bits (i.e. write_ctrlreg_* members) are left on the arch-side, because control-registers number can vary across architectures. Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/vmx/vmcs.c | 4 ++-- xen/common/hvm/event.c | 12 ++++++------ xen/common/monitor.c | 17 +++++++---------- xen/include/asm-x86/domain.h | 16 ++++++---------- xen/include/xen/sched.h | 16 ++++++++++++++++ 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 5bc3c74..07acbf2 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1706,8 +1706,8 @@ void vmx_do_resume(struct vcpu *v) } debug_state = v->domain->debugger_attached - || v->domain->arch.monitor.software_breakpoint_enabled - || v->domain->arch.monitor.singlestep_enabled; + || v->domain->monitor.software_breakpoint_enabled + || v->domain->monitor.singlestep_enabled; if ( unlikely(v->arch.hvm_vcpu.debug_state_latch != debug_state) ) { diff --git a/xen/common/hvm/event.c b/xen/common/hvm/event.c index 0b532d5..0e5f30e 100644 --- a/xen/common/hvm/event.c +++ b/xen/common/hvm/event.c @@ -107,16 +107,16 @@ bool_t hvm_event_cr(unsigned int index, void hvm_event_guest_request(void) { struct vcpu *curr = current; - struct arch_domain *ad = &curr->domain->arch; + struct domain *d = curr->domain; - if ( ad->monitor.guest_request_enabled ) + if ( d->monitor.guest_request_enabled ) { vm_event_request_t req = { .reason = VM_EVENT_REASON_GUEST_REQUEST, .vcpu_id = curr->vcpu_id, }; - hvm_event_traps(curr, ad->monitor.guest_request_sync, &req); + hvm_event_traps(curr, d->monitor.guest_request_sync, &req); } } #endif // HAS_VM_EVENT_GUEST_REQUEST @@ -126,14 +126,14 @@ int hvm_event_breakpoint(unsigned long ip, enum hvm_event_breakpoint_type type) { struct vcpu *curr = current; - struct arch_domain *ad = &curr->domain->arch; + struct domain *d = curr->domain; vm_event_request_t req; switch ( type ) { #if CONFIG_HAS_VM_EVENT_SOFTWARE_BREAKPOINT case HVM_EVENT_SOFTWARE_BREAKPOINT: - if ( !ad->monitor.software_breakpoint_enabled ) + if ( !d->monitor.software_breakpoint_enabled ) return 0; req.reason = VM_EVENT_REASON_SOFTWARE_BREAKPOINT; req.u.software_breakpoint.gfn = arch_hvm_event_gfn_of_ip(ip); @@ -142,7 +142,7 @@ int hvm_event_breakpoint(unsigned long ip, #if CONFIG_HAS_VM_EVENT_SINGLESTEP case HVM_EVENT_SINGLESTEP_BREAKPOINT: - if ( !ad->monitor.singlestep_enabled ) + if ( !d->monitor.singlestep_enabled ) return 0; req.reason = VM_EVENT_REASON_SINGLESTEP; req.u.singlestep.gfn = arch_hvm_event_gfn_of_ip(ip); diff --git a/xen/common/monitor.c b/xen/common/monitor.c index 03063bb..3c69b5e 100644 --- a/xen/common/monitor.c +++ b/xen/common/monitor.c @@ -116,14 +116,13 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) #if CONFIG_HAS_VM_EVENT_SINGLESTEP case XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP: { - struct arch_domain *ad = &d->arch; - bool_t old_status = ad->monitor.singlestep_enabled; + bool_t old_status = d->monitor.singlestep_enabled; if ( unlikely(old_status == requested_status) ) return -EEXIST; domain_pause(d); - ad->monitor.singlestep_enabled = !old_status; + d->monitor.singlestep_enabled = !old_status; domain_unpause(d); break; } @@ -132,14 +131,13 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) #if CONFIG_HAS_VM_EVENT_SOFTWARE_BREAKPOINT case XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT: { - struct arch_domain *ad = &d->arch; - bool_t old_status = ad->monitor.software_breakpoint_enabled; + bool_t old_status = d->monitor.software_breakpoint_enabled; if ( unlikely(old_status == requested_status) ) return -EEXIST; domain_pause(d); - ad->monitor.software_breakpoint_enabled = !old_status; + d->monitor.software_breakpoint_enabled = !old_status; domain_unpause(d); break; } @@ -148,15 +146,14 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) #if CONFIG_HAS_VM_EVENT_GUEST_REQUEST case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST: { - struct arch_domain *ad = &d->arch; - bool_t old_status = ad->monitor.guest_request_enabled; + bool_t old_status = d->monitor.guest_request_enabled; if ( unlikely(old_status == requested_status) ) return -EEXIST; domain_pause(d); - ad->monitor.guest_request_sync = mop->u.guest_request.sync; - ad->monitor.guest_request_enabled = !old_status; + d->monitor.guest_request_sync = mop->u.guest_request.sync; + d->monitor.guest_request_enabled = !old_status; domain_unpause(d); break; } diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 4072e27..6254060 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -376,17 +376,13 @@ struct arch_domain unsigned long *pirq_eoi_map; unsigned long pirq_eoi_map_mfn; - /* Monitor options */ + /* Arch-specific monitor vm-event options */ struct { - unsigned int write_ctrlreg_enabled : 4; - unsigned int write_ctrlreg_sync : 4; - unsigned int write_ctrlreg_onchangeonly : 4; - unsigned int mov_to_msr_enabled : 1; - unsigned int mov_to_msr_extended : 1; - unsigned int singlestep_enabled : 1; - unsigned int software_breakpoint_enabled : 1; - unsigned int guest_request_enabled : 1; - unsigned int guest_request_sync : 1; + uint16_t write_ctrlreg_enabled : 4; + uint16_t write_ctrlreg_sync : 4; + uint16_t write_ctrlreg_onchangeonly : 4; + uint16_t mov_to_msr_enabled : 1; + uint16_t mov_to_msr_extended : 1; } monitor; /* Mem_access emulation control */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index b47a3fe..5b01a7f 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -464,6 +464,22 @@ struct domain /* vNUMA topology accesses are protected by rwlock. */ rwlock_t vnuma_rwlock; struct vnuma_info *vnuma; + + /* Common monitor vm-events options */ + struct { +#if CONFIG_HAS_VM_EVENT_SINGLESTEP + uint8_t singlestep_enabled : 1; +#endif // HAS_VM_EVENT_SINGLESTEP + +#if CONFIG_HAS_VM_EVENT_SOFTWARE_BREAKPOINT + uint8_t software_breakpoint_enabled : 1; +#endif // HAS_VM_EVENT_SOFTWARE_BREAKPOINT + +#if CONFIG_HAS_VM_EVENT_GUEST_REQUEST + uint8_t guest_request_enabled : 1; + uint8_t guest_request_sync : 1; +#endif // HAS_VM_EVENT_GUEST_REQUEST + } monitor; }; /* Protect updates/reads (resp.) of domain_list and domain_hash. */ -- 2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |