All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 2/3] accel/ivpu: Fix locking order in ivpu_job_submit
Date: Thu,  1 May 2025 15:10:15 -0400	[thread overview]
Message-ID: <20250501082633-4d497a4301fd2d17@stable.kernel.org> (raw)
In-Reply-To: <20250430123653.3748811-3-jacek.lawrynowicz@linux.intel.com>

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: ab680dc6c78aa035e944ecc8c48a1caab9f39924

WARNING: Author mismatch between patch and upstream commit:
Backport author: Jacek Lawrynowicz<jacek.lawrynowicz@linux.intel.com>
Commit author: Karol Wachowski<karol.wachowski@intel.com>

Note: The patch differs from the upstream commit:
---
1:  ab680dc6c78aa ! 1:  b7d18d7cd5b08 accel/ivpu: Fix locking order in ivpu_job_submit
    @@ Metadata
      ## Commit message ##
         accel/ivpu: Fix locking order in ivpu_job_submit
     
    +    commit ab680dc6c78aa035e944ecc8c48a1caab9f39924 upstream.
    +
         Fix deadlock in job submission and abort handling.
         When a thread aborts currently executing jobs due to a fault,
         it first locks the global lock protecting submitted_jobs (#1).
    @@ Commit message
         This order of locking causes a deadlock. To resolve this issue,
         change the order of locking in ivpu_job_submit().
     
    +    Cc: <stable@vger.kernel.org> # v6.14
         Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
         Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
         Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    @@ Commit message
         Link: https://patchwork.freedesktop.org/patch/msgid/20250107173238.381120-12-maciej.falkowski@linux.intel.com
     
      ## drivers/accel/ivpu/ivpu_job.c ##
    -@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority, u32 cmdq_id)
    +@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
      	if (ret < 0)
      		return ret;
      
     +	mutex_lock(&vdev->submitted_jobs_lock);
      	mutex_lock(&file_priv->lock);
      
    - 	if (cmdq_id == 0)
    -@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority, u32 cmdq_id)
    - 	if (!cmdq) {
    - 		ivpu_warn_ratelimited(vdev, "Failed to get job queue, ctx %d\n", file_priv->ctx.id);
    + 	cmdq = ivpu_cmdq_acquire(file_priv, priority);
    +@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
    + 		ivpu_warn_ratelimited(vdev, "Failed to get job queue, ctx %d engine %d prio %d\n",
    + 				      file_priv->ctx.id, job->engine_idx, priority);
      		ret = -EINVAL;
     -		goto err_unlock_file_priv;
     +		goto err_unlock;
      	}
      
    - 	ret = ivpu_cmdq_register(file_priv, cmdq);
    - 	if (ret) {
    - 		ivpu_err(vdev, "Failed to register command queue: %d\n", ret);
    --		goto err_unlock_file_priv;
    -+		goto err_unlock;
    - 	}
    - 
    - 	job->cmdq_id = cmdq->id;
    - 
     -	mutex_lock(&vdev->submitted_jobs_lock);
     -
      	is_first_job = xa_empty(&vdev->submitted_jobs_xa);
      	ret = xa_alloc_cyclic(&vdev->submitted_jobs_xa, &job->job_id, job, file_priv->job_limit,
      			      &file_priv->job_id_next, GFP_KERNEL);
    -@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority, u32 cmdq_id)
    +@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
      		ivpu_dbg(vdev, JOB, "Too many active jobs in ctx %d\n",
      			 file_priv->ctx.id);
      		ret = -EBUSY;
    @@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job,
      	}
      
      	ret = ivpu_cmdq_push_job(cmdq, job);
    -@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority, u32 cmdq_id)
    - 		 job->job_id, file_priv->ctx.id, job->engine_idx, cmdq->priority,
    +@@ drivers/accel/ivpu/ivpu_job.c: static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
    + 		 job->job_id, file_priv->ctx.id, job->engine_idx, priority,
      		 job->cmd_buf_vpu_addr, cmdq->jobq->header.tail);
      
     -	mutex_unlock(&vdev->submitted_jobs_lock);
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y        |  Success    |  Success   |

  reply	other threads:[~2025-05-01 19:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 12:36 [PATCH 0/3] accel/ivpu: Add context violation handling for 6.14 Jacek Lawrynowicz
2025-04-30 12:36 ` [PATCH 1/3] accel/ivpu: Abort all jobs after command queue unregister Jacek Lawrynowicz
2025-05-01 19:11   ` Sasha Levin
2025-05-05  6:02   ` Greg KH
2025-04-30 12:36 ` [PATCH 2/3] accel/ivpu: Fix locking order in ivpu_job_submit Jacek Lawrynowicz
2025-05-01 19:10   ` Sasha Levin [this message]
2025-04-30 12:36 ` [PATCH 3/3] accel/ivpu: Add handling of VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW Jacek Lawrynowicz
2025-05-01 18:50   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250501082633-4d497a4301fd2d17@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.