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] [xen-unstable] x86/svm: eliminate unnecessary NR_CPUS-si

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/svm: eliminate unnecessary NR_CPUS-sized arrays
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Jul 2010 04:50:39 -0700
Delivery-date: Fri, 09 Jul 2010 04:52:18 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278674655 -3600
# Node ID e9aaeb8b83b4ba6e5240c2b88f08813b5eb41f55
# Parent  da2b019ba6442cffff3ca5f0bcc99438814b7614
x86/svm: eliminate unnecessary NR_CPUS-sized arrays

Replace them with per-CPU data.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff -r da2b019ba644 -r e9aaeb8b83b4 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Jul 09 12:23:52 2010 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Jul 09 12:24:15 2010 +0100
@@ -70,10 +70,10 @@ enum handler_return { HNDL_done, HNDL_un
 enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
 
 /* va of hardware host save area     */
-static void *hsa[NR_CPUS] __read_mostly;
+static DEFINE_PER_CPU_READ_MOSTLY(void *, hsa);
 
 /* vmcb used for extended host state */
-static void *root_vmcb[NR_CPUS] __read_mostly;
+static DEFINE_PER_CPU_READ_MOSTLY(void *, root_vmcb);
 
 static bool_t amd_erratum383_found __read_mostly;
 
@@ -645,7 +645,7 @@ static void svm_ctxt_switch_from(struct 
     vpmu_save(v);
 
     svm_sync_vmcb(v);
-    svm_vmload(root_vmcb[cpu]);
+    svm_vmload(per_cpu(root_vmcb, cpu));
 
 #ifdef __x86_64__
     /* Resume use of ISTs now that the host TR is reinstated. */
@@ -681,7 +681,7 @@ static void svm_ctxt_switch_to(struct vc
 
     svm_restore_dr(v);
 
-    svm_vmsave(root_vmcb[cpu]);
+    svm_vmsave(per_cpu(root_vmcb, cpu));
     svm_vmload(v->arch.hvm_svm.vmcb);
     vpmu_load(v);
 
@@ -823,18 +823,18 @@ static int svm_do_pmu_interrupt(struct c
 
 static void svm_cpu_dead(unsigned int cpu)
 {
-    free_xenheap_page(hsa[cpu]);
-    hsa[cpu] = NULL;
-    free_vmcb(root_vmcb[cpu]);
-    root_vmcb[cpu] = NULL;
+    free_xenheap_page(per_cpu(hsa, cpu));
+    per_cpu(hsa, cpu) = NULL;
+    free_vmcb(per_cpu(root_vmcb, cpu));
+    per_cpu(root_vmcb, cpu) = NULL;
 }
 
 static int svm_cpu_up_prepare(unsigned int cpu)
 {
-    if ( ((hsa[cpu] == NULL) &&
-          ((hsa[cpu] = alloc_host_save_area()) == NULL)) ||
-         ((root_vmcb[cpu] == NULL) &&
-          ((root_vmcb[cpu] = alloc_vmcb()) == NULL)) )
+    if ( ((per_cpu(hsa, cpu) == NULL) &&
+          ((per_cpu(hsa, cpu) = alloc_host_save_area()) == NULL)) ||
+         ((per_cpu(root_vmcb, cpu) == NULL) &&
+          ((per_cpu(root_vmcb, cpu) = alloc_vmcb()) == NULL)) )
     {
         svm_cpu_dead(cpu);
         return -ENOMEM;
@@ -881,7 +881,7 @@ static int svm_cpu_up(void)
     write_efer(read_efer() | EFER_SVME);
 
     /* Initialize the HSA for this core. */
-    wrmsrl(MSR_K8_VM_HSAVE_PA, (uint64_t)virt_to_maddr(hsa[cpu]));
+    wrmsrl(MSR_K8_VM_HSAVE_PA, (uint64_t)virt_to_maddr(per_cpu(hsa, cpu)));
 
     /* check for erratum 383 */
     svm_init_erratum_383(c);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86/svm: eliminate unnecessary NR_CPUS-sized arrays, Xen patchbot-unstable <=