]> www.infradead.org Git - users/jedix/linux-maple.git/commit
habanalabs: fix bug in timestamps registration code
authorfarah kassabri <fkassabri@habana.ai>
Tue, 10 Jan 2023 10:29:55 +0000 (12:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:58 +0000 (09:33 +0100)
commitfa4c8baa6bf0f8026a48460b9212297622c1138e
tree28841a2c29fd33f73047f6cae70ce6d0b82cc994
parent60be7280850135942fa9914b65bd56d61b842c47
habanalabs: fix bug in timestamps registration code

[ Upstream commit ac5af9900f82b7034de7c9eb1d70d030ba325607 ]

Protect re-using the same timestamp buffer record before actually
adding it to the to interrupt wait list.
Mark ts buff offset as in use in the spinlock protection area of the
interrupt wait list to avoid getting in the re-use section in
ts_buff_get_kernel_ts_record before adding the node to the list.
this scenario might happen when multiple threads are racing on
same offset and one thread could set data in the ts buff in
ts_buff_get_kernel_ts_record then the other thread takes over
and get to ts_buff_get_kernel_ts_record and we will try
to re-use the same ts buff offset then we will try to
delete a non existing node from the list.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/common/command_submission.c