[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [patch] Initialize xen_vcpu0 before initialize irq_ops



Hello,

I find a strange behavior. When a machine is slow (or with many debug
traces or a qemu vm),
a interrupt can occur between the pv_irq_ops initialization and the xen_vcpu[0]
initialization. This lead to a problem because some operations in
xen_irq_ops use
xen_vcpu.
I send you a patch to fix that but I'm not quite sure that is the
right solution.

Regards,
Anthoine

>From ac683ad8264f83fa0a5d743e18c0422e43e871d2 Mon Sep 17 00:00:00 2001
From: Anthoine Bourgeois <anthoine.bourgeois@xxxxxxxxx>
Date: Wed, 23 Nov 2011 19:23:42 +0100
Subject: [PATCH] Initialize xen_vcpu0 before initialize irq_ops.

xen_vcpu is used by
xen_irq_ops.xen_{save_fl,restore_fl,irq_disable,irq_enable} and should
be initialized before xen_init_irq_ops that initialize the pv_irq_ops
with it. If not, a call to those functions could lead to a deference of
NULL pointer.  This behaviour was find with a slow machine or qemu.
---
 arch/x86/xen/enlighten.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2d69617..a8111a0 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1166,6 +1166,10 @@ asmlinkage void __init xen_start_kernel(void)
         */
        xen_setup_stackprotector();

+       /* Don't do the full vcpu_info placement stuff until we have a
+          possible map and a non-dummy shared_info. */
+       per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
+
        xen_init_irq_ops();
        xen_init_cpuid_mask();

@@ -1207,9 +1211,6 @@ asmlinkage void __init xen_start_kernel(void)
                __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);

        __supported_pte_mask |= _PAGE_IOMAP;
-       /* Don't do the full vcpu_info placement stuff until we have a
-          possible map and a non-dummy shared_info. */
-       per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];

        local_irq_disable();
        early_boot_irqs_disabled = true;
-- 
1.7.3.4

Attachment: 0001-Initialize-xen_vcpu0-before-initialize-irq_ops.patch
Description: Text Data

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.