WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Properly ensure that every write to GS is followed by a

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Properly ensure that every write to GS is followed by a serialising
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 07 Apr 2005 08:19:23 +0000
Delivery-date: Thu, 07 Apr 2005 09:04:04 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1283, 2005/04/07 09:19:23+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Properly ensure that every write to GS is followed by a serialising
        instruction before the next SWAPGS (AMD erratum #88). We only resort
        to adding an otherwise unnecessary mfence in two cases.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 domain.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)


diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-04-07 05:04:11 -04:00
+++ b/xen/arch/x86/domain.c     2005-04-07 05:04:11 -04:00
@@ -585,22 +585,21 @@
               n->arch.user_ctxt.fs_base,
               n->arch.user_ctxt.fs_base>>32);
 
+    /* Most kernels have non-zero GS base, so don't bother testing. */
+    /* (This is also a serialising instruction, avoiding AMD erratum #88.) */
+    wrmsr(MSR_SHADOW_GS_BASE,
+          n->arch.user_ctxt.gs_base_kernel,
+          n->arch.user_ctxt.gs_base_kernel>>32);
+
     /* This can only be non-zero if selector is NULL. */
     if ( n->arch.user_ctxt.gs_base_user )
         wrmsr(MSR_GS_BASE,
               n->arch.user_ctxt.gs_base_user,
               n->arch.user_ctxt.gs_base_user>>32);
 
-    /* This can only be non-zero if selector is NULL. */
-    if ( p->arch.user_ctxt.gs_base_kernel |
-         n->arch.user_ctxt.gs_base_kernel )
-        wrmsr(MSR_SHADOW_GS_BASE,
-              n->arch.user_ctxt.gs_base_kernel,
-              n->arch.user_ctxt.gs_base_kernel>>32);
-
     /* If in kernel mode then switch the GS bases around. */
     if ( n->arch.flags & TF_kernel_mode )
-        __asm__ __volatile__ ( safe_swapgs );
+        __asm__ __volatile__ ( "swapgs" );
 
     if ( unlikely(!all_segs_okay) )
     {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Properly ensure that every write to GS is followed by a serialising, BitKeeper Bot <=