summaryrefslogtreecommitdiff
path: root/drivers/misc/qcom-coincell.c
diff options
context:
space:
mode:
authorDani Liberman <dliberman@habana.ai>2021-10-03 15:57:44 +0300
committerOded Gabbay <ogabbay@kernel.org>2021-10-18 12:05:47 +0300
commitea6eb91c09cd4f2f92ba28ba277d2ecf63cdc237 (patch)
tree63d1036082eb6d0fb8cb2aa512565e2a427f6d8f /drivers/misc/qcom-coincell.c
parent1d16a46b1a83ea44a73964fe28492656c70da831 (diff)
downloadlinux-ea6eb91c09cd4f2f92ba28ba277d2ecf63cdc237.tar.xz
habanalabs: fix race condition in multi CS completion
Race condition occurs when CS fence completes and multi CS did not completed yet, while waiting for multi CS ends and returns indication to user that the CS completed. Next wait for multi CS may be triggered by previous multi CS completion without any current CS completed, causing an error. Example scenario : 1. User do multi CS wait for CSs 1 and 2 on master QID 0 2. CS 1 and 2 reached the "cs release" code. The thread of CS 1 completed both the CS and multi CS handling but the completion thread of CS 2 completed the CS but still did not executed complete_multi_cs (note that in CS completion the sequence is to first do complete all for the CS and then another complete all to signal the multi_cs) 3. User received indication that CS 1 and 2 completed (since we check the CS fence and both indicated as completed) and immediately waits on CS 3 and 4, also on master QID 0. 4. Completion thread of CS2 executed complete_multi_cs before completion of CS 3 and 4 and so will trigger the multi CS wait of CSs 3 and 4 as they wait on master QID 0. This will trigger multi CS completion although none of its current CS has been completed. Fixed by adding multi CS complete handling indication for each CS. CS will be marked to the user as completed only if its fence completed and multi CS handling is done. Signed-off-by: Dani Liberman <dliberman@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/qcom-coincell.c')
0 files changed, 0 insertions, 0 deletions