diff options
author | Atish Patra <atish.patra@wdc.com> | 2019-08-14 18:02:14 -0700 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-08-16 08:42:55 +0530 |
commit | 897a97a6af31174eb2c6058c6ceb9d3ccc6c6e3c (patch) | |
tree | e667994b5a11efdef3a2b3be8a8bf27a32b018b0 /include/sbi/sbi_fifo.h | |
parent | f6e13e0dd30b164eb444bc08c70fa1b8576e0bca (diff) |
lib: Fix race conditions in tlb fifo access.
Linux kernel expects tlb flush SBI call to be completely synchronous i.e.
the SBI call should only return once corresponding *fence* instruction is
executed.
OpenSBI manages the outstanding TLB flush requests by keeping them in a
per hart based fifo. However, there are few corner cases that may lead to
race conditions while updating the fifo.
Currently, the caller hart waits for IPI acknowledgement via clint
address which is not a very good method as synchronization on MMIO may not
be supported in every platform. Moreover, the waiter doesn't have any way of
identifying if the IPI is received for specific tlb flush request or any
other IPI. This may lead to unpredictable behavior in supervisor/user space.
Fix this by waiting on individual fifo entries rather than MMIO address.
Currently, a relaxed loop is being used because wfi again involves MMIO write
which would be slower compared to relaxed loop. To avoid deadlock, fifo
is processed every time a hart loops for fifo enqueue or fifo sync to consume
the tlb flush requests sent by other harts.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/sbi_fifo.h')
-rw-r--r-- | include/sbi/sbi_fifo.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/sbi/sbi_fifo.h b/include/sbi/sbi_fifo.h index 3f36c59..bc8f8f6 100644 --- a/include/sbi/sbi_fifo.h +++ b/include/sbi/sbi_fifo.h @@ -26,7 +26,6 @@ struct sbi_fifo { enum sbi_fifo_inplace_update_types { SBI_FIFO_SKIP, SBI_FIFO_UPDATED, - SBI_FIFO_RESET, SBI_FIFO_UNCHANGED, }; |