From: Paul Durrant Date: Fri, 24 Apr 2015 10:14:23 +0000 (+0200) Subject: x86/hvm: implicitly disable an ioreq server when it is destroyed X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3365 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ebd41901b96565b392e8d434a4c4ab543d5fb52b;p=xen.git x86/hvm: implicitly disable an ioreq server when it is destroyed Currently, unless a (non-default) ioreq server is explicitly disabled before being destroyed, its gmfns will not be placed back into the p2m but still released back into the ioreq_gmfn mask. This is somewhat counter-intuitive and easily remedied by this small patch. Signed-off-by: Paul Durrant Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 497bc73435..3a094394be 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -961,6 +961,7 @@ static int hvm_ioreq_server_init(struct hvm_ioreq_server *s, struct domain *d, static void hvm_ioreq_server_deinit(struct hvm_ioreq_server *s, bool_t is_default) { + ASSERT(!s->enabled); hvm_ioreq_server_remove_all_vcpus(s); hvm_ioreq_server_unmap_pages(s, is_default); hvm_ioreq_server_free_rangesets(s, is_default); @@ -1063,6 +1064,8 @@ static int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id) domain_pause(d); + hvm_ioreq_server_disable(s, 0); + list_del(&s->list_entry); hvm_ioreq_server_deinit(s, 0); @@ -1321,11 +1324,10 @@ static void hvm_destroy_all_ioreq_servers(struct domain *d) { bool_t is_default = (s == d->arch.hvm_domain.default_ioreq_server); + hvm_ioreq_server_disable(s, is_default); + if ( is_default ) - { - hvm_ioreq_server_disable(s, 1); d->arch.hvm_domain.default_ioreq_server = NULL; - } list_del(&s->list_entry);