[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/hvm: wait for at least one ioreq server to be enabled
In the case where a stub domain is providing emulation for an HVM guest, there is no interlock in the toolstack to make sure that the stub domain is up and running before the guest is unpaused. Prior to the introduction of ioreq servers this was not a problem, since there was only ever one emulator so ioreqs were simply created anyway and the vcpu remained blocked until the stub domain started and picked up the ioreq. Since ioreq servers allow for multiple emulators for a single guest it's not possible to know a priori which emulator will handle a particular ioreq, so emulators must attach to a guest before the guest runs. This patch works around the lack of interlock in the toolstack for stub domains by keeping the domain paused until at least one ioreq server is created and enabled, which in practice means the stub domain is indeed up and running. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx> --- This patch also needs to be applied to stable-4.5 xen/arch/x86/hvm/hvm.c | 19 +++++++++++++++++++ xen/include/asm-x86/hvm/domain.h | 1 + 2 files changed, 20 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index fd2314e..bf2c5fc 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -885,6 +885,12 @@ static void hvm_ioreq_server_enable(struct hvm_ioreq_server *s, done: spin_unlock(&s->lock); + + if ( d->arch.hvm_domain.ioreq_server.waiting ) + { + d->arch.hvm_domain.ioreq_server.waiting = 0; + domain_unpause(d); + } } static void hvm_ioreq_server_disable(struct hvm_ioreq_server *s, @@ -1435,6 +1441,19 @@ int hvm_domain_initialise(struct domain *d) spin_lock_init(&d->arch.hvm_domain.ioreq_server.lock); INIT_LIST_HEAD(&d->arch.hvm_domain.ioreq_server.list); + + /* + * In the case where a stub domain is providing emulation for + * the guest, there is no interlock in the toolstack to prevent + * the guest from running before the stub domain is ready. + * Hence the domain must remain paused until at least one ioreq + * server is created and enabled. + */ + if ( !is_pvh_domain(d) ) { + domain_pause(d); + d->arch.hvm_domain.ioreq_server.waiting = 1; + } + spin_lock_init(&d->arch.hvm_domain.irq_lock); spin_lock_init(&d->arch.hvm_domain.uc_lock); diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index 2757c7f..418262d 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -84,6 +84,7 @@ struct hvm_domain { spinlock_t lock; ioservid_t id; struct list_head list; + bool_t waiting; } ioreq_server; struct hvm_ioreq_server *default_ioreq_server; -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |