diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2016-04-25 14:14:17 +0100 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2016-04-27 09:55:54 +0100 |
commit | 32b7578e829fc4086bc8efe2ebfdf603264dbae0 (patch) | |
tree | becb6edbf8a6acb6469b4eecce946ad90cbd77fa /lib/power_management/suspend/tftf_suspend.c | |
parent | 1cab674f905a1fb2ce08537aa415f600bf91259b (diff) |
Fix TFTF timer tests on FVP Foundation model
When running the TFTF timer test cases on FVP Foundation model
sometimes they hang. This only happens when the TFTF is built in
debug mode.
For the test case stress_test_timer_framework() the following happens:
do_stress_test() consists of a loop in which a timer is set up, then
the CPU enters suspend mode and the timer IRQ wakes the CPU up. The
instant the timers wake up is a random instant based on the current
system timer plus a random delay.
The reason they failed is that, in debug mode, the debug output
sometimes takes too long to complete, as printing text to the console
can take a relatively long time. As the Foundation model is using the
--use-real-time option, this effect was magnified. During this time,
the timer IRQ is sometimes handled, preventing the CPU from waking up.
When compiling in release mode, this output isn't printed, so the CPU
has enough time to enter suspend mode before the interrupt.
IRQs are now masked when trying to enter suspend mode. That way, even
if it takes some time to actually enter suspend mode, an early
interrupt will become pending and the CPU just won't be able to enter
suspend mode. An extra API called `tftf_program_timer_and_suspend` has
been added to make it easier to develop other test cases where the CPU
may enter suspend mode and a timer is supposed to wake it up.
The timer framework used to unconditionally disable IRQs upon entry
and enabling them upon exit. This means that IRQs used to always be
unmasked, even in the case where they were masked upon entry. This
behaviour has been fixed to preserve the DAIF flags instead (their
state is saved upon entry and restored upon exit).
The test, disabled in a previous commit, has been enabled again.
Change-Id: Ia86619a7f30483d77029e583c94265993f578a0f
Diffstat (limited to 'lib/power_management/suspend/tftf_suspend.c')
-rw-r--r-- | lib/power_management/suspend/tftf_suspend.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/power_management/suspend/tftf_suspend.c b/lib/power_management/suspend/tftf_suspend.c index 69eff9f..3e8cd93 100644 --- a/lib/power_management/suspend/tftf_suspend.c +++ b/lib/power_management/suspend/tftf_suspend.c @@ -110,6 +110,9 @@ int tftf_suspend(const suspend_info_t *info) flags = read_daif(); + disable_irq(); + isb(); + INFO("Going into suspend state\n"); /* Save the local GIC context */ |