]> xenbits.xensource.com Git - xen.git/commit
x86/HVM: relinquish resources also from hvm_domain_destroy()
authorJan Beulich <jbeulich@suse.com>
Fri, 31 Jan 2020 15:47:29 +0000 (16:47 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 31 Jan 2020 15:47:29 +0000 (16:47 +0100)
commitb3344bb1cae0c9ac22a57db8ecca488ad0e4a66d
tree01ca60e63af9d1c1462c51fef4eef139fdeb8ac5
parent980c274f9be580de7d488f73e7e0d43943273154
x86/HVM: relinquish resources also from hvm_domain_destroy()

Domain creation failure paths don't call domain_relinquish_resources(),
yet allocations and alike done from hvm_domain_initialize() need to be
undone nevertheless. Call the function also from hvm_domain_destroy(),
after making sure all descendants are idempotent.

Note that while viridian_{domain,vcpu}_deinit() were already used in
ways suggesting they're idempotent, viridian_time_vcpu_deinit() actually
wasn't: One can't kill a timer that was never initialized.

For hvm_destroy_all_ioreq_servers()'s purposes make
relocate_portio_handler() return whether the to be relocated port range
was actually found. This seems cheaper than introducing a flag into
struct hvm_domain's ioreq_server sub-structure.

In hvm_domain_initialise() additionally
- use XFREE() also to replace adjacent xfree(),
- use hvm_domain_relinquish_resources() as being idempotent now.
There as well as in hvm_domain_destroy() the explicit call to
rtc_deinit() isn't needed anymore.

In hvm_domain_relinquish_resources() additionally drop a no longer
relevant if().

Fixes: e7a9b5e72f26 ("viridian: separately allocate domain and vcpu structures")
Fixes: 26fba3c85571 ("viridian: add implementation of synthetic timers")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <pdurrant@amazon.com>
xen/arch/x86/hvm/hpet.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/intercept.c
xen/arch/x86/hvm/ioreq.c
xen/arch/x86/hvm/pmtimer.c
xen/arch/x86/hvm/rtc.c
xen/arch/x86/hvm/viridian/time.c
xen/include/asm-x86/hvm/io.h