[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] mem_event: check capabilities only once
# HG changeset patch # User Olaf Hering <olaf@xxxxxxxxx> # Date 1320773602 -3600 # Node ID a7e49740fbfe3a4ec0a21186e2a4c579a30e0838 # Parent c681dd5aecf3da3c6fd0e4d8a760a9cd18617033 mem_event: check capabilities only once It is not required to check the system capabilities during every domctl. Rearrange the code to check them only once. Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> diff -r c681dd5aecf3 -r a7e49740fbfe xen/arch/x86/mm/mem_event.c --- a/xen/arch/x86/mm/mem_event.c +++ b/xen/arch/x86/mm/mem_event.c @@ -253,32 +253,35 @@ int mem_event_domctl(struct domain *d, x case XEN_DOMCTL_MEM_EVENT_OP_PAGING: { struct mem_event_domain *med = &d->mem_paging; - struct p2m_domain *p2m = p2m_get_hostp2m(d); - rc = -ENODEV; - /* Only HAP is supported */ - if ( !hap_enabled(d) ) - break; - - /* Currently only EPT is supported */ - if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) - break; - - rc = -EXDEV; - /* Disallow paging in a PoD guest */ - if ( p2m->pod.entry_count ) - break; + rc = -EINVAL; switch( mec->op ) { case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE: { + struct p2m_domain *p2m = p2m_get_hostp2m(d); + rc = -ENODEV; + /* Only HAP is supported */ + if ( !hap_enabled(d) ) + break; + + /* Currently only EPT is supported */ + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) + break; + + rc = -EXDEV; + /* Disallow paging in a PoD guest */ + if ( p2m->pod.entry_count ) + break; + rc = mem_event_enable(d, mec, med); } break; case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE: { - rc = mem_event_disable(med); + if ( med->ring_page ) + rc = mem_event_disable(med); } break; @@ -295,26 +298,29 @@ int mem_event_domctl(struct domain *d, x case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: { struct mem_event_domain *med = &d->mem_access; - rc = -ENODEV; - /* Only HAP is supported */ - if ( !hap_enabled(d) ) - break; - - /* Currently only EPT is supported */ - if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) - break; + rc = -EINVAL; switch( mec->op ) { case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE: { + rc = -ENODEV; + /* Only HAP is supported */ + if ( !hap_enabled(d) ) + break; + + /* Currently only EPT is supported */ + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) + break; + rc = mem_event_enable(d, mec, med); } break; case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE: { - rc = mem_event_disable(&d->mem_access); + if ( med->ring_page ) + rc = mem_event_disable(&d->mem_access); } break; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |