summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2018-04-12 17:06:20 +0200
committerSandrine Bailleux <sandrine.bailleux@arm.com>2018-04-12 17:14:41 +0200
commit63ae06cec4b5e7e1010e638bc407e98ad2bf8020 (patch)
tree0ae3c559337b15ff8586acb3d63c375737a17bfa
parent848fffb161c4c48e61ec9b2780848f2db2bda1cf (diff)
Remove calls to mp_printf() in ISRs
We should never call mp_printf() in ISRs because this function tries to acquire the printf spinlock, which can put us in a deadlock situation. Imagine a test where: 1) We register an ISR for the timer interrupt. This ISR calls mp_printf(). 2) We program the timer to fire in the near future. 3) We print something on the console. Now, if the timer interrupt fires while we were printing on the console (i.e. while holding the printf lock) then the ISR will never be able to acquire the lock again and that will just lock up the system. This also applies to the INFO/VERBOSE/... macros which call into mp_printf(). This patch removes all prints from ISRs in existing tests. Change-Id: Idffc02dbdf0f730790b1f1602e50b805073acc27 Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
-rw-r--r--framework/timer/timer_framework.c7
-rw-r--r--tests/framework_validation_tests/test_validation_sgi.c2
-rw-r--r--tests/runtime_services/secure_service/legacy/test_secure_service_interrupts.c1
3 files changed, 6 insertions, 4 deletions
diff --git a/framework/timer/timer_framework.c b/framework/timer/timer_framework.c
index fd44aa3..593644b 100644
--- a/framework/timer/timer_framework.c
+++ b/framework/timer/timer_framework.c
@@ -453,7 +453,12 @@ int tftf_timer_framework_handler(void *data)
plat_timer_info->handler();
if (arm_gic_is_intr_pending(TIMER_IRQ)) {
- ERROR(" Timer IRQ still pending. Fatal error.\n");
+ /*
+ * We might never manage to acquire the printf lock here
+ * (because we are in ISR context) but we're gonna panic right
+ * after anyway so it doesn't really matter.
+ */
+ ERROR("Timer IRQ still pending. Fatal error.\n");
panic();
}
diff --git a/tests/framework_validation_tests/test_validation_sgi.c b/tests/framework_validation_tests/test_validation_sgi.c
index b375b6f..f7a1814 100644
--- a/tests/framework_validation_tests/test_validation_sgi.c
+++ b/tests/framework_validation_tests/test_validation_sgi.c
@@ -47,8 +47,6 @@ static volatile unsigned int sgi_handled;
static int sgi_handler(void *data)
{
- VERBOSE("Entering SGI handler\n");
-
/* Save SGI data */
sgi_data = *(sgi_data_t *) data;
sgi_handled = 1;
diff --git a/tests/runtime_services/secure_service/legacy/test_secure_service_interrupts.c b/tests/runtime_services/secure_service/legacy/test_secure_service_interrupts.c
index 549ca48..c9eebe4 100644
--- a/tests/runtime_services/secure_service/legacy/test_secure_service_interrupts.c
+++ b/tests/runtime_services/secure_service/legacy/test_secure_service_interrupts.c
@@ -27,7 +27,6 @@ static int timer_handler(void *data)
{
assert(timer_irq_received == 0);
timer_irq_received = 1;
- INFO("Timer interrupt handled\n");
return 0;
}