summaryrefslogtreecommitdiff
path: root/lib/power_management/hotplug
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2016-01-27 15:10:32 +0000
committerSoby Mathew <soby.mathew@arm.com>2016-03-29 11:10:30 +0100
commitda768cffce2b8686c92a49f92398c35a8c421e2d (patch)
tree6fb452e38fdc9a0a27f39224dad6683bdff6b7b1 /lib/power_management/hotplug
parentf261bbcdd7c3dab812a2ca9dec2d365a11c41a2a (diff)
Optimize locking in tftf_try_cpu_on() implementation
This patch optimizes the locking in tftf_try_cpu_on() by moving the spin lock acquisition after the PSCI CPU ON smc call. This allows multiple CPU ON calls to be made to the firmware. Also the ERROR print on failure of PSCI CPU ON is removed as the tftf_try_cpu_on() API is intended to test the error values from PSCI CPU ON and the logging slows down the rate at which the API can be invoked for stress testing. Change-Id: I6fe7fbddc78f1f82ac6423ecb2a3651e56d8e678
Diffstat (limited to 'lib/power_management/hotplug')
-rw-r--r--lib/power_management/hotplug/hotplug.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/power_management/hotplug/hotplug.c b/lib/power_management/hotplug/hotplug.c
index 7c5be95..97e3298 100644
--- a/lib/power_management/hotplug/hotplug.c
+++ b/lib/power_management/hotplug/hotplug.c
@@ -210,26 +210,25 @@ int32_t tftf_try_cpu_on(uint64_t target_cpu,
int32_t ret;
unsigned int core_pos = platform_get_core_pos(target_cpu);
- spin_lock(&cpus_status_map[core_pos].lock);
-
ret = tftf_psci_cpu_on(target_cpu,
(uint64_t) tftf_hotplug_entry,
context_id);
if (ret == PSCI_E_SUCCESS) {
- assert(cpus_status_map[core_pos].state == TFTF_AFFINITY_STATE_OFF);
- cpus_status_map[core_pos].state = TFTF_AFFINITY_STATE_ON_PENDING;
+ spin_lock(&cpus_status_map[core_pos].lock);
+ assert(cpus_status_map[core_pos].state ==
+ TFTF_AFFINITY_STATE_OFF);
+ cpus_status_map[core_pos].state =
+ TFTF_AFFINITY_STATE_ON_PENDING;
+
+ spin_unlock(&cpus_status_map[core_pos].lock);
/*
* Populate the test entry point for this core.
- * This is the address where the core will jump to once the framework
- * has finished initialising it.
+ * This is the address where the core will jump to once the
+ * framework has finished initialising it.
*/
test_entrypoint[core_pos] = (test_function_t) entrypoint;
- spin_unlock(&cpus_status_map[core_pos].lock);
- } else {
- spin_unlock(&cpus_status_map[core_pos].lock);
- ERROR("Failed to boot CPU 0x%lx (%d)\n", target_cpu, ret);
}
return ret;