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] Move to Linux's cpumask_t and 'hotplug' multi-processor

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Move to Linux's cpumask_t and 'hotplug' multi-processor booting
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 25 May 2005 10:36:59 +0000
Delivery-date: Wed, 25 May 2005 11:01:40 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1548, 2005/05/25 11:36:59+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Move to Linux's cpumask_t and 'hotplug' multi-processor booting
        interfaces. This also brings apic.c and various other files closer to
        their Linux 2.6 equivalents. Simplified the scheduler interfaces a
        little (particularly per-cpu and idle-domain initialisation).
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/ia64/domain.c          |    1 
 arch/ia64/xensetup.c        |    3 
 arch/x86/acpi/boot.c        |    1 
 arch/x86/apic.c             |  108 +-
 arch/x86/cdb.c              |    2 
 arch/x86/dom0_ops.c         |    4 
 arch/x86/domain.c           |   27 
 arch/x86/domain_build.c     |    2 
 arch/x86/io_apic.c          |    2 
 arch/x86/irq.c              |    5 
 arch/x86/microcode.c        |    1 
 arch/x86/mtrr/main.c        |    2 
 arch/x86/nmi.c              |   16 
 arch/x86/setup.c            |   75 -
 arch/x86/shadow.c           |    2 
 arch/x86/smp.c              |    9 
 arch/x86/smpboot.c          | 1755 +++++++++++++++++++---------------
 arch/x86/time.c             |    3 
 arch/x86/traps.c            |    1 
 arch/x86/vmx.c              |   16 
 common/ac_timer.c           |    6 
 common/dom0_ops.c           |    9 
 common/domain.c             |    7 
 common/page_alloc.c         |    6 
 common/perfc.c              |   13 
 common/sched_bvt.c          |   59 -
 common/sched_sedf.c         | 2207 +++++++++++++++++++++-----------------------
 common/schedule.c           |  152 ---
 common/trace.c              |    4 
 include/asm-x86/asm_defns.h |    2 
 include/asm-x86/bitops.h    |  148 +-
 include/asm-x86/div64.h     |   39 
 include/asm-x86/flushtlb.h  |    2 
 include/asm-x86/irq.h       |   33 
 include/asm-x86/processor.h |    1 
 include/xen/bitmap.h        |    1 
 include/xen/cpumask.h       |  381 +++++++
 include/xen/kernel.h        |   24 
 include/xen/sched-if.h      |    8 
 include/xen/sched.h         |    4 
 include/xen/smp.h           |   34 
 41 files changed, 2841 insertions(+), 2334 deletions(-)


diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-05-25 07:02:24 -04:00
+++ b/xen/arch/ia64/domain.c    2005-05-25 07:02:24 -04:00
@@ -124,7 +124,6 @@
 {
        /* Just some sanity to ensure that the scheduler is set up okay. */
        ASSERT(current->domain == IDLE_DOMAIN_ID);
-       domain_unpause_by_systemcontroller(current->domain);
        raise_softirq(SCHEDULE_SOFTIRQ);
        do_softirq();
 
diff -Nru a/xen/arch/ia64/xensetup.c b/xen/arch/ia64/xensetup.c
--- a/xen/arch/ia64/xensetup.c  2005-05-25 07:02:24 -04:00
+++ b/xen/arch/ia64/xensetup.c  2005-05-25 07:02:24 -04:00
@@ -249,13 +249,11 @@
     /* Create initial domain 0. */
 printk("About to call do_createdomain()\n");
     dom0 = do_createdomain(0, 0);
-printk("About to call init_idle_task()\n");
     init_task.domain = &idle0_domain;
     init_task.processor = 0;
 //    init_task.mm = &init_mm;
     init_task.domain->arch.mm = &init_mm;
 //    init_task.thread = INIT_THREAD;
-    init_idle_task();
     //arch_do_createdomain(current);
 #ifdef CLONE_DOMAIN0
     {
@@ -314,7 +312,6 @@
     console_endboot(cmdline && strstr(cmdline, "tty0"));
 #endif
 
-    domain_unpause_by_systemcontroller(current->domain);
 #ifdef CLONE_DOMAIN0
     {
     int i;
diff -Nru a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c  2005-05-25 07:02:24 -04:00
+++ b/xen/arch/x86/acpi/boot.c  2005-05-25 07:02:24 -04:00
@@ -34,7 +34,6 @@
 #include <asm/io_apic.h>
 #include <asm/apic.h>
 #include <asm/io.h>
-#include <asm/irq.h>
 #include <asm/mpspec.h>
 #include <mach_apic.h>
 #include <mach_mpparse.h>
diff -Nru a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       2005-05-25 07:02:24 -04:00
+++ b/xen/arch/x86/apic.c       2005-05-25 07:02:25 -04:00
@@ -663,7 +663,7 @@
 
 #define APIC_DIVISOR 1
 
-static void __setup_APIC_LVTT(unsigned int clocks)
+void __setup_APIC_LVTT(unsigned int clocks)
 {
     unsigned int lvtt_value, tmp_value, ver;
 
@@ -680,30 +680,33 @@
     apic_write_around(APIC_TMICT, clocks/APIC_DIVISOR);
 }
 
-/*
- * this is done for every CPU from setup_APIC_clocks() below.
- * We setup each local APIC with a zero timeout value for now.
- * Unlike Linux, we don't have to wait for slices etc.
- */
-void setup_APIC_timer(void * data)
+static void __init setup_APIC_timer(unsigned int clocks)
 {
     unsigned long flags;
-    __save_flags(flags);
-    __sti();
-    __setup_APIC_LVTT(0);
-    __restore_flags(flags);
+    
+    local_irq_save(flags);
+
+    /*
+     * Wait for IRQ0's slice:
+     */
+    wait_timer_tick();
+
+    __setup_APIC_LVTT(clocks);
+
+    local_irq_restore(flags);
 }
 
 /*
- * In this function we calibrate APIC bus clocks to the external timer.
- *
- * As a result we have the Bus Speed and CPU speed in Hz.
- * 
- * We want to do the calibration only once (for CPU0).  CPUs connected by the
- * same APIC bus have the very same bus frequency.
+ * In this function we calibrate APIC bus clocks to the external
+ * timer. Unfortunately we cannot use jiffies and the timer irq
+ * to calibrate, since some later bootup code depends on getting
+ * the first irq? Ugh.
  *
- * This bit is a bit shoddy since we use the very same periodic timer interrupt
- * we try to eliminate to calibrate the APIC. 
+ * We want to do the calibration only once since we
+ * want to have local timer irqs syncron. CPUs connected
+ * by the same APIC bus have the very same bus frequency.
+ * And we want to have irqs off anyways, no accidental
+ * APIC irq that way.
  */
 
 int __init calibrate_APIC_clock(void)
@@ -780,21 +783,48 @@
     return result;
 }
 
-/*
- * initialise the APIC timers for all CPUs
- * we start with the first and find out processor frequency and bus speed
- */
-void __init setup_APIC_clocks (void)
+
+static unsigned int calibration_result;
+
+void __init setup_boot_APIC_clock(void)
 {
+    apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n");
     using_apic_timer = 1;
-    __cli();
-    /* calibrate CPU0 for CPU speed and BUS speed */
-    bus_freq = calibrate_APIC_clock();
-    /* Now set up the timer for real. */
-    setup_APIC_timer((void *)bus_freq);
-    __sti();
-    /* and update all other cpus */
-    smp_call_function(setup_APIC_timer, (void *)bus_freq, 1, 1);
+
+    local_irq_disable();
+    
+    calibration_result = calibrate_APIC_clock();
+    /*
+     * Now set up the timer for real.
+     */
+    setup_APIC_timer(calibration_result);
+    
+    local_irq_enable();
+}
+
+void __init setup_secondary_APIC_clock(void)
+{
+    setup_APIC_timer(calibration_result);
+}
+
+void __init disable_APIC_timer(void)
+{
+    if (using_apic_timer) {
+        unsigned long v;
+        
+        v = apic_read(APIC_LVTT);
+        apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED);
+    }
+}
+
+void enable_APIC_timer(void)
+{
+    if (using_apic_timer) {
+        unsigned long v;
+        
+        v = apic_read(APIC_LVTT);
+        apic_write_around(APIC_LVTT, v & ~APIC_LVT_MASKED);
+    }
 }
 
 #undef APIC_DIVISOR
@@ -885,7 +915,7 @@
         ack_APIC_irq();
 
     /* see sw-dev-man vol 3, chapter 7.4.13.5 */
-    printk("spurious APIC interrupt on CPU#%d, should never happen.\n",
+    printk(KERN_INFO "spurious APIC interrupt on CPU#%d, should never 
happen.\n",
            smp_processor_id());
 }
 
@@ -914,8 +944,8 @@
        6: Received illegal vector
        7: Illegal register address
     */
-    printk("APIC error on CPU%d: %02lx(%02lx)\n",
-            smp_processor_id(), v, v1);
+    printk (KERN_DEBUG "APIC error on CPU%d: %02lx(%02lx)\n",
+            smp_processor_id(), v , v1);
 }
 
 /*
@@ -940,20 +970,18 @@
 
     connect_bsp_APIC();
 
-#ifdef CONFIG_SMP
-    cpu_online_map = 1;
-#endif
     phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
-    apic_write_around(APIC_ID, boot_cpu_physical_apicid);
 
     setup_local_APIC();
 
+    if (nmi_watchdog == NMI_LOCAL_APIC)
+        check_nmi_watchdog();
 #ifdef CONFIG_X86_IO_APIC
     if (smp_found_config)
         if (!skip_ioapic_setup && nr_ioapics)
             setup_IO_APIC();
 #endif
-    setup_APIC_clocks();
+    setup_boot_APIC_clock();
 
     return 0;
 }
diff -Nru a/xen/arch/x86/cdb.c b/xen/arch/x86/cdb.c
--- a/xen/arch/x86/cdb.c        2005-05-25 07:02:23 -04:00
+++ b/xen/arch/x86/cdb.c        2005-05-25 07:02:24 -04:00
@@ -9,7 +9,7 @@
 #include <xen/lib.h>
 #include <asm/uaccess.h>
 #include <xen/serial.h>
-#include <asm/irq.h>
+#include <xen/irq.h>
 #include <xen/spinlock.h>
 #include <asm/debugger.h>
 #include <xen/init.h>
diff -Nru a/xen/arch/x86/dom0_ops.c b/xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c   2005-05-25 07:02:24 -04:00
+++ b/xen/arch/x86/dom0_ops.c   2005-05-25 07:02:24 -04:00
@@ -176,8 +176,8 @@
     {
         dom0_physinfo_t *pi = &op->u.physinfo;
 
-        pi->ht_per_core = opt_noht ? 1 : ht_per_core;
-        pi->cores       = smp_num_cpus / pi->ht_per_core;
+        pi->ht_per_core = ht_per_core;
+        pi->cores       = num_online_cpus() / ht_per_core;
         pi->total_pages = max_page;
         pi->free_pages  = avail_domheap_pages();
         pi->cpu_khz     = cpu_khz;
diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-05-25 07:02:24 -04:00
+++ b/xen/arch/x86/domain.c     2005-05-25 07:02:24 -04:00
@@ -73,44 +73,31 @@
 void idle_loop(void)
 {
     int cpu = smp_processor_id();

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Move to Linux's cpumask_t and 'hotplug' multi-processor booting, BitKeeper Bot <=