# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 532979a7807111ff387df950e314ed97dd411e6f
# Parent fd961e9acb3fc4941614c5863e831ec43867ae95
[XEN] PTE updates do not need to use CMPXCHG instruction.
This is because the updates are already protected by a
per-domain lock. Using straightforward memory writes has
two advantages:
1. Faster
2. More correct (previously we could race accessed/dirty
bit updates by other CPUs).
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset: 10362:9d46e53c75f7598ab25b76b7a491801d1b320f5f
xen-unstable date: Fri Jun 16 15:22:03 2006 +0100
[XEN] Fix 10362 change to create_grant_va_mapping().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset: 10363:61a81fab2a029f029420a7dc0c2f73b783b45729
xen-unstable date: Fri Jun 16 15:34:21 2006 +0100
---
xen/arch/x86/mm.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff -r fd961e9acb3f -r 532979a78071 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Jun 16 10:54:01 2006 +0100
+++ b/xen/arch/x86/mm.c Sat Jun 17 12:31:40 2006 +0100
@@ -1045,6 +1045,9 @@ static inline int update_l1e(l1_pgentry_
l1_pgentry_t ol1e,
l1_pgentry_t nl1e)
{
+#ifndef PTE_UPDATE_WITH_CMPXCHG
+ return !__copy_to_user(pl1e, &nl1e, sizeof(nl1e));
+#else
intpte_t o = l1e_get_intpte(ol1e);
intpte_t n = l1e_get_intpte(nl1e);
@@ -1059,6 +1062,7 @@ static inline int update_l1e(l1_pgentry_
return 0;
}
return 1;
+#endif
}
@@ -1106,6 +1110,9 @@ static int mod_l1_entry(l1_pgentry_t *pl
return 1;
}
+#ifndef PTE_UPDATE_WITH_CMPXCHG
+#define UPDATE_ENTRY(_t,_p,_o,_n) ({ (*(_p) = (_n)); 1; })
+#else
#define UPDATE_ENTRY(_t,_p,_o,_n) ({ \
intpte_t __o = cmpxchg((intpte_t *)(_p), \
_t ## e_get_intpte(_o), \
@@ -1117,6 +1124,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
(_t ## e_get_intpte(_n)), \
(__o)); \
(__o == _t ## e_get_intpte(_o)); })
+#endif
/* Update the L2 entry at pl2e to new value nl2e. pl2e is within frame pfn. */
static int mod_l2_entry(l2_pgentry_t *pl2e,
@@ -2284,8 +2292,8 @@ static int create_grant_pte_mapping(
goto failed;
}
- if ( __copy_from_user(&ol1e, (l1_pgentry_t *)va, sizeof(ol1e)) ||
- !update_l1e(va, ol1e, _nl1e) )
+ ol1e = *(l1_pgentry_t *)va;
+ if ( !update_l1e(va, ol1e, _nl1e) )
{
put_page_type(page);
rc = GNTST_general_error;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|