From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
Vikash Garodia <quic_vgarodia@quicinc.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: venus: sync with threaded IRQ during inst destruction
Date: Thu, 24 Oct 2024 14:13:35 +0900 [thread overview]
Message-ID: <20241024051335.GK1279924@google.com> (raw)
In-Reply-To: <20241024045836.GJ1279924@google.com>
On (24/10/24 13:58), Sergey Senozhatsky wrote:
> Date: Thu, 24 Oct 2024 13:58:36 +0900
> From: Sergey Senozhatsky <senozhatsky@chromium.org>
> To: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>, Vikash Garodia
> <quic_vgarodia@quicinc.com>, Bryan O'Donoghue
> <bryan.odonoghue@linaro.org>, linux-media@vger.kernel.org,
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 2/2] media: venus: sync with threaded IRQ during inst
> destruction
> Message-ID: <20241024045836.GJ1279924@google.com>
>
> On (24/10/23 14:24), Sergey Senozhatsky wrote:
> > Guard inst destruction (both dec and enc) with hard and threaded
> > IRQ synchronization.
>
> Folks, please ignore this patch. Stand by for v2.
I think it probably should be something like this (both for dec and
enc).
---
@@ -1538,9 +1538,25 @@ static int venc_close(struct file *file)
venc_pm_get(inst);
+ /*
+ * First, remove the inst from the ->instances list, so that
+ * to_instance() will return NULL.
+ */
+ hfi_session_destroy(inst);
+ /*
+ * Second, make sure we don't have IRQ/IRQ-thread currently running or
+ * pending execution (disable_irq() calls synchronize_irq()), which
+ * can race with the inst destruction.
+ */
+ disable_irq(inst->core->irq);
+ /*
+ * Lastly, inst is gone from the core->instances list and we don't
+ * have running/pending IRQ/IRQ-thread, proceed with the destruction
+ */
+ enable_irq(inst->core->irq);
+
v4l2_m2m_ctx_release(inst->m2m_ctx);
v4l2_m2m_release(inst->m2m_dev);
- hfi_session_destroy(inst);
v4l2_fh_del(&inst->fh);
v4l2_fh_exit(&inst->fh);
venc_ctrl_deinit(inst);
next prev parent reply other threads:[~2024-10-24 5:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 5:24 [PATCH 0/2] media: venus: close() fixes Sergey Senozhatsky
2024-10-23 5:24 ` [PATCH 1/2] media: venus: fix enc/dec destruction order Sergey Senozhatsky
2024-10-23 5:24 ` [PATCH 2/2] media: venus: sync with threaded IRQ during inst destruction Sergey Senozhatsky
2024-10-24 4:58 ` Sergey Senozhatsky
2024-10-24 5:13 ` Sergey Senozhatsky [this message]
2024-10-24 5:18 ` Tomasz Figa
2024-10-24 5:46 ` Sergey Senozhatsky
2024-10-24 6:05 ` Tomasz Figa
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=20241024051335.GK1279924@google.com \
--to=senozhatsky@chromium.org \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=quic_vgarodia@quicinc.com \
--cc=stanimir.k.varbanov@gmail.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