From: Chris Wright Date: Fri, 28 Mar 2008 17:14:49 +0000 (-0700) Subject: queue up Xen patches for 2.6.24 X-Git-Tag: v2.6.24.5~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7650b7763aa237cf5985fa569d3a818c364c76eb;p=thirdparty%2Fkernel%2Fstable-queue.git queue up Xen patches for 2.6.24 --- diff --git a/queue-2.6.24/series b/queue-2.6.24/series index 2e59ddde0e2..c6f5362882c 100644 --- a/queue-2.6.24/series +++ b/queue-2.6.24/series @@ -10,3 +10,6 @@ inotify-fix-race.patch inotify-remove-debug-code.patch nohz-reevaluate-idle-sleep-length-after-add_timer_on.patch slab-fix-cache_cache-bootstrap-in-kmem_cache_init.patch +xen-fix-rmw-when-unmasking-events.patch +xen-mask-out-sep-from-cpuid.patch +xen-fix-up-setup-of-shared_info.patch diff --git a/queue-2.6.24/xen-fix-rmw-when-unmasking-events.patch b/queue-2.6.24/xen-fix-rmw-when-unmasking-events.patch new file mode 100644 index 00000000000..12571982107 --- /dev/null +++ b/queue-2.6.24/xen-fix-rmw-when-unmasking-events.patch @@ -0,0 +1,69 @@ +From stable-bounces@linux.kernel.org Thu Mar 27 13:36:43 2008 +Date: Thu, 27 Mar 2008 20:35:06 GMT +Message-Id: <200803272035.m2RKZ64n003743@hera.kernel.org> +From: jejb@kernel.org +To: jejb@kernel.org, stable@kernel.org +Subject: xen: fix RMW when unmasking events + +From: Jeremy Fitzhardinge + +upstream commit: 04c44a080d2f699a3042d4e743f7ad2ffae9d538 + +xen_irq_enable_direct and xen_sysexit were using "andw $0x00ff, +XEN_vcpu_info_pending(vcpu)" to unmask events and test for pending ones +in one instuction. + +Unfortunately, the pending flag must be modified with a locked operation +since it can be set by another CPU, and the unlocked form of this +operation was causing the pending flag to get lost, allowing the processor +to return to usermode with pending events and ultimately deadlock. + +The simple fix would be to make it a locked operation, but that's rather +costly and unnecessary. The fix here is to split the mask-clearing and +pending-testing into two instructions; the interrupt window between +them is of no concern because either way pending or new events will +be processed. + +This should fix lingering bugs in using direct vcpu structure access too. + +Signed-off-by: Jeremy Fitzhardinge +Signed-off-by: Ingo Molnar +Signed-off-by: Chris Wright +--- + arch/x86/xen/enlighten.c | 2 +- + arch/x86/xen/xen-asm.S | 9 +++++++-- + 2 files changed, 8 insertions(+), 3 deletions(-) + +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -95,7 +95,7 @@ struct shared_info *HYPERVISOR_shared_in + * + * 0: not available, 1: available + */ +-static int have_vcpu_info_placement = 0; ++static int have_vcpu_info_placement = 1; + + static void __init xen_vcpu_setup(int cpu) + { +--- a/arch/x86/xen/xen-asm.S ++++ b/arch/x86/xen/xen-asm.S +@@ -33,12 +33,17 @@ + events, then enter the hypervisor to get them handled. + */ + ENTRY(xen_irq_enable_direct) +- /* Clear mask and test pending */ +- andw $0x00ff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending ++ /* Unmask events */ ++ movb $0, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask ++ + /* Preempt here doesn't matter because that will deal with + any pending interrupts. The pending check may end up being + run on the wrong CPU, but that doesn't hurt. */ ++ ++ /* Test for pending */ ++ testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending + jz 1f ++ + 2: call check_events + 1: + ENDPATCH(xen_irq_enable_direct) diff --git a/queue-2.6.24/xen-fix-up-setup-of-shared_info.patch b/queue-2.6.24/xen-fix-up-setup-of-shared_info.patch new file mode 100644 index 00000000000..f7fa4122522 --- /dev/null +++ b/queue-2.6.24/xen-fix-up-setup-of-shared_info.patch @@ -0,0 +1,105 @@ +From stable-bounces@linux.kernel.org Thu Mar 27 13:35:57 2008 +Date: Thu, 27 Mar 2008 20:35:05 GMT +Message-Id: <200803272035.m2RKZ5Y9003725@hera.kernel.org> +From: jejb@kernel.org +To: jejb@kernel.org, stable@kernel.org +Subject: xen: fix UP setup of shared_info + +From: Jeremy Fitzhardinge + +upstream commit: 2e8fe719b57bbdc9e313daed1204bb55fed3ed44 + +We need to set up the shared_info pointer once we've mapped the real +shared_info into its fixmap slot. That needs to happen once the general +pagetable setup has been done. Previously, the UP shared_info was set +up one in xen_start_kernel, but that was left pointing to the dummy +shared info. Unfortunately there's no really good place to do a later +setup of the shared_info in UP, so just do it once the pagetable setup +has been done. + +Signed-off-by: Jeremy Fitzhardinge +Signed-off-by: Ingo Molnar +[chrisw@sous-sol.org: backport to 2.6.24.4] +Signed-off-by: Chris Wright +--- + arch/x86/xen/enlighten.c | 39 ++++++++++++++++++++++----------------- + 1 file changed, 22 insertions(+), 17 deletions(-) + +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -103,6 +103,7 @@ static void __init xen_vcpu_setup(int cp + int err; + struct vcpu_info *vcpup; + ++ BUG_ON(HYPERVISOR_shared_info == &dummy_shared_info); + per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; + + if (!have_vcpu_info_placement) +@@ -792,30 +793,40 @@ static __init void xen_pagetable_setup_s + xen_write_cr3(__pa(base)); + } + +-static __init void xen_pagetable_setup_done(pgd_t *base) ++static __init void setup_shared_info(void) + { +- /* This will work as long as patching hasn't happened yet +- (which it hasn't) */ +- pv_mmu_ops.alloc_pt = xen_alloc_pt; +- pv_mmu_ops.set_pte = xen_set_pte; +- + if (!xen_feature(XENFEAT_auto_translated_physmap)) { ++ unsigned long addr = fix_to_virt(FIX_PARAVIRT_BOOTMAP); ++ + /* + * Create a mapping for the shared info page. + * Should be set_fixmap(), but shared_info is a machine + * address with no corresponding pseudo-phys address. + */ +- set_pte_mfn(fix_to_virt(FIX_PARAVIRT_BOOTMAP), ++ set_pte_mfn(addr, + PFN_DOWN(xen_start_info->shared_info), + PAGE_KERNEL); + +- HYPERVISOR_shared_info = +- (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); +- ++ HYPERVISOR_shared_info = (struct shared_info *)addr; + } else + HYPERVISOR_shared_info = + (struct shared_info *)__va(xen_start_info->shared_info); + ++#ifndef CONFIG_SMP ++ /* In UP this is as good a place as any to set up shared info */ ++ xen_setup_vcpu_info_placement(); ++#endif ++} ++ ++static __init void xen_pagetable_setup_done(pgd_t *base) ++{ ++ /* This will work as long as patching hasn't happened yet ++ (which it hasn't) */ ++ pv_mmu_ops.alloc_pt = xen_alloc_pt; ++ pv_mmu_ops.set_pte = xen_set_pte; ++ ++ setup_shared_info(); ++ + /* Actually pin the pagetable down, but we can't set PG_pinned + yet because the page structures don't exist yet. */ + { +@@ -1166,15 +1177,9 @@ asmlinkage void __init xen_start_kernel( + x86_write_percpu(xen_cr3, __pa(pgd)); + x86_write_percpu(xen_current_cr3, __pa(pgd)); + +-#ifdef CONFIG_SMP + /* Don't do the full vcpu_info placement stuff until we have a +- possible map. */ ++ possible map and a non-dummy shared_info. */ + per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; +-#else +- /* May as well do it now, since there's no good time to call +- it later on UP. */ +- xen_setup_vcpu_info_placement(); +-#endif + + pv_info.kernel_rpl = 1; + if (xen_feature(XENFEAT_supervisor_mode_kernel)) diff --git a/queue-2.6.24/xen-mask-out-sep-from-cpuid.patch b/queue-2.6.24/xen-mask-out-sep-from-cpuid.patch new file mode 100644 index 00000000000..f2dcb436205 --- /dev/null +++ b/queue-2.6.24/xen-mask-out-sep-from-cpuid.patch @@ -0,0 +1,32 @@ +From d40e705903397445c6861a0a56c23e5b2e8f9b9a Mon Sep 17 00:00:00 2001 +From: Jeremy Fitzhardinge +Date: Fri, 29 Feb 2008 18:55:43 +0100 +Message-ID: <47ED1474.2040403@goop.org> +Subject: xen: mask out SEP from CPUID + +From: Jeremy Fitzhardinge + +upstream commit: d40e705903397445c6861a0a56c23e5b2e8f9b9a + +Fix 32-on-64 pvops kernel: + +we don't want userspace using syscall/sysenter, even if the hypervisor +supports it, so mask it out from CPUID. + +Signed-off-by: Jeremy Fitzhardinge +Signed-off-by: Ingo Molnar +Signed-off-by: Chris Wright +--- + arch/x86/xen/enlighten.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -153,6 +153,7 @@ static void xen_cpuid(unsigned int *eax, + if (*eax == 1) + maskedx = ~((1 << X86_FEATURE_APIC) | /* disable APIC */ + (1 << X86_FEATURE_ACPI) | /* disable ACPI */ ++ (1 << X86_FEATURE_SEP) | /* disable SEP */ + (1 << X86_FEATURE_ACC)); /* thermal monitoring */ + + asm(XEN_EMULATE_PREFIX "cpuid"