x86/hvm.c: fix regression in guest destruction
PATCH 1/1 x86/hvm.c: fix regression in guest destruction
As reported by Wei Lu on July 27 2015
--- xen/arch/x86/hvm/hvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +3 -1
@@ -2463,7 +2463,9 @@ void hvm_vcpu_destroy(struct vcpu *v) {hvm_all_ioreq_servers_remove_vcpu (v->domain, v); -altp2m_vcpu_destroy (v); +if (hvm_altp2m_supported () ) +altp2m_vcpu_destroy (v); +nestedhvm_vcpu_destroy (v);free_compat_arg_xlat (v);
Signature · 1 line
1.9.1
Quoted 1 line · Ravi Sahita
As reported by Wei Lu on July 27 2015
Quoted 1 line
Signed-off-by Ravi Sahita <[email protected]>
Quoted 19 lines
--- xen/arch/x86/hvm/hvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)xen/arch/x86/hvm/hvm.c +3
-1@@ -2463,7 +2463,9 @@ void hvm_vcpu_destroy(struct vcpu *v) {hvm_all_ioreq_servers_remove_vcpu (v->domain, v); -altp2m_vcpu_destroy (v); +if (hvm_altp2m_supported () ) +altp2m_vcpu_destroy (v); +nestedhvm_vcpu_destroy (v);free_compat_arg_xlat (v);
Wei Liu
Tested-byQuoted 9 lines · Andrew Cooper
Quoted 1 line · Ravi Sahita
As reported by Wei Lu on July 27 2015
Reported-by Wei Liu <[email protected]>Quoted 1 line
Signed-off-by Ravi Sahita <[email protected]>Reviewed-by Andrew Cooper <[email protected]>
Quoted 19 lines
Quoted 19 lines
--- xen/arch/x86/hvm/hvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)xen/arch/x86/hvm/hvm.c +3
-1@@ -2463,7 +2463,9 @@ void hvm_vcpu_destroy(struct vcpu *v) {hvm_all_ioreq_servers_remove_vcpu (v->domain, v); -altp2m_vcpu_destroy (v); +if (hvm_altp2m_supported () ) +altp2m_vcpu_destroy (v); +nestedhvm_vcpu_destroy (v);free_compat_arg_xlat (v);
Quoted 4 lines · Andrew Cooper
Quoted 1 line · Ravi Sahita
As reported by Wei Lu on July 27 2015
Reported-by Wei Liu <[email protected]>
Which leaves an effectively empty commit message:
x86/hvm.c: fix regression in guest destruction
If I were maintainer of this code I'd be very grumpy about the lack of a commit log (What regression? What is the fix? Why is it correct?) for this patch. I asked on IRC and Andy suggested instead:
x86/hvm.c: Don't tear down altp2m state if it was never set up
which I have applied with. I still don't think the commit message is very satisfactory, but I'm not maintainer of any of this code so meh.
Ian.
Quoted 2 lines · Ian Campbell
which I have applied with. I still don't think the commit message is very satisfactory, but I'm not maintainer of any of this code so meh.
For the benefit of the archives perhaps someone could explain why gating a per-vcpu teardown on a host level feature setting is correct?
In particular what ensures that altp2m_vcpu_initialise has been called, given that this is only called from HVMOP_altp2m_set_domain_state. What happens if that HVMOP is never touched?
Do things work both for altp2m disabled on the Xen command line and disabled/enabled in the guest config? If so how?
Also how come HVMOP_altp2m_set_domain_state does not have a hvm_altp2m_supported check?
Ian.
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Ian Campbell
which I have applied with. I still don't think the commit message is very satisfactory, but I'm not maintainer of any of this code so meh.
For the benefit of the archives perhaps someone could explain why gating a per-vcpu teardown on a host level feature setting is correct?
In particular what ensures that
altp2m_vcpu_initialisehas been called, given that this is only called fromHVMOP_altp2m_set_domain_state. What happens if that HVMOP is never touched?
Quoted 5 lines
Do things work both for altp2m disabled on the Xen command line and disabled/enabled in the guest config? If so how?
Also how come
HVMOP_altp2m_set_domain_statedoes not have ahvm_altp2m_supportedcheck?
So this was all acked & stuff before I had much of a chance to comment on it, but on my to-do list for 4.7 is to rework a lot of the initialization / teardown stuff. In particular:
- Always and only check for whether something has been initialized (e.g., non-NULL, non-INVALID_MFN) before tearing it down
- Do *all* of the initialization for both altp2m and nestedhvm when they're actually enabled for the domain, rather than doing a bunch of the initialization unconditionally up front.
This is all part of the "technical debt" we were talking about when we considered giving it a freeze exception.
-George
Quoted 28 lines · George Dunlap
Quoted 14 lines · Ian Campbell
Quoted 3 lines · Ian Campbell
which I have applied with. I still don't think the commit message is very
satisfactory, but I'm not maintainer of any of this code so meh.For the benefit of the archives perhaps someone could explain why gating a
per-vcpu teardown on a host level feature setting is correct?In particular what ensures that
altp2m_vcpu_initialisehas been called, given that this is only called fromHVMOP_altp2m_set_domain_state. What happens if that HVMOP is never touched?Quoted 5 lines
Do things work both for altp2m disabled on the Xen command line and disabled/enabled in the guest config? If so how?
Also how come
HVMOP_altp2m_set_domain_statedoes not have ahvm_altp2m_supportedcheck?So this was all acked & stuff before I had much of a chance to comment on it, but on my to-do list for 4.7 is to rework a lot of the initialization / teardown stuff. In particular:
- Always and only check for whether something has been initialized (e.g., non-NULL, non-INVALID_MFN) before tearing it down
Quoted 6 lines
- Do *all* of the initialization for both altp2m and nestedhvm when they're actually enabled for the domain, rather than doing a bunch of the initialization unconditionally up front.
This is all part of the "technical debt" we were talking about when we considered giving it a freeze exception.
Thanks, I'm inferring that everything I asked about in the second from last paragraph is somehow fine, just confusingly achieved in the current code...
I'm done grumping now...
Ian.
Quoted 2 lines · Ian Campbell
Also how come
HVMOP_altp2m_set_domain_statedoes not have ahvm_altp2m_supportedcheck?
(For the benefit of not leaving this question unanswered)
There is an early exit at the top of do_altp2m_op(), ahead of even reading the hypercall body from the guest.
~Andrew
Quoted 8 lines · Andrew Cooper
Quoted 2 lines · Ian Campbell
Also how come
HVMOP_altp2m_set_domain_statedoes not have ahvm_altp2m_supportedcheck?(For the benefit of not leaving this question unanswered)
There is an early exit at the top of
do_altp2m_op(), ahead of even reading the hypercall body from the guest.
Thanks.
Ian.