[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 13/16] x86/monitor: introduce writes_pending field in monitor_write_data
Introduce writes_pending field in monitor_write_data structure to slightly optimize code @ monitor_write_data(): avoid having to check each bit when -all- bits are zero (which is likely). Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx> --- xen/arch/x86/monitor.c | 3 +++ xen/include/asm-x86/domain.h | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c index c558f46..0763ed7 100644 --- a/xen/arch/x86/monitor.c +++ b/xen/arch/x86/monitor.c @@ -127,6 +127,9 @@ void monitor_ctrlreg_write_data(struct vcpu *v) { struct monitor_write_data *w = &v->arch.vm_event->write_data; + if ( likely(!w->writes_pending) ) + return; + if ( w->do_write.msr ) { hvm_msr_write_intercept(w->msr, w->value, 0); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 8f64ae9..ae1dcb4 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -260,12 +260,17 @@ struct pv_domain }; struct monitor_write_data { - struct { - unsigned int msr : 1; - unsigned int cr0 : 1; - unsigned int cr3 : 1; - unsigned int cr4 : 1; - } do_write; + union { + struct { + unsigned int msr : 1; + unsigned int cr0 : 1; + unsigned int cr3 : 1; + unsigned int cr4 : 1; + } do_write; + + /* Non-zero when at least one of do_write fields is 1. */ + unsigned int writes_pending; + }; uint32_t msr; uint64_t value; -- 2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |