From 102d7670c3f1b576332d77dfbedde7200e8229c2 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Fri, 28 Feb 2020 17:06:44 +0900 Subject: [PATCH] testing: ostest: Add workaround for SMP in cond.c Signed-off-by: Masayuki Ishikawa --- testing/ostest/cond.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/testing/ostest/cond.c b/testing/ostest/cond.c index 5c0108577..5a380664a 100644 --- a/testing/ostest/cond.c +++ b/testing/ostest/cond.c @@ -181,6 +181,19 @@ static void *thread_signaler(void *parameter) signaler_nerrors++; } +#if CONFIG_SMP_NCPUS > 1 + /* Workaround for SMP: + * In multi-core environment, thread_signaler would be excecuted prior + * to the thread_waiter, even though priority of thread_signaler is + * lower than the thread_waiter. In this case, thread_signaler will + * aquire mutex before the thread_waiter aquires it and will show + * the error message such as "thread_signaler: ERROR waiter state...". + * To avoid this situaltion, we add the following usleep() + */ + + usleep(10 * 1000); +#endif + signaler_nloops++; }