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

[Xen-changelog] [linux-2.6.18-xen] Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209635617 -3600
# Node ID d62d60eaba6e7fea87847b2e8042146aea61a871
# Parent  e97855b90cc280e75c583cc6ac78d924f8cf16b8
Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0.

Just try to pass info about all acpi processors to xen even in such cases.

Signed-off-by: Tian Kevin <kevin.tian@xxxxxxxxx>
Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---
 arch/i386/kernel/acpi/processor.c |   10 ++++++++--
 drivers/acpi/processor_core.c     |   30 +++++++++++++++++++-----------
 include/acpi/processor.h          |    2 ++
 3 files changed, 29 insertions(+), 13 deletions(-)

diff -r e97855b90cc2 -r d62d60eaba6e arch/i386/kernel/acpi/processor.c
--- a/arch/i386/kernel/acpi/processor.c Thu May 01 10:53:07 2008 +0100
+++ b/arch/i386/kernel/acpi/processor.c Thu May 01 10:53:37 2008 +0100
@@ -59,10 +59,16 @@ static void init_intel_pdc(struct acpi_p
        return;
 }
 
-/* Initialize _PDC data based on the CPU vendor */
+/* 
+ * Initialize _PDC data based on the CPU vendor. As a work-around, just
+ * use cpu0's cpuinfo for all processors. Further work is required 
+ * to expose xen hypervisor interface of getting physical cpuinfo to dom0
+ * kerneland then arch_acpi_processor_init_pdc can set _PDC parameters 
+ * according to Xen's phys information.
+ */
 void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
-       unsigned int cpu = pr->id;
+       unsigned int cpu = 0;
        struct cpuinfo_x86 *c = cpu_data + cpu;
 
        pr->pdc = NULL;
diff -r e97855b90cc2 -r d62d60eaba6e drivers/acpi/processor_core.c
--- a/drivers/acpi/processor_core.c     Thu May 01 10:53:07 2008 +0100
+++ b/drivers/acpi/processor_core.c     Thu May 01 10:53:37 2008 +0100
@@ -475,7 +475,8 @@ static int acpi_processor_get_info(struc
         */
        if (cpu_index == -1) {
                if (ACPI_FAILURE
-                   (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
+                   (acpi_processor_hotadd_init(pr->handle, &pr->id)) &&
+                   !processor_cntl_external()) {
                        printk(KERN_ERR PREFIX
                                    "Getting cpuindex for acpiid 0x%x\n",
                                    pr->acpi_id);
@@ -517,7 +518,7 @@ static int acpi_processor_get_info(struc
        return 0;
 }
 
-static void *processor_device_array[NR_CPUS];
+static void *processor_device_array[NR_ACPI_CPUS];
 
 static int acpi_processor_start(struct acpi_device *device)
 {
@@ -529,27 +530,29 @@ static int acpi_processor_start(struct a
        pr = acpi_driver_data(device);
 
        result = acpi_processor_get_info(pr);
-       if (result) {
+       if (result || 
+           ((pr->id == -1) && !processor_cntl_external())) {
                /* Processor is physically not present */
                return 0;
        }
 
-       BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
+       BUG_ON(!processor_cntl_external() &&
+              ((pr->id >= NR_CPUS) || (pr->id < 0)));
 
        /*
         * Buggy BIOS check
         * ACPI id of processors can be reported wrongly by the BIOS.
         * Don't trust it blindly
         */
-       if (processor_device_array[pr->id] != NULL &&
-           processor_device_array[pr->id] != (void *)device) {
+       if (processor_device_array[pr->acpi_id] != NULL &&
+           processor_device_array[pr->acpi_id] != (void *)device) {
                printk(KERN_WARNING "BIOS reported wrong ACPI id"
                        "for the processor\n");
                return -ENODEV;
        }
-       processor_device_array[pr->id] = (void *)device;
-
-       processors[pr->id] = pr;
+       processor_device_array[pr->acpi_id] = (void *)device;
+       if (pr->id != -1)
+               processors[pr->id] = pr;
 
        result = acpi_processor_add_fs(device);
        if (result)
@@ -660,7 +663,8 @@ static int acpi_processor_remove(struct 
 
        acpi_processor_remove_fs(device);
 
-       processors[pr->id] = NULL;
+       if (pr->id != -1)
+               processors[pr->id] = NULL;
 
        kfree(pr);
 
@@ -789,7 +793,8 @@ acpi_processor_hotplug_notify(acpi_handl
                        return;
                }
 
-               if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
+               if ((pr->id >= 0) && (pr->id < NR_CPUS)
+                   && (cpu_present(pr->id)))
                        kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 
                if (processor_cntl_external())
@@ -860,6 +865,9 @@ static acpi_status acpi_processor_hotadd
 
 static int acpi_processor_handle_eject(struct acpi_processor *pr)
 {
+       if (pr->id == -1)
+               return (0);
+
        if (cpu_online(pr->id)) {
                return (-EINVAL);
        }
diff -r e97855b90cc2 -r d62d60eaba6e include/acpi/processor.h
--- a/include/acpi/processor.h  Thu May 01 10:53:07 2008 +0100
+++ b/include/acpi/processor.h  Thu May 01 10:53:37 2008 +0100
@@ -20,6 +20,8 @@
 
 #define ACPI_PSD_REV0_REVISION         0 /* Support for _PSD as in ACPI 3.0 */
 #define ACPI_PSD_REV0_ENTRIES          5
+
+#define NR_ACPI_CPUS                   256
 
 /*
  * Types of coordination defined in ACPI 3.0. Same macros can be used across

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


 


Rackspace

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