xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: Keir Fraser <keir.xen@gmail.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] nestedhvm: ASID emulation
Date: Fri, 15 Apr 2011 15:40:44 +0200	[thread overview]
Message-ID: <4DA84ADC.1020706@amd.com> (raw)
In-Reply-To: <C9CDFE45.16678%keir.xen@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

On 04/15/11 14:53, Keir Fraser wrote:
> On 15/04/2011 10:57, "Christoph Egger"<Christoph.Egger@amd.com>  wrote:
>
>> On 04/15/11 11:24, Keir Fraser wrote:
>>> On 15/04/2011 10:08, "Christoph Egger"<Christoph.Egger@amd.com>   wrote:
>>
>> Just found another fallout that got lost from my original patch.
>>
>> After shutting down XP mode in Windows 7, Win7 turns off SVM in EFER
>> after about 30 seconds. When starting XP mode again, Win 7 turns SVM on
>> again.
>>
>> Then nv_n2asid can be stale. Attached patch fixes this.
>
> Should be using hvm_asid_flush_vcpu_asid(), so I'll fix the patch to use
> that and then check it in.

There are a lot of regressions now... I assume the non-nested 
virtualization case got broken.

Attached patch covers the non-nested case (and contains the above 
discussed hvm_asid_flush_vcpu_asid() as it didn't appear yet upstream).

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_asid.diff --]
[-- Type: text/plain, Size: 1436 bytes --]

diff -r ad5960696d68 xen/arch/x86/hvm/nestedhvm.c
--- a/xen/arch/x86/hvm/nestedhvm.c	Fri Apr 15 12:00:13 2011 +0200
+++ b/xen/arch/x86/hvm/nestedhvm.c	Fri Apr 15 15:43:15 2011 +0200
@@ -61,7 +61,7 @@ nestedhvm_vcpu_reset(struct vcpu *v)
     nv->nv_vvmcxaddr = VMCX_EADDR;
     nv->nv_flushp2m = 0;
     nv->nv_p2m = NULL;
+    hvm_asid_flush_vcpu_asid(&nv->nv_n2asid);
 
     if ( hvm_funcs.nhvm_vcpu_reset )
         hvm_funcs.nhvm_vcpu_reset(v);
diff -r ad5960696d68 xen/arch/x86/hvm/svm/asid.c
--- a/xen/arch/x86/hvm/svm/asid.c	Fri Apr 15 12:00:13 2011 +0200
+++ b/xen/arch/x86/hvm/svm/asid.c	Fri Apr 15 15:43:15 2011 +0200
@@ -43,10 +43,16 @@ asmlinkage void svm_asid_handle_vmrun(vo
 {
     struct vcpu *curr = current;
     struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb;
-    struct hvm_vcpu_asid *p_asid =
-        nestedhvm_vcpu_in_guestmode(curr)
-        ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid;
-    bool_t need_flush = hvm_asid_handle_vmenter(p_asid);
+    struct hvm_vcpu_asid *p_asid;
+    bool_t need_flush;
+    bool_t vcpu_guestmode = 0;
+
+    if (nestedhvm_enabled(curr->domain) && nestedhvm_vcpu_in_guestmode(curr))
+        vcpu_guestmode = 1;
+
+    p_asid = vcpu_guestmode ?
+        &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid;
+    need_flush = hvm_asid_handle_vmenter(p_asid);
 
     /* ASID 0 indicates that ASIDs are disabled. */
     if ( p_asid->asid == 0 )

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2011-04-15 13:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 10:37 [PATCH] nestedhvm: ASID emulation Christoph Egger
2011-04-13 13:27 ` Keir Fraser
2011-04-13 14:26   ` Christoph Egger
2011-04-13 15:05     ` Keir Fraser
2011-04-13 15:19       ` Christoph Egger
2011-04-13 16:22         ` Keir Fraser
2011-04-14  9:26           ` Christoph Egger
2011-04-14 10:28             ` Keir Fraser
2011-04-14 14:01               ` Christoph Egger
2011-04-14 14:43                 ` Keir Fraser
2011-04-15  8:20                   ` Christoph Egger
2011-04-15  9:05                     ` Keir Fraser
2011-04-15  9:08                       ` Christoph Egger
2011-04-15  9:24                         ` Keir Fraser
2011-04-15  9:57                           ` Christoph Egger
2011-04-15 12:53                             ` Keir Fraser
2011-04-15 12:49                               ` Christoph Egger
2011-04-15 13:40                               ` Christoph Egger [this message]
2011-04-13 13:51 ` Christoph Egger
2011-04-13 14:48   ` Christoph Egger
  -- strict thread matches above, loose matches on Subject: below --
2011-04-13  8:57 Christoph Egger
2011-04-13  9:18 ` Keir Fraser

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=4DA84ADC.1020706@amd.com \
    --to=christoph.egger@amd.com \
    --cc=keir.xen@gmail.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).