From: Avi Kivity <avi@redhat.com>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] VMX: Return to userspace on invalid state emulation failure
Date: Wed, 26 Aug 2009 12:02:37 +0300 [thread overview]
Message-ID: <4A94FA2D.7020206@redhat.com> (raw)
In-Reply-To: <1251153439-17078-1-git-send-email-m.gamal005@gmail.com>
On 08/25/2009 01:37 AM, Mohammed Gamal wrote:
> Return to userspace instead of repeatedly trying to emulate
> instructions that have already failed
>
> Signed-off-by: Mohammed Gamal<m.gamal005@gmail.com>
> ---
> arch/x86/kvm/vmx.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 6b57eed..c559bb7 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3337,6 +3337,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu)
>
> if (err != EMULATE_DONE) {
> kvm_report_emulation_failure(vcpu, "emulation failure");
> + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
> + vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
> break;
> }
>
> @@ -3607,7 +3609,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
> vmx->entry_time = ktime_get();
>
> /* Handle invalid guest state instead of entering VMX */
> - if (vmx->emulation_required&& emulate_invalid_guest_state) {
> + if (vmx->emulation_required&& emulate_invalid_guest_state
> + && !(vcpu->run->exit_reason == KVM_EXIT_INTERNAL_ERROR&&
> + vcpu->run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)) {
> handle_invalid_guest_state(vcpu);
> return;
> }
>
Still suffers from the same problem. You don't always update
vcpu->run->exit_reason, so you can't test it. Best to return a value
from handle_invalid_guest_state() (the standard return codes for exit
handlers are 1 for return-to-guest, 0 for return-to-host, and -errno to
return with an error).
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2009-08-26 9:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-24 22:37 [PATCH] VMX: Return to userspace on invalid state emulation failure Mohammed Gamal
2009-08-26 9:02 ` Avi Kivity [this message]
2009-08-26 10:07 ` Mohammed Gamal
2009-08-26 10:11 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2009-08-24 11:51 Mohammed Gamal
2009-08-24 4:07 Mohammed Gamal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A94FA2D.7020206@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=m.gamal005@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).