diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-12-06 11:36:16 -0600 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-12-13 14:06:02 +1100 |
commit | 6e975e1d0fdafdf6cf534da7742b57a538c4fa28 (patch) | |
tree | 751490e84cf477e7702978c491223c79e620b503 | |
parent | 9a9e7c37c89583cf1bdf5d1383a6fad3ba70eb79 (diff) | |
download | skiboot-6e975e1d0fdafdf6cf534da7742b57a538c4fa28.zip skiboot-6e975e1d0fdafdf6cf534da7742b57a538c4fa28.tar.gz skiboot-6e975e1d0fdafdf6cf534da7742b57a538c4fa28.tar.bz2 |
timer: Stop calling list_top() racily
This will trip the debug checks in debug builds under some circumstances
and is actually a rather bad idea as we might look at a timer that is
concurrently being removed and modified, and thus incorrectly assume
there is no work to do.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
(cherry picked from commit b504f2737e9ba3b6935b4ea1c015b3643aefaf51)
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/timer.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/timer.c b/core/timer.c index 4b5925f..b10a564 100644 --- a/core/timer.c +++ b/core/timer.c @@ -223,7 +223,6 @@ static void __check_timers(uint64_t now) void check_timers(bool from_interrupt) { - struct timer *t; uint64_t now = mftb(); /* This is the polling variant, the SLW interrupt path, when it @@ -231,9 +230,11 @@ void check_timers(bool from_interrupt) * the pollers */ - /* Lockless "peek", a bit racy but shouldn't be a problem */ - t = list_top(&timer_list, struct timer, link); - if (list_empty_nocheck(&timer_poll_list) && (!t || t->target > now)) + /* Lockless "peek", a bit racy but shouldn't be a problem as + * we are only looking at whether the list is empty + */ + if (list_empty_nocheck(&timer_poll_list) && + list_empty_nocheck(&timer_list)) return; /* Take lock and try again */ |