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

[Xen-changelog] [xen-4.0-testing] kexec: Clean up shutdown logic. Reinst

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec.
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 03 Aug 2010 00:30:28 -0700
Delivery-date: Tue, 03 Aug 2010 00:31:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1280765917 -3600
# Node ID 8bdf09baff3087d11388cb96b0fe75a9a8cffc8d
# Parent  6a0a88e35278e0d68ed273751af7328dcfa03a6d
kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   21886:578ed14c3c67
xen-unstable date:        Thu Jul 29 10:31:21 2010 +0100
---
 xen/arch/x86/crash.c               |   24 +++++++++-------------
 xen/arch/x86/machine_kexec.c       |   37 ++++++-----------------------------
 xen/arch/x86/smp.c                 |    2 -
 xen/arch/x86/tboot.c               |    5 +++-
 xen/common/kexec.c                 |   39 ++++++++++++++++++++++++++++++-------
 xen/drivers/acpi/tables.c          |    4 +--
 xen/drivers/passthrough/vtd/dmar.c |    3 +-
 xen/include/asm-x86/smp.h          |    3 ++
 8 files changed, 61 insertions(+), 56 deletions(-)

diff -r 6a0a88e35278 -r 8bdf09baff30 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c      Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/arch/x86/crash.c      Mon Aug 02 17:18:37 2010 +0100
@@ -25,7 +25,6 @@
 #include <public/xen.h>
 #include <asm/shared.h>
 #include <asm/hvm/support.h>
-#include <asm/hpet.h>
 
 static atomic_t waiting_for_crash_ipi;
 static unsigned int crashing_cpu;
@@ -41,9 +40,10 @@ static int crash_nmi_callback(struct cpu
     local_irq_disable();
 
     kexec_crash_save_cpu();
-    disable_local_APIC();
+
+    __stop_this_cpu();
+
     atomic_dec(&waiting_for_crash_ipi);
-    hvm_cpu_down();
 
     for ( ; ; )
         halt();
@@ -55,7 +55,10 @@ static void nmi_shootdown_cpus(void)
 {
     unsigned long msecs;
 
+    local_irq_disable();
+
     crashing_cpu = smp_processor_id();
+    local_irq_count(crashing_cpu) = 0;
 
     atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
     /* Would it be better to replace the trap vector here? */
@@ -72,24 +75,17 @@ static void nmi_shootdown_cpus(void)
         msecs--;
     }
 
-    /* Leave the nmi callback set */
-    disable_local_APIC();
+    __stop_this_cpu();
+    disable_IO_APIC();
+
+    local_irq_enable();
 }
 
 void machine_crash_shutdown(void)
 {
     crash_xen_info_t *info;
 
-    local_irq_disable();
-
     nmi_shootdown_cpus();
-
-    if ( hpet_broadcast_is_available() )
-        hpet_disable_legacy_broadcast();
-
-    disable_IO_APIC();
-
-    hvm_cpu_down();
 
     info = kexec_crash_save_info();
     info->xen_phys_start = xen_phys_start;
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/arch/x86/machine_kexec.c
--- a/xen/arch/x86/machine_kexec.c      Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/arch/x86/machine_kexec.c      Mon Aug 02 17:18:37 2010 +0100
@@ -18,6 +18,7 @@
 #include <xen/domain_page.h>
 #include <asm/fixmap.h>
 #include <asm/hvm/hvm.h>
+#include <asm/hpet.h>
 
 typedef void (*relocate_new_kernel_t)(
                 unsigned long indirection_page,
@@ -76,38 +77,11 @@ void machine_kexec_unload(int type, int 
 {
 }
 
-static void __machine_reboot_kexec(void *data)
-{
-    xen_kexec_image_t *image = (xen_kexec_image_t *)data;
-
-    watchdog_disable();
-    console_start_sync();
-
-    smp_send_stop();
-
-    machine_kexec(image);
-}
-
 void machine_reboot_kexec(xen_kexec_image_t *image)
 {
-    int reboot_cpu_id;
-
-    reboot_cpu_id = 0;
-
-    if ( !cpu_isset(reboot_cpu_id, cpu_online_map) )
-        reboot_cpu_id = smp_processor_id();
-
-    if ( reboot_cpu_id != smp_processor_id() )
-    {
-        on_selected_cpus(cpumask_of(reboot_cpu_id), __machine_reboot_kexec,
-                         image, 0);
-        for (;;)
-                ; /* nothing */
-    }
-    else
-    {
-        __machine_reboot_kexec(image);
-    }
+    BUG_ON(smp_processor_id() != 0);
+    smp_send_stop();
+    machine_kexec(image);
     BUG();
 }
 
@@ -117,6 +91,9 @@ void machine_kexec(xen_kexec_image_t *im
         .base = (unsigned long)(boot_cpu_gdt_table - FIRST_RESERVED_GDT_ENTRY),
         .limit = LAST_RESERVED_GDT_BYTE
     };
+
+    if ( hpet_broadcast_is_available() )
+        hpet_disable_legacy_broadcast();
 
     /*
      * compat_machine_kexec() returns to idle pagetables, which requires us
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c        Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/arch/x86/smp.c        Mon Aug 02 17:18:37 2010 +0100
@@ -326,7 +326,7 @@ int on_selected_cpus(
     return 0;
 }
 
-static void __stop_this_cpu(void)
+void __stop_this_cpu(void)
 {
     ASSERT(!local_irq_is_enabled());
 
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c      Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/arch/x86/tboot.c      Mon Aug 02 17:18:37 2010 +0100
@@ -482,7 +482,10 @@ int __init tboot_parse_dmar_table(acpi_t
     dmar_table = NULL;
     acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table);
     if ( dmar_table != NULL )
-        ((struct acpi_table_dmar *)dmar_table)->header.signature[0] = '\0';
+    {
+        dmar_table->signature[0] = 'X';
+        dmar_table->checksum -= 'X'-'D';
+    }
 
     return rc;
 }
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/common/kexec.c
--- a/xen/common/kexec.c        Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/common/kexec.c        Mon Aug 02 17:18:37 2010 +0100
@@ -6,7 +6,9 @@
  * - Magnus Damm <magnus@xxxxxxxxxxxxx>
  */
 
+#include <xen/init.h>
 #include <xen/lib.h>
+#include <xen/acpi.h>
 #include <xen/ctype.h>
 #include <xen/errno.h>
 #include <xen/guest_access.h>
@@ -107,6 +109,22 @@ crash_xen_info_t *kexec_crash_save_info(
     return out;
 }
 
+static int acpi_dmar_reinstate(struct acpi_table_header *table)
+{
+    table->signature[0] = 'D';
+    table->checksum += 'X'-'D';
+    return 0;
+}
+
+static void kexec_common_shutdown(void)
+{
+    watchdog_disable();
+    console_start_sync();
+    spin_debug_disable();
+    one_cpu_only();
+    acpi_table_parse(ACPI_SIG_DMAR, acpi_dmar_reinstate);
+}
+
 void kexec_crash(void)
 {
     int pos;
@@ -115,15 +133,23 @@ void kexec_crash(void)
     if ( !test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
         return;
 
-    console_start_sync();
-
-    one_cpu_only();
+    kexec_common_shutdown();
     kexec_crash_save_cpu();
     machine_crash_shutdown();
-
     machine_kexec(&kexec_image[KEXEC_IMAGE_CRASH_BASE + pos]);
 
     BUG();
+}
+
+static long kexec_reboot(void *_image)
+{
+    xen_kexec_image_t *image = _image;
+
+    kexec_common_shutdown();
+    machine_reboot_kexec(image);
+
+    BUG();
+    return 0;
 }
 
 static void do_crashdump_trigger(unsigned char key)
@@ -446,7 +472,7 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
 {
     xen_kexec_exec_t exec;
     xen_kexec_image_t *image;
-    int base, bit, pos;
+    int base, bit, pos, ret = -EINVAL;
 
     if ( unlikely(copy_from_guest(&exec, uarg, 1)) )
         return -EFAULT;
@@ -464,8 +490,7 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
     {
     case KEXEC_TYPE_DEFAULT:
         image = &kexec_image[base + pos];
-        one_cpu_only();
-        machine_reboot_kexec(image); /* Does not return */
+        ret = continue_hypercall_on_cpu(0, kexec_reboot, image);
         break;
     case KEXEC_TYPE_CRASH:
         kexec_crash(); /* Does not return */
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/drivers/acpi/tables.c
--- a/xen/drivers/acpi/tables.c Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/drivers/acpi/tables.c Mon Aug 02 17:18:37 2010 +0100
@@ -41,7 +41,7 @@ static const char *__initdata
 static const char *__initdata
 mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
 
-static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
+static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES];
 
 static int acpi_apic_instance __initdata;
 
@@ -239,7 +239,7 @@ acpi_table_parse_madt(enum acpi_madt_typ
  * Scan the ACPI System Descriptor Table (STD) for a table matching @id,
  * run @handler on it.  Return 0 if table found, return on if not.
  */
-int __init acpi_table_parse(char *id, acpi_table_handler handler)
+int acpi_table_parse(char *id, acpi_table_handler handler)
 {
        struct acpi_table_header *table = NULL;
 
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c        Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c        Mon Aug 02 17:18:37 2010 +0100
@@ -738,7 +738,8 @@ static int __init acpi_parse_dmar(struct
 
 out:
     /* Zap ACPI DMAR signature to prevent dom0 using vt-d HW. */
-    dmar->header.signature[0] = '\0';
+    dmar->header.signature[0] = 'X';
+    dmar->header.checksum -= 'X'-'D';
     return ret;
 }
 
diff -r 6a0a88e35278 -r 8bdf09baff30 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h Mon Aug 02 17:17:55 2010 +0100
+++ b/xen/include/asm-x86/smp.h Mon Aug 02 17:18:37 2010 +0100
@@ -102,6 +102,9 @@ static __inline int logical_smp_processo
 
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
+
+void __stop_this_cpu(void);
+
 #endif /* !__ASSEMBLY__ */
 
 #else /* CONFIG_SMP */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec., Xen patchbot-4.0-testing <=