OSDN Git Service

accel/habanalabs: use a mutex rather than a spinlock
authorKoby Elbaz <kelbaz@habana.ai>
Thu, 23 Feb 2023 16:17:02 +0000 (18:17 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 15 Mar 2023 11:29:15 +0000 (13:29 +0200)
commit7ffb5ced2bc3578b221007467cef8a032c189b0a
tree429d04ac8065b38a5c36a4b35048e8fff8e24c84
parentc7ac65c881eae0358b91bd2045ab81b452d2e716
accel/habanalabs: use a mutex rather than a spinlock

There are two reasons why mutex is better here:
1. There's a critical section relatively long, where in
certain scenarios (e.g., multiple VM allocations) taking a spinlock
might cause noticeable performance degradation.
2. It will remove the incorrect usage of mutex under
spin_lock (where preemption is disabled).

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/debugfs.c
drivers/accel/habanalabs/common/habanalabs.h