[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v15 14/14] x86/domctl: Don't pause the whole domain if only getting vcpu state
This patch is focused on moving changing hvm_save_one() to save one typecode from one vcpu and now that the save functions get data from a single vcpu we can pause the specific vcpu instead of the domain. Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx> --- xen/arch/x86/domctl.c | 4 ++-- xen/arch/x86/hvm/save.c | 41 +++++++++++++++++------------------------ 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 8fbbf3a..bd6ba62 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -591,12 +591,12 @@ long arch_do_domctl( !is_hvm_domain(d) ) break; - domain_pause(d); + vcpu_pause(d->vcpu[domctl->u.hvmcontext_partial.instance]); ret = hvm_save_one(d, domctl->u.hvmcontext_partial.type, domctl->u.hvmcontext_partial.instance, domctl->u.hvmcontext_partial.buffer, &domctl->u.hvmcontext_partial.bufsz); - domain_unpause(d); + vcpu_unpause(d->vcpu[domctl->u.hvmcontext_partial.instance]); if ( !ret ) copyback = true; diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c index 43eb582..28f3b57 100644 --- a/xen/arch/x86/hvm/save.c +++ b/xen/arch/x86/hvm/save.c @@ -138,6 +138,7 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance, int rv; hvm_domain_context_t ctxt = { }; const struct hvm_save_descriptor *desc; + uint32_t off = 0; if ( d->is_dying || typecode > HVM_SAVE_CODE_MAX || @@ -146,8 +147,6 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance, return -EINVAL; ctxt.size = hvm_sr_handlers[typecode].size; - if ( hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ) - ctxt.size *= d->max_vcpus; ctxt.data = xmalloc_bytes(ctxt.size); if ( !ctxt.data ) return -ENOMEM; @@ -157,29 +156,23 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance, d->domain_id, typecode, rv); else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) ) { - uint32_t off; - - for ( off = 0; off <= (ctxt.cur - sizeof(*desc)); off += desc->length ) + desc = (void *)(ctxt.data + off); + /* Move past header */ + off += sizeof(*desc); + if ( ctxt.cur < desc->length || + off > ctxt.cur - desc->length ) + rv = -EFAULT; + if ( instance == desc->instance ) { - desc = (void *)(ctxt.data + off); - /* Move past header */ - off += sizeof(*desc); - if ( ctxt.cur < desc->length || - off > ctxt.cur - desc->length ) - break; - if ( instance == desc->instance ) - { - rv = 0; - if ( guest_handle_is_null(handle) ) - *bufsz = desc->length; - else if ( *bufsz < desc->length ) - rv = -ENOBUFS; - else if ( copy_to_guest(handle, ctxt.data + off, desc->length) ) - rv = -EFAULT; - else - *bufsz = desc->length; - break; - } + rv = 0; + if ( guest_handle_is_null(handle) ) + *bufsz = desc->length; + else if ( *bufsz < desc->length ) + rv = -ENOBUFS; + else if ( copy_to_guest(handle, ctxt.data + off, desc->length) ) + rv = -EFAULT; + else + *bufsz = desc->length; } } -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |