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

xen-devel

[Top] [All Lists]

[Xen-devel] [PATCH, 3.2] fix race between scheduler and CPUs being offli

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH, 3.2] fix race between scheduler and CPUs being offlined
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: 2008年12月16日 15:08:18 +0000
Delivery-date: 2008年12月16日 07:08:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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
Since the credit scheduler depends on cpu_core_map and cpu_sibling_map
to be populated for all CPUs marked online in cpu_online_map (otherwise
csched_cpu_pick() can get into an endless loop due to nxt_idlers being
empty and hence no bit being cleared from cpus), sibling info must be
cleared *after* removing a CPU from cpu_online_map.
But that is only reducing the original race window - since the clearing
of the CPU maps happens on the dying CPU while the scheduler runs on an
active one (generally CPU0), the scheduler must also be enabled to deal
with the potential of finding empty nxt_idlers. While this change alone
would suffice to fix the race, clearing the maps in proper order still
seems like a reasonable thing to do.
Note that this is *not* applicable to 3.3 or -unstable, since there
scheduling doesn't happen anymore while CPUs are being brought down.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
--- 2008年07月30日.orig/xen/arch/x86/smpboot.c 2008年01月16日 14:24:34.000000000 
+0100
+++ 2008年07月30日/xen/arch/x86/smpboot.c 2008年12月15日 15:38:37.000000000 +0100
@@ -1217,12 +1217,12 @@ int __cpu_disable(void)
 
 time_suspend();
 
- remove_siblinginfo(cpu);
-
 cpu_clear(cpu, map);
 fixup_irqs(map);
 /* It's now safe to remove this processor from the online map */
 cpu_clear(cpu, cpu_online_map);
+ remove_siblinginfo(cpu);
+
 return 0;
 }
 
--- 2008年07月30日.orig/xen/common/sched_credit.c 2008年01月16日 14:24:35.000000000 
+0100
+++ 2008年07月30日/xen/common/sched_credit.c 2008年12月15日 16:31:59.000000000 
+0100
@@ -474,6 +474,16 @@ csched_cpu_pick(struct vcpu *vc)
 cpu = nxt;
 cpu_clear(cpu, cpus);
 }
+ else if ( unlikely(cpus_empty(nxt_idlers)) )
+ {
+ /*
+ * This can happen when CPUs are being brought down for S3
+ * or S5: cpu_{core,sibling}_map may have got cleared by
+ * the time we get here, while we may have found the CPU
+ * still set in cpu_online_map earlier.
+ */
+ cpu_clear(nxt, cpus);
+ }
 else
 {
 cpus_andnot(cpus, cpus, nxt_idlers);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH, 3.2] fix race between scheduler and CPUs being offlined, Jan Beulich <=
Previous by Date: Re: [Xen-devel] Native hypercall basics using int 82 , hnrkssn hnrkssn
Next by Date: Re: [Xen-devel] Native hypercall basics using int 82 , Keir Fraser
Previous by Thread: [Xen-devel] Failed assertion at irq.c:269 when running with debug=y , George Dunlap
Next by Thread: [Xen-devel] [PATCH 00 of 14] swiotlb/x86: lay groundwork for xen dom0 use of swiotlb , Jeremy Fitzhardinge
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /