[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/HVM: properly deal with hvm_copy_*_guest_phys() errors
commit 63b02eff535b8798517b5a280cc2fff2f7d415c1 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Oct 14 09:53:31 2013 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Oct 14 09:53:31 2013 +0200 x86/HVM: properly deal with hvm_copy_*_guest_phys() errors In memory read/write handling the default case should tell the caller that the operation cannot be handled rather than the operation having succeeded, so that when new HVMCOPY_* states get added not handling them explicitly will not result in errors being ignored. In task switch emulation code stop handling some errors, but not others. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- xen/arch/x86/hvm/emulate.c | 14 ++++++-------- xen/arch/x86/hvm/hvm.c | 10 ++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 15b2257..6cb6678 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -504,10 +504,10 @@ static int __hvmemul_read( switch ( rc ) { + case HVMCOPY_okay: + break; case HVMCOPY_bad_gva_to_gfn: return X86EMUL_EXCEPTION; - case HVMCOPY_unhandleable: - return X86EMUL_UNHANDLEABLE; case HVMCOPY_bad_gfn_to_mfn: if ( access_type == hvm_access_insn_fetch ) return X86EMUL_UNHANDLEABLE; @@ -535,11 +535,10 @@ static int __hvmemul_read( } return rc; case HVMCOPY_gfn_paged_out: - return X86EMUL_RETRY; case HVMCOPY_gfn_shared: return X86EMUL_RETRY; default: - break; + return X86EMUL_UNHANDLEABLE; } return X86EMUL_OKAY; @@ -634,10 +633,10 @@ static int hvmemul_write( switch ( rc ) { + case HVMCOPY_okay: + break; case HVMCOPY_bad_gva_to_gfn: return X86EMUL_EXCEPTION; - case HVMCOPY_unhandleable: - return X86EMUL_UNHANDLEABLE; case HVMCOPY_bad_gfn_to_mfn: rc = hvmemul_linear_to_phys(addr, &gpa, chunk, &reps, pfec, hvmemul_ctxt); @@ -663,11 +662,10 @@ static int hvmemul_write( } return rc; case HVMCOPY_gfn_paged_out: - return X86EMUL_RETRY; case HVMCOPY_gfn_shared: return X86EMUL_RETRY; default: - break; + return X86EMUL_UNHANDLEABLE; } return X86EMUL_OKAY; diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 6fcd95a..5f3a94a 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2346,11 +2346,7 @@ void hvm_task_switch( rc = hvm_copy_to_guest_virt( prev_tr.base, &tss, sizeof(tss), PFEC_page_present); - if ( rc == HVMCOPY_bad_gva_to_gfn ) - goto out; - if ( rc == HVMCOPY_gfn_paged_out ) - goto out; - if ( rc == HVMCOPY_gfn_shared ) + if ( rc != HVMCOPY_okay ) goto out; rc = hvm_copy_from_guest_virt( @@ -2397,9 +2393,7 @@ void hvm_task_switch( tr.base, &tss, sizeof(tss), PFEC_page_present); if ( rc == HVMCOPY_bad_gva_to_gfn ) exn_raised = 1; - if ( rc == HVMCOPY_gfn_paged_out ) - goto out; - if ( rc == HVMCOPY_gfn_shared ) + else if ( rc != HVMCOPY_okay ) goto out; if ( (tss.trace & 1) && !exn_raised ) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |