From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>,
Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
Vikash Garodia <quic_vgarodia@quicinc.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Tomasz Figa <tfiga@google.com>
Subject: Re: [PATCHv2 1/2] media: venus: fix enc/dec destruction order
Date: Thu, 24 Oct 2024 09:54:27 +0100 [thread overview]
Message-ID: <ae479f58-5474-401b-adf3-3937c91cae1a@linaro.org> (raw)
In-Reply-To: <20241024061809.400260-2-senozhatsky@chromium.org>
On 24/10/2024 07:16, Sergey Senozhatsky wrote:
> We destroy mutex-es too early as they are still taken in
> v4l2_fh_exit()->v4l2_event_unsubscribe()->v4l2_ctrl_find().
>
> We should destroy mutex-es right before kfree(). Also
> do not vdec_ctrl_deinit() before v4l2_fh_exit().
>
> Suggested-by: Tomasz Figa <tfiga@google.com>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> ---
> drivers/media/platform/qcom/venus/vdec.c | 7 ++++---
> drivers/media/platform/qcom/venus/venc.c | 6 +++---
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 6252a6b3d4ba..0013c4704f03 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -1752,13 +1752,14 @@ static int vdec_close(struct file *file)
> cancel_work_sync(&inst->delayed_process_work);
> v4l2_m2m_ctx_release(inst->m2m_ctx);
> v4l2_m2m_release(inst->m2m_dev);
> - vdec_ctrl_deinit(inst);
> ida_destroy(&inst->dpb_ids);
> hfi_session_destroy(inst);
> - mutex_destroy(&inst->lock);
> - mutex_destroy(&inst->ctx_q_lock);
> v4l2_fh_del(&inst->fh);
> v4l2_fh_exit(&inst->fh);
> + vdec_ctrl_deinit(inst);
> +
> + mutex_destroy(&inst->lock);
> + mutex_destroy(&inst->ctx_q_lock);
>
> vdec_pm_put(inst, false);
>
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index 322a7737e2c7..6a26a6592424 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -1519,14 +1519,14 @@ static int venc_close(struct file *file)
>
> v4l2_m2m_ctx_release(inst->m2m_ctx);
> v4l2_m2m_release(inst->m2m_dev);
> - venc_ctrl_deinit(inst);
> hfi_session_destroy(inst);
> - mutex_destroy(&inst->lock);
> - mutex_destroy(&inst->ctx_q_lock);
> v4l2_fh_del(&inst->fh);
> v4l2_fh_exit(&inst->fh);
> + venc_ctrl_deinit(inst);
>
> inst->enc_state = VENUS_ENC_STATE_DEINIT;
> + mutex_destroy(&inst->lock);
> + mutex_destroy(&inst->ctx_q_lock);
>
> venc_pm_put(inst, false);
>
Lgtm
Requires a Fixes: tag though
i.e.
Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")
Once added
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2024-10-24 8:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 6:16 [PATCHv2 0/2] media: venus: close() fixes Sergey Senozhatsky
2024-10-24 6:16 ` [PATCHv2 1/2] media: venus: fix enc/dec destruction order Sergey Senozhatsky
2024-10-24 8:54 ` Bryan O'Donoghue [this message]
2024-10-24 6:16 ` [PATCHv2 2/2] media: venus: sync with threaded IRQ during inst destruction Sergey Senozhatsky
2024-10-24 8:59 ` Bryan O'Donoghue
2024-10-24 9:39 ` Sergey Senozhatsky
2024-10-24 9:43 ` Bryan O'Donoghue
2024-10-24 10:08 ` Sergey Senozhatsky
2024-10-24 10:52 ` Bryan O'Donoghue
2024-10-24 11:36 ` Sergey Senozhatsky
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=ae479f58-5474-401b-adf3-3937c91cae1a@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=quic_vgarodia@quicinc.com \
--cc=senozhatsky@chromium.org \
--cc=stanimir.k.varbanov@gmail.com \
--cc=tfiga@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®