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

[Xen-devel] Re: [PATCH] [RFC] Fix a small window on CPU online/offline

To: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] [RFC] Fix a small window on CPU online/offline
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Fri, 02 Apr 2010 08:14:50 +0100
Cc: "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Fri, 02 Apr 2010 00:15:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <789F9655DD1B8F43B48D77C5D30659731D614CD6@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcrRfOuRFKcGrHN4RFyYXcp7bcYm2wACLDvHACOmI6AAB/51RA==
Thread-topic: [PATCH] [RFC] Fix a small window on CPU online/offline
User-agent: Microsoft-Entourage/12.24.0.100205
On 02/04/2010 04:31, "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx> wrote:

> Have a short discussion with Kevin, maybe we can sync the state in
> cpu_disable_scheduler if current is idle, and then set a flag so that we will
> not sync again in context siwtch later. If the current is not idle, we can
> leave the context switch to do the sync for us. I will do more investigate to
> see how many changes are needed.

Hm, actually maybe that could work. You might not even need a flag in case
current is non-idle in cpu_disable_scheduler(). It might suffice to force
context_switch() to do full context switch synchronously when the CPU is
going offline (see appended patch). I was thinking there was a race as soon
as the cpu is cleared from cpu_online_map, but actually the problem occurs
only once the vcpu is descheduled, so if we can synchronously sync its state
before calling context_saved(), perhaps we are fine.

This could be a very small patch after all! :-)

 -- Keir

--- a/xen/arch/x86/domain.c    Thu Apr 01 09:55:27 2010 +0100
+++ b/xen/arch/x86/domain.c    Fri Apr 02 08:12:14 2010 +0100
@@ -1442,7 +1442,8 @@
 
     set_current(next);
 
-    if ( (per_cpu(curr_vcpu, cpu) == next) || is_idle_vcpu(next) )
+    if ( (per_cpu(curr_vcpu, cpu) == next) ||
+         (is_idle_vcpu(next) && !cpu_is_offline(cpu)) )
     {
         local_irq_enable();
     }



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