linux/drivers/misc/habanalabs
Oded Gabbay caa3c8e525 habanalabs: all FD must be closed before removing device
This patch fixes a bug in the implementation of the function that removes
the device.

The bug can happen when the device is removed but not the driver itself
(e.g. remove by the OS due to PCI freeze in Power architecture).

In that case, there maybe open users that are calling IOCTLs while the
device is removed. This is a possible race condition that the driver must
handle. Otherwise, a kernel panic may occur.

This race is prevented in the hard-reset flow, because the driver makes
sure the users are closed before continuing with the hard-reset. This
race can not occur when the driver itself is removed because the OS makes
sure all the file descriptors are closed.

The fix is to make sure the open users close their file descriptors and if
they don't (after a certain amount of time), the driver sends them a
SIGKILL, because the remove of the device can't be stopped.

The patch re-uses the same code that is called from the hard-reset flow.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
2019-04-06 13:23:54 +03:00
..
goya habanalabs: refactoring in goya.c 2019-04-02 15:56:16 +03:00
include habanalabs: add goya implementation for debug configuration 2019-04-01 22:23:02 +03:00
Kconfig habanalabs: adjust Kconfig to fix build errors 2019-03-02 12:03:56 +01:00
Makefile habanalabs: Move PCI code into common file 2019-03-05 16:48:42 +02:00
asid.c habanalabs: add context and ASID modules 2019-02-18 09:46:44 +01:00
command_buffer.c habanalabs: fix memory leak with CBs with unaligned size 2019-02-28 13:06:09 +01:00
command_submission.c habanalabs: improve error messages 2019-03-27 09:44:28 +02:00
context.c habanalabs: add virtual memory and MMU modules 2019-02-18 09:46:46 +01:00
debugfs.c habanalabs: Allow accessing DRAM virtual addresses via debugfs 2019-03-12 13:53:17 +02:00
device.c habanalabs: all FD must be closed before removing device 2019-04-06 13:23:54 +03:00
firmware_if.c habanalabs: Move device CPU code into common file 2019-03-04 10:22:09 +02:00
habanalabs.h habanalabs: ASIC_AUTO_DETECT enum value is redundant 2019-04-04 14:33:34 +03:00
habanalabs_drv.c habanalabs: ASIC_AUTO_DETECT enum value is redundant 2019-04-04 14:33:34 +03:00
habanalabs_ioctl.c habanalabs: add new IOCTL for debug, tracing and profiling 2019-04-01 22:31:22 +03:00
hw_queue.c habanalabs: perform accounting for active CS 2019-03-03 15:13:15 +02:00
hwmon.c habanalabs: fix little-endian<->cpu conversion warnings 2019-02-28 13:07:52 +01:00
irq.c habanalabs: fix little-endian<->cpu conversion warnings 2019-02-28 13:07:52 +01:00
memory.c habanalabs: split mmu/no-mmu code paths in memory ioctl 2019-04-04 14:42:26 +03:00
mmu.c habanalabs: fix mapping with page size bigger than 4KB 2019-03-14 16:54:45 +02:00
pci.c habanalabs: keep track of the device's dma mask 2019-03-07 18:03:23 +02:00
sysfs.c habanalabs: fix little-endian<->cpu conversion warnings 2019-02-28 13:07:52 +01:00