]> git.baikalelectronics.ru Git - kernel.git/commit
habanalabs: reset after device is actually released
authorOded Gabbay <ogabbay@kernel.org>
Tue, 16 Feb 2021 20:34:24 +0000 (22:34 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 9 Apr 2021 11:09:22 +0000 (14:09 +0300)
commit2ced28835d8df0eee72492e5e02d6226085d8d1f
treef0a22a1c651358ec0584534cdb86395695891fc6
parent267c331da9161eaeb74e8719131de903f2dd86b9
habanalabs: reset after device is actually released

The device is actually released only after the refcnt of the hpriv
structure is 0, which means all its contexts were closed.

If we reset the device while a context is still open, there are
possibilities for unexpected behavior and crashes. For example, if the
process has a mapping of a register block that is now currently being
reset, and the process writes/reads to that block during the reset,
the device can get stuck.

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