mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 07:21:37 +00:00
HV: fix the issue of ACRN_REQUEST_EXCP flag is not cleared.
the problem is : System will crash when run crashme. The root cause of this problem is that when the ACRN_REQUEST_EXCP flag is set by calling the vcpu_make_request function, the flag is not cleared. Add the following statement to the vcpu_inject_exception function to fix the problem: bitmap_test_and_clear_lock(ACRN_REQUEST_EXCP, &vcpu->arch.pending_req); Tested that one night, there was no crash. Tracked-On: #2527 Signed-off-by: bing.li<bingx.li@intel.com> Acked-by: Eddie Dong<eddie.dong@intel.com>
This commit is contained in:
parent
28d50f1b96
commit
25741b62db
@ -212,6 +212,7 @@ int32_t vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector_arg, uint32
|
||||
} else {
|
||||
arch->exception_info.error = 0U;
|
||||
}
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,6 +221,8 @@ int32_t vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector_arg, uint32
|
||||
|
||||
static void vcpu_inject_exception(struct acrn_vcpu *vcpu, uint32_t vector)
|
||||
{
|
||||
if (bitmap_test_and_clear_lock(ACRN_REQUEST_EXCP, &vcpu->arch.pending_req)) {
|
||||
|
||||
if ((exception_type[vector] & EXCEPTION_ERROR_CODE_VALID) != 0U) {
|
||||
exec_vmwrite32(VMX_ENTRY_EXCEPTION_ERROR_CODE,
|
||||
vcpu->arch.exception_info.error);
|
||||
@ -240,6 +243,7 @@ static void vcpu_inject_exception(struct acrn_vcpu *vcpu, uint32_t vector)
|
||||
if (get_exception_type(vector) == EXCEPTION_FAULT) {
|
||||
vcpu_set_rflags(vcpu, vcpu_get_rflags(vcpu) | HV_ARCH_VCPU_RFLAGS_RF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool vcpu_inject_hi_exception(struct acrn_vcpu *vcpu)
|
||||
@ -285,7 +289,6 @@ void vcpu_inject_nmi(struct acrn_vcpu *vcpu)
|
||||
void vcpu_inject_gp(struct acrn_vcpu *vcpu, uint32_t err_code)
|
||||
{
|
||||
(void)vcpu_queue_exception(vcpu, IDT_GP, err_code);
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
/* Inject page fault exception(#PF) to guest */
|
||||
@ -293,28 +296,24 @@ void vcpu_inject_pf(struct acrn_vcpu *vcpu, uint64_t addr, uint32_t err_code)
|
||||
{
|
||||
vcpu_set_cr2(vcpu, addr);
|
||||
(void)vcpu_queue_exception(vcpu, IDT_PF, err_code);
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
/* Inject invalid opcode exception(#UD) to guest */
|
||||
void vcpu_inject_ud(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
(void)vcpu_queue_exception(vcpu, IDT_UD, 0);
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
/* Inject alignment check exception(#AC) to guest */
|
||||
void vcpu_inject_ac(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
(void)vcpu_queue_exception(vcpu, IDT_AC, 0);
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
/* Inject stack fault exception(#SS) to guest */
|
||||
void vcpu_inject_ss(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
(void)vcpu_queue_exception(vcpu, IDT_SS, 0);
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
int32_t interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
|
Loading…
Reference in New Issue
Block a user