habanalabs: don't allow hard reset with open processes
authorOmer Shpigelman <oshpigelman@habana.ai>
Mon, 18 May 2020 19:27:46 +0000 (22:27 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Mon, 25 May 2020 05:15:33 +0000 (08:15 +0300)
commit36fafe87edd636292a4ed6a3af9608f2c7d0d0fb
treeb2f60fa0e9a465af0048d87073750464faae8ee6
parent66446820df1864bc371ece679c11152f5f22362c
habanalabs: don't allow hard reset with open processes

When the MMU is heavily used by the engines, unmapping might take a lot of
time due to a full MMU cache invalidation done as part of the unmap flow.
Hence we might not be able to kill all open processes before going to hard
reset the device, as it involves unmapping of all user memory.
In case of a failure in killing all open processes, we should stop the
hard reset flow as it might lead to a kernel crash - one thread (killing
of a process) is updating MMU structures that other thread (hard reset) is
freeing.
Stopping a hard reset flow leaves the device as nonoperational and the
user can then initiate a hard reset via sysfs to reinitialize the device.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/device.c