Mailing List Archive

[xen-unstable] x86: Add warning comment explaining restrictions to play_dead().
# HG changeset patch
# User Shan Haitao <haitao.shan@intel.com>
# Date 1299060115 0
# Node ID bde351b18fd0fce23e6d4ae24627ed15a9b7c768
# Parent c5d121fd35c0451e8ae08749566c7fbbddb92706
x86: Add warning comment explaining restrictions to play_dead().

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r c5d121fd35c0 -r bde351b18fd0 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Mon Feb 28 16:55:20 2011 +0000
+++ b/xen/arch/x86/domain.c Wed Mar 02 10:01:55 2011 +0000
@@ -99,6 +99,15 @@

static void play_dead(void)
{
+ /*
+ * NOTE: After cpu_exit_clear, per-cpu variables are no longer accessible,
+ * as they may be freed at any time. In this case, heap corruption or
+ * #PF can occur (when heap debugging is enabled). For example, even
+ * printk() can involve tasklet scheduling, which touches per-cpu vars.
+ *
+ * Consider very carefully when adding code to this path. Most hypervisor
+ * subsystems are unsafe to call.
+ */
cpu_exit_clear(smp_processor_id());
mb();
local_irq_disable();

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