]> Git Repo - linux.git/commitdiff
accel/ivpu: Do not use cons->aborted for job_done_thread
authorStanislaw Gruszka <[email protected]>
Mon, 13 Nov 2023 17:02:50 +0000 (18:02 +0100)
committerJacek Lawrynowicz <[email protected]>
Thu, 16 Nov 2023 12:41:49 +0000 (13:41 +0100)
This allow to simplify ivpu_ipc_receive() as now we do not have
to process all messages in aborted state - they will be freed in
ivpu_ipc_consumer_del().

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Jacek Lawrynowicz <[email protected]>
Reviewed-by: Jeffrey Hugo <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/accel/ivpu/ivpu_ipc.c
drivers/accel/ivpu/ivpu_job.c

index 781c7e40505a66618641e7b5a08f2100c0c1b059..1dd4413dc88fa465cc8669f98c2227e0b5c9d48d 100644 (file)
@@ -238,17 +238,16 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
                return -ETIMEDOUT;
 
        spin_lock_irq(&cons->rx_lock);
+       if (cons->aborted) {
+               spin_unlock_irq(&cons->rx_lock);
+               return -ECANCELED;
+       }
        rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link);
        if (!rx_msg) {
                spin_unlock_irq(&cons->rx_lock);
                return -EAGAIN;
        }
        list_del(&rx_msg->link);
-       if (cons->aborted) {
-               spin_unlock_irq(&cons->rx_lock);
-               ret = -ECANCELED;
-               goto out;
-       }
        spin_unlock_irq(&cons->rx_lock);
 
        if (ipc_buf)
@@ -266,7 +265,6 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
        }
 
        ivpu_ipc_rx_mark_free(vdev, rx_msg->ipc_hdr, rx_msg->jsm_msg);
-out:
        atomic_dec(&ipc->rx_msg_count);
        kfree(rx_msg);
 
@@ -528,9 +526,11 @@ void ivpu_ipc_disable(struct ivpu_device *vdev)
 
        spin_lock_irqsave(&ipc->cons_list_lock, flags);
        list_for_each_entry_safe(cons, c, &ipc->cons_list, link) {
-               spin_lock(&cons->rx_lock);
-               cons->aborted = true;
-               spin_unlock(&cons->rx_lock);
+               if (cons->channel != VPU_IPC_CHAN_JOB_RET) {
+                       spin_lock(&cons->rx_lock);
+                       cons->aborted = true;
+                       spin_unlock(&cons->rx_lock);
+               }
                wake_up(&cons->rx_msg_wq);
        }
        spin_unlock_irqrestore(&ipc->cons_list_lock, flags);
index 02acd8dba02aadf6ee838c2b8335ce3bf3fb4925..77b1b8abadd6ec9e8f348f4f2d58e2414959b09d 100644 (file)
@@ -578,7 +578,6 @@ static int ivpu_job_done_thread(void *arg)
        ivpu_ipc_consumer_add(vdev, &cons, VPU_IPC_CHAN_JOB_RET);
 
        while (!kthread_should_stop()) {
-               cons.aborted = false;
                timeout = ivpu_tdr_timeout_ms ? ivpu_tdr_timeout_ms : vdev->timeout.tdr;
                jobs_submitted = !xa_empty(&vdev->submitted_jobs_xa);
                ret = ivpu_ipc_receive(vdev, &cons, NULL, &jsm_msg, timeout);
This page took 0.063638 seconds and 4 git commands to generate.