diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-08 17:13:01 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-08 17:20:52 +1000 |
commit | f1067cdc0a9c8e34e4c2e57ad9dd37132b47fcb3 (patch) | |
tree | b2991f60378c2b29e860b7490d173159c95a312d /hw/fsp/fsp.c | |
parent | 869c7522aad98c2682e37feb8e56be7a3e975d4d (diff) | |
download | blackbird-skiboot-f1067cdc0a9c8e34e4c2e57ad9dd37132b47fcb3.tar.gz blackbird-skiboot-f1067cdc0a9c8e34e4c2e57ad9dd37132b47fcb3.zip |
lock: Fix races when setting in_con_lock
When setting the flag in a lock that indicates that it's on the console
path, we need to take and release that lock to ensure that any other
processor that might have taken it before the flag was set has released
it, otherwise the lock might still be held without the console count
properly incremented, which can cause it to go negative or cause the
deadlock that we mean to avoid by that to still occur.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw/fsp/fsp.c')
-rw-r--r-- | hw/fsp/fsp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c index b87c8b36..2189bbb9 100644 --- a/hw/fsp/fsp.c +++ b/hw/fsp/fsp.c @@ -2213,4 +2213,12 @@ int fsp_fetch_data_queue(uint8_t flags, uint16_t id, uint32_t sub_id, void fsp_used_by_console(void) { fsp_lock.in_con_path = true; + + /* + * Some other processor might hold it without having + * disabled the console locally so let's make sure that + * is over by taking/releasing the lock ourselves + */ + lock(&fsp_lock); + unlock(&fsp_lock); } |