accel/habanalabs: prevent immediate hard reset due to 2 adjacent H/W events
When a H/W event is received while a user is registered to events, no immediate hard reset will happen, and instead the user will be notified and will have some time to handle it and eventually release the device, after which the reset will be done. If a user, as part of the handling and as part of the cleanup steps towards releasing the device, unregisters from receiving those events, and at that time an adjacent H/W event is received, it will be assumed that the user is not registered to events and thus an immediate hard reset is required. To prevent such an unwanted immediate reset, modify the driver to perform it if the user is not registered to events AND we don't already have a pending reset for a previous H/W event. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
389af786f9
commit
5d89ce6f8c
@ -1916,7 +1916,16 @@ int hl_device_cond_reset(struct hl_device *hdev, u32 flags, u64 event_mask)
|
||||
}
|
||||
|
||||
ctx = hl_get_compute_ctx(hdev);
|
||||
if (!ctx || !ctx->hpriv->notifier_event.eventfd)
|
||||
if (!ctx)
|
||||
goto device_reset;
|
||||
|
||||
/*
|
||||
* There is no point in postponing the reset if user is not registered for events.
|
||||
* However if no eventfd_ctx exists but the device release watchdog is already scheduled, it
|
||||
* just implies that user has unregistered as part of handling a previous event. In this
|
||||
* case an immediate reset is not required.
|
||||
*/
|
||||
if (!ctx->hpriv->notifier_event.eventfd && !hdev->reset_info.watchdog_active)
|
||||
goto device_reset;
|
||||
|
||||
/* Schedule the device release watchdog work unless reset is already in progress or if the
|
||||
|
Loading…
Reference in New Issue
Block a user