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-ia64-devel

[Xen-ia64-devel] [PATCH 2/5] vti save-restore: fix opt_feature hypercall

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 2/5] vti save-restore: fix opt_feature hypercall
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Tue, 20 Nov 2007 19:44:13 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Tue, 20 Nov 2007 02:44:55 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1195551349 -32400
# Node ID 02d9248aadb7c0a18776c732569f3fe9530e1e93
# Parent  c2337862609abf79dc3212d8de6f6141cb63219f
fix opt_feature hypercall.
- fix XEN_IA64_OPTF_IDENT_MAP_REG[457] definitions.
- smp fix. writing to domain->arch.opt_feature is racy.
PATCHNAME: fix_opt_feature_hypercall

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r c2337862609a -r 02d9248aadb7 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Nov 20 19:24:42 2007 +0900
+++ b/xen/arch/ia64/xen/domain.c        Tue Nov 20 18:35:49 2007 +0900
@@ -2285,12 +2285,22 @@ optf_set_identity_mapping(unsigned long*
        }
 }
 
-/* Switch a optimization feature on/off. */
+/*
+ * Switch a optimization feature on/off.
+ * the vcpu must be paused to avoid racy access to opt_feature.
+ */
 int
 domain_opt_feature(struct xen_ia64_opt_feature* f)
 {
-       struct opt_feature* optf = &(current->domain->arch.opt_feature);
+       struct domain *d = current->domain;
+       struct opt_feature* optf = &d->arch.opt_feature;
+       struct vcpu *v;
        long rc = 0;
+
+       for_each_vcpu(d, v) {
+               if (v != current)
+                       vcpu_pause(v);
+       }
 
        switch (f->cmd) {
        case XEN_IA64_OPTF_IDENT_MAP_REG4:
@@ -2307,6 +2317,12 @@ domain_opt_feature(struct xen_ia64_opt_f
                rc = -ENOSYS;
                break;
        }
+
+       for_each_vcpu(d, v) {
+               if (v != current)
+                       vcpu_unpause(v);
+       }
+
        return rc;
 }
 
diff -r c2337862609a -r 02d9248aadb7 xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Tue Nov 20 19:24:42 2007 +0900
+++ b/xen/include/asm-ia64/domain.h     Tue Nov 20 18:35:49 2007 +0900
@@ -105,9 +105,15 @@ struct opt_feature {
  * The base XEN_IA64_OPTF_IDENT_MAP_REG7 is defined in public/arch-ia64.h.
  * Identity mapping of region 4 addresses in HVM.
  */
-#define XEN_IA64_OPTF_IDENT_MAP_REG4   (XEN_IA64_OPTF_IDENT_MAP_REG7 + 1)
+#define XEN_IA64_OPTF_IDENT_MAP_REG4_BIT        \
+    (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 1)
+#define XEN_IA64_OPTF_IDENT_MAP_REG4            \
+    (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_BIT)
 /* Identity mapping of region 5 addresses in HVM. */
-#define XEN_IA64_OPTF_IDENT_MAP_REG5   (XEN_IA64_OPTF_IDENT_MAP_REG4 + 1)
+#define XEN_IA64_OPTF_IDENT_MAP_REG5_BIT        \
+    (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 2)
+#define XEN_IA64_OPTF_IDENT_MAP_REG5            \
+    (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_BIT)
 
 /* Set an optimization feature in the struct arch_domain. */
 extern int domain_opt_feature(struct xen_ia64_opt_feature*);
diff -r c2337862609a -r 02d9248aadb7 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Tue Nov 20 19:24:42 2007 +0900
+++ b/xen/include/public/arch-ia64.h    Tue Nov 20 18:35:49 2007 +0900
@@ -674,7 +674,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_ia64_debug_o
  * This is useful in guests using region 7 for identity mapping
  * like the linux kernel does.
  */
-#define XEN_IA64_OPTF_IDENT_MAP_REG7   0x1UL
+#define XEN_IA64_OPTF_IDENT_MAP_REG7_BIT       0
+#define XEN_IA64_OPTF_IDENT_MAP_REG7        \
+        (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_BIT)
 
 struct xen_ia64_opt_feature {
        unsigned long cmd;              /* Which feature */

Attachment: 16398_02d9248aadb7_fix_opt_feature_hypercall.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 2/5] vti save-restore: fix opt_feature hypercall, Isaku Yamahata <=