mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
habanalabs: move reset workqueue to be under hl_device
'struct hl_device_reset_work' is used as a wrapper for the reset work and its parameters, including the reset workqueue on which it runs. In a future commit, another reset related work with similar parameters is going to be added, but it won't use the reset workqueue. As in any case there is a single reset workqueue, and to allow the resue of this structure, move the reset workqueue to 'struct hl_device'. 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
51236cd95e
commit
1eebb25929
@ -684,9 +684,8 @@ static void device_hard_reset_pending(struct work_struct *work)
|
||||
"Could not reset device. will try again in %u seconds",
|
||||
HL_PENDING_RESET_PER_SEC);
|
||||
|
||||
queue_delayed_work(device_reset_work->wq,
|
||||
&device_reset_work->reset_work,
|
||||
msecs_to_jiffies(HL_PENDING_RESET_PER_SEC * 1000));
|
||||
queue_delayed_work(hdev->reset_wq, &device_reset_work->reset_work,
|
||||
msecs_to_jiffies(HL_PENDING_RESET_PER_SEC * 1000));
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,9 +800,8 @@ static int device_early_init(struct hl_device *hdev)
|
||||
|
||||
hl_mem_mgr_init(hdev->dev, &hdev->kernel_mem_mgr);
|
||||
|
||||
hdev->device_reset_work.wq =
|
||||
create_singlethread_workqueue("hl_device_reset");
|
||||
if (!hdev->device_reset_work.wq) {
|
||||
hdev->reset_wq = create_singlethread_workqueue("hl_device_reset");
|
||||
if (!hdev->reset_wq) {
|
||||
rc = -ENOMEM;
|
||||
dev_err(hdev->dev, "Failed to create device reset WQ\n");
|
||||
goto free_cb_mgr;
|
||||
@ -879,7 +877,7 @@ static void device_early_fini(struct hl_device *hdev)
|
||||
destroy_workqueue(hdev->ts_free_obj_wq);
|
||||
destroy_workqueue(hdev->cs_cmplt_wq);
|
||||
destroy_workqueue(hdev->eq_wq);
|
||||
destroy_workqueue(hdev->device_reset_work.wq);
|
||||
destroy_workqueue(hdev->reset_wq);
|
||||
|
||||
for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++)
|
||||
destroy_workqueue(hdev->cq_wq[i]);
|
||||
@ -1460,8 +1458,7 @@ again:
|
||||
* Because the reset function can't run from heartbeat work,
|
||||
* we need to call the reset function from a dedicated work.
|
||||
*/
|
||||
queue_delayed_work(hdev->device_reset_work.wq,
|
||||
&hdev->device_reset_work.reset_work, 0);
|
||||
queue_delayed_work(hdev->reset_wq, &hdev->device_reset_work.reset_work, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2682,17 +2682,15 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
|
||||
struct hwmon_chip_info;
|
||||
|
||||
/**
|
||||
* struct hl_device_reset_work - reset workqueue task wrapper.
|
||||
* @wq: work queue for device reset procedure.
|
||||
* struct hl_device_reset_work - reset work wrapper.
|
||||
* @reset_work: reset work to be done.
|
||||
* @hdev: habanalabs device structure.
|
||||
* @flags: reset flags.
|
||||
*/
|
||||
struct hl_device_reset_work {
|
||||
struct workqueue_struct *wq;
|
||||
struct delayed_work reset_work;
|
||||
struct hl_device *hdev;
|
||||
u32 flags;
|
||||
struct delayed_work reset_work;
|
||||
struct hl_device *hdev;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -3061,6 +3059,7 @@ struct hl_reset_info {
|
||||
* context.
|
||||
* @ts_free_obj_wq: work queue for timestamp registration objects release.
|
||||
* @prefetch_wq: work queue for MMU pre-fetch operations.
|
||||
* @reset_wq: work queue for device reset procedure.
|
||||
* @kernel_ctx: Kernel driver context structure.
|
||||
* @kernel_queues: array of hl_hw_queue.
|
||||
* @cs_mirror_list: CS mirror list for TDR.
|
||||
@ -3232,6 +3231,7 @@ struct hl_device {
|
||||
struct workqueue_struct *cs_cmplt_wq;
|
||||
struct workqueue_struct *ts_free_obj_wq;
|
||||
struct workqueue_struct *prefetch_wq;
|
||||
struct workqueue_struct *reset_wq;
|
||||
struct hl_ctx *kernel_ctx;
|
||||
struct hl_hw_queue *kernel_queues;
|
||||
struct list_head cs_mirror_list;
|
||||
|
Loading…
Reference in New Issue
Block a user