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] Avoid unnecessary pte flags changes, which are costly on

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Avoid unnecessary pte flags changes, which are costly on Xen. Also clean
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 23 Mar 2005 08:59:22 +0000
Delivery-date: Wed, 23 Mar 2005 13:11:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
ChangeSet 1.1351, 2005/03/23 08:59:22+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Avoid unnecessary pte flags changes, which are costly on Xen. Also clean
        up XCHG handling in instruction emulator a little bit.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h |   13 ++++++++-
 xen/arch/x86/x86_emulate.c                                 |   17 ++++++-------
 2 files changed, 19 insertions(+), 11 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h        
2005-03-23 05:03:00 -05:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h        
2005-03-23 05:03:00 -05:00
@@ -263,8 +263,17 @@
        return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low);
 }
 
-static inline void ptep_set_wrprotect(pte_t *ptep)             { 
clear_bit(_PAGE_BIT_RW, &ptep->pte_low); }
-static inline void ptep_mkdirty(pte_t *ptep)                   { 
set_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); }
+static inline void ptep_set_wrprotect(pte_t *ptep)
+{
+       if (pte_write(*ptep))
+               clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
+}
+
+static inline void ptep_mkdirty(pte_t *ptep)
+{
+       if (!pte_dirty(*ptep))
+               set_bit(_PAGE_BIT_DIRTY, &ptep->pte_low);
+}
 
 /*
  * Macro to mark a page protection value as "uncacheable".  On processors 
which do not support
diff -Nru a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        2005-03-23 05:03:00 -05:00
+++ b/xen/arch/x86/x86_emulate.c        2005-03-23 05:03:00 -05:00
@@ -668,18 +668,17 @@
         emulate_2op_SrcV("test", src, dst, _regs.eflags);
         break;
     case 0x86 ... 0x87: /* xchg */
-        src.val ^= dst.val;
-        dst.val ^= src.val;
-        src.val ^= dst.val;
-        lock_prefix = 1;
-        /* Write back the source (temporary register location). */
+        /* Write back the register source. */
         switch ( dst.bytes )
         {
-        case 1: *(u8  *)src.ptr = (u8)src.val; break;
-        case 2: *(u16 *)src.ptr = (u16)src.val; break;
-        case 4: *src.ptr = (u32)src.val; break; /* 64b mode: zero-extend */
-        case 8: *src.ptr = src.val; break;
+        case 1: *(u8  *)src.ptr = (u8)dst.val; break;
+        case 2: *(u16 *)src.ptr = (u16)dst.val; break;
+        case 4: *src.ptr = (u32)dst.val; break; /* 64b mode: zero-extend */
+        case 8: *src.ptr = dst.val; break;
         }
+        /* Write back the memory destination with implicit LOCK prefix. */
+        dst.val = src.val;
+        lock_prefix = 1;
         break;
     case 0xa0 ... 0xa1: /* mov */
         dst.ptr = (unsigned long *)&_regs.eax;


-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Avoid unnecessary pte flags changes, which are costly on Xen. Also clean, BitKeeper Bot <=