x86/hvm: take a reference on ioreq server emulating domain
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 20 Mar 2018 18:05:23 +0000 (18:05 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 21 Mar 2018 18:24:50 +0000 (18:24 +0000)
commitccb42e0ca661e9d2259439504d8b508d42955f4d
tree98d157f052718b5689134559b57262043ad81e0a
parent9a422c035a880b4472195521d1f877a4e733bf8b
x86/hvm: take a reference on ioreq server emulating domain

When an ioreq server is created the code currently stores the id
of the emulating domain, but does not take a reference on that domain.

This patch modifies the code to hold a reference for the lifetime of the
ioreq server.

NOTE: ioreq servers are either destroyed explicitly or destroyed implicitly
      in context of XEN_DOMCTL_destroydomain.
      If the emulating domain is shut down prior to the target then the
      any domain reference held by an ioreq server will prevent it from
      being destroyed. However, if an emulating domain is shut down prior
      to its target then it is likely that the target's vcpus will block
      fairly quickly waiting for emulation that will never occur, and when
      the target domain is destroyed the reference on the zombie emulating
      domain will be dropped allowing both to be cleaned up.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/ioreq.c
xen/include/asm-x86/hvm/domain.h