accel/habanalabs: optimize timestamp registration handler
authorfarah kassabri <fkassabri@habana.ai>
Thu, 2 Mar 2023 09:09:24 +0000 (11:09 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 9 Oct 2023 09:37:22 +0000 (12:37 +0300)
commit1157b5d6b3b069394e37cd3b1d32c39eb833e546
tree1fa540789d48866c998c46ffe4b433c478628bdb
parent0165994c215f321e2d055368f89b424756e340eb
accel/habanalabs: optimize timestamp registration handler

Currently we use dynamic allocation inside the irq handler
in order to allocate free node to be used for the free jobs.

This operation is expensive, especially when we deal with large
burst of events records that get released at the same time.

The alternative is to have pre allocated pool of free nodes
and just fetch nodes from this pool at irq handling time instead
of allocating them.

In case the pool becomes full, then the driver will fallback to
dynamic allocations.

As part of the optimization also update the unregister flow
upon re-using a timestamp record, by making the operation much
simpler and quicker. We already have the record in the registration
flow and now we just seek to re-use with different interrupt.
Therefore, no need to look for buffer according to the user handle.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/command_submission.c
drivers/accel/habanalabs/common/device.c
drivers/accel/habanalabs/common/habanalabs.h
drivers/accel/habanalabs/common/irq.c