From: Christoph Egger <Christoph.Egger@amd.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] nestedsvm: fix error path when VMRUN emulation fails
Date: Tue, 10 May 2011 11:05:04 +0200 [thread overview]
Message-ID: <4DC8FFC0.6030609@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
Hi,
attached patch fixes error path when VMRUN emulation fails.
With this l1 guest keeps alive rather crashing the host.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_nh_errorpath.diff --]
[-- Type: text/plain, Size: 1278 bytes --]
diff -r f3766f97b786 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c Mon May 09 14:29:12 2011 +0200
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c Tue May 10 11:11:10 2011 +0200
@@ -708,17 +708,21 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct c
/* save host state */
ret = nsvm_vcpu_vmentry(v, regs, inst_len);
+
+ /* Switch vcpu to guest mode. In the error case
+ * this ensures the host mode is restored correctly
+ * and l1 guest keeps alive. */
+ nestedhvm_vcpu_enter_guestmode(v);
+
if (ret) {
gdprintk(XENLOG_ERR,
"nsvm_vcpu_vmentry failed, injecting #UD\n");
hvm_inject_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE, 0);
+ /* Must happen after hvm_inject_exception or it doesn't work right. */
nv->nv_vmswitch_in_progress = 0;
return 1;
}
- /* Switch vcpu to guest mode
- */
- nestedhvm_vcpu_enter_guestmode(v);
nv->nv_vmswitch_in_progress = 0;
return 0;
}
@@ -1381,7 +1385,7 @@ asmlinkage void nsvm_vcpu_switch(struct
int ret;
ASSERT(!nv->nv_vmexit_pending);
ret = nsvm_vcpu_vmrun(v, regs);
- if (ret < 0)
+ if (ret)
goto vmexit;
ASSERT(nestedhvm_vcpu_in_guestmode(v));
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2011-05-10 9:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4DC8FFC0.6030609@amd.com \
--to=christoph.egger@amd.com \
--cc=xen-devel@lists.xensource.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).