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: Free per-cpu area for offline cpu vi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Free per-cpu area for offline cpu via RCU.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 07:59:06 -0800
Delivery-date: Mon, 17 Jan 2011 08:08:52 -0800
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@xxxxxxx>
# Date 1294478063 0
# Node ID 2dd233e8883854c7370d8a228f263bb554382207
# Parent  03718b569d971df043b34799165241e7f9f58b00
x86: Free per-cpu area for offline cpu via RCU.

This allows other CPUs to reference per-cpu areas with less strict
locking. In particular, timer.c access a per-cpu lock with reference
to a per-timer cpu field which it accesses with no synchronisation.

One subtlety is that this prevents us bringing a cpu back online until
the RCU work is completed. In this case we return EBUSY and the
tool stack can report the (unlikely) error, or retry, as it sees fit.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/percpu.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff -r 03718b569d97 -r 2dd233e88838 xen/arch/x86/percpu.c
--- a/xen/arch/x86/percpu.c     Fri Jan 07 18:53:50 2011 +0000
+++ b/xen/arch/x86/percpu.c     Sat Jan 08 09:14:23 2011 +0000
@@ -3,6 +3,7 @@
 #include <xen/cpu.h>
 #include <xen/init.h>
 #include <xen/mm.h>
+#include <xen/rcupdate.h>
 
 unsigned long __per_cpu_offset[NR_CPUS];
 #define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
@@ -19,7 +20,7 @@ static int init_percpu_area(unsigned int
 {
     char *p;
     if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return 0;
+        return -EBUSY;
     if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
         return -ENOMEM;
     memset(p, 0, __per_cpu_data_end - __per_cpu_start);
@@ -27,11 +28,26 @@ static int init_percpu_area(unsigned int
     return 0;
 }
 
-static void free_percpu_area(unsigned int cpu)
+struct free_info {
+    unsigned int cpu;
+    struct rcu_head rcu;
+};
+static DEFINE_PER_CPU(struct free_info, free_info);
+
+static void _free_percpu_area(struct rcu_head *head)
 {
+    struct free_info *info = container_of(head, struct free_info, rcu);
+    unsigned int cpu = info->cpu;
     char *p = __per_cpu_start + __per_cpu_offset[cpu];
     free_xenheap_pages(p, PERCPU_ORDER);
     __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
+}
+
+static void free_percpu_area(unsigned int cpu)
+{
+    struct free_info *info = &per_cpu(free_info, cpu);
+    info->cpu = cpu;
+    call_rcu(&info->rcu, _free_percpu_area);
 }
 
 static int cpu_percpu_callback(

_______________________________________________
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: Free per-cpu area for offline cpu via RCU., Xen patchbot-unstable <=