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

[Xen-changelog] [linux-2.6.18-xen] Notify ACPI processor events to external logic, including C/P/T and hotplug, etc.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209635551 -3600
# Node ID 3c564f80f2ef2b458f9a81598c0928acb72cc891
# Parent  3da869d5095b191050f1527b896d87f3afab3f27
Notify ACPI processor events to external logic, including C/P/T and hotplug, 
etc.

Signed-off-by: Tian Kevin <kevin.tian@xxxxxxxxx>
Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---
 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c |    9 +++++++++
 drivers/acpi/processor_core.c               |   17 +++++++++++++++++
 drivers/acpi/processor_idle.c               |   13 ++++++++++---
 drivers/acpi/processor_perflib.c            |    5 ++++-
 4 files changed, 40 insertions(+), 4 deletions(-)

diff -r 3da869d5095b -r 3c564f80f2ef arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c       Thu May 01 10:52:06 
2008 +0100
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c       Thu May 01 10:52:31 
2008 +0100
@@ -568,6 +568,15 @@ acpi_cpufreq_init (void)
 {
        dprintk("acpi_cpufreq_init\n");
 
+       /*
+        * This effectively blocks in-kernel cpufreq driver to interfere
+        * external control logic
+        */
+       if (processor_pmperf_external()) {
+               printk("CPUFREQ is controllerd externally...exit then!\n");
+               return -1;
+       }
+
        acpi_cpufreq_early_init_acpi();
 
        return cpufreq_register_driver(&acpi_cpufreq_driver);
diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_core.c
--- a/drivers/acpi/processor_core.c     Thu May 01 10:52:06 2008 +0100
+++ b/drivers/acpi/processor_core.c     Thu May 01 10:52:31 2008 +0100
@@ -564,6 +564,10 @@ static int acpi_processor_start(struct a
 
        acpi_processor_power_init(pr, device);
 
+#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
+       processor_extcntl_init(pr);
+#endif
+
        if (pr->flags.throttling) {
                printk(KERN_INFO PREFIX "%s [%s] (supports",
                       acpi_device_name(device), acpi_device_bid(device));
@@ -709,6 +713,10 @@ int acpi_processor_device_add(acpi_handl
        pr = acpi_driver_data(*device);
        if (!pr)
                return -ENODEV;
+
+       if (processor_cntl_external())
+               processor_notify_external(pr,
+                       PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
 
        if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
                kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
@@ -747,6 +755,10 @@ acpi_processor_hotplug_notify(acpi_handl
                        printk(KERN_ERR PREFIX "Driver data is NULL\n");
                        break;
                }
+
+               if (processor_cntl_external())
+                       processor_notify_external(pr,
+                                       PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
 
                if (pr->id >= 0 && (pr->id < NR_CPUS)) {
                        kobject_uevent(&device->kobj, KOBJ_OFFLINE);
@@ -779,6 +791,11 @@ acpi_processor_hotplug_notify(acpi_handl
 
                if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
                        kobject_uevent(&device->kobj, KOBJ_OFFLINE);
+
+               if (processor_cntl_external())
+                       processor_notify_external(pr, PROCESSOR_HOTPLUG,
+                                                       HOTPLUG_TYPE_REMOVE);
+
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_idle.c
--- a/drivers/acpi/processor_idle.c     Thu May 01 10:52:06 2008 +0100
+++ b/drivers/acpi/processor_idle.c     Thu May 01 10:52:31 2008 +0100
@@ -985,12 +985,16 @@ int acpi_processor_cst_has_changed(struc
                return -ENODEV;
 
        /* Fall back to the default idle loop */
-       pm_idle = pm_idle_save;
+       if (!processor_pm_external())
+               pm_idle = pm_idle_save;
        synchronize_sched();    /* Relies on interrupts forcing exit from idle. 
*/
 
        pr->flags.power = 0;
        result = acpi_processor_get_power_info(pr);
-       if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
+       if (processor_pm_external())
+               processor_notify_external(pr,
+                       PROCESSOR_PM_CHANGE, PM_TYPE_IDLE);
+       else if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
                pm_idle = acpi_processor_idle;
 
        return result;
@@ -1122,7 +1126,7 @@ int acpi_processor_power_init(struct acp
                                       pr->power.states[i].type);
                printk(")\n");
 
-               if (pr->id == 0) {
+               if (!processor_pm_external() && (pr->id == 0)) {
                        pm_idle_save = pm_idle;
                        pm_idle = acpi_processor_idle;
                }
@@ -1141,6 +1145,9 @@ int acpi_processor_power_init(struct acp
 
        pr->flags.power_setup_done = 1;
 
+       if (processor_pm_external())
+               processor_notify_external(pr,
+                       PROCESSOR_PM_INIT, PM_TYPE_IDLE);
        return 0;
 }
 
diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_perflib.c
--- a/drivers/acpi/processor_perflib.c  Thu May 01 10:52:06 2008 +0100
+++ b/drivers/acpi/processor_perflib.c  Thu May 01 10:52:31 2008 +0100
@@ -136,8 +136,11 @@ int acpi_processor_ppc_has_changed(struc
        int ret = acpi_processor_get_platform_limit(pr);
        if (ret < 0)
                return (ret);
+       else if (!processor_pmperf_external())
+               return cpufreq_update_policy(pr->id);
        else
-               return cpufreq_update_policy(pr->id);
+               return processor_notify_external(pr,
+                               PROCESSOR_PM_CHANGE, PM_TYPE_PERF);
 }
 
 void acpi_processor_ppc_init(void)

_______________________________________________
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®.