habanalabs: don't free phys_pg_pack inside lock
authorOded Gabbay <ogabbay@kernel.org>
Sat, 15 Jan 2022 22:18:32 +0000 (00:18 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 28 Feb 2022 12:22:02 +0000 (14:22 +0200)
commit7169f0dfecf7745c810782f3f5fe22ba2a8d9ba1
treee698ed702be5a8ac17b628ccd193e46e8ef263e5
parent1dc6cc4b38e5456b7b8741a6194018d30a521d38
habanalabs: don't free phys_pg_pack inside lock

Freeing phys_pg_pack includes calling to scrubbing functions of the
device's memory, taking locks and possibly even calling reset.

This is not something that should be done while holding a device-wide
spinlock.

Therefore, save the relevant objects on a local linked-list and after
releasing the spinlock, traverse that list and free the phys_pg_pack
objects.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory.c