From: sashiko-bot@kernel.org
To: "Kyrie Wu" <kyrie.wu@mediatek.com>, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v19 07/13] media: mediatek: jpeg: fix resolution change event handling in decoder
Date: Mon, 16 Nov 2026 01:55:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-216020@kernel.org> (raw)
In-Reply-To: <20261116013402.1273016-8-kyrie.wu@mediatek.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: mtk-jpeg: infinite workqueue loop in
mtk_jpegdec_worker()
--
commit ad29b1fb39c9c613b94dec7d4d11fb66bb5328c6
Author: Kyrie Wu <kyrie.wu@mediatek.com>
media: mediatek: jpeg: fix resolution change event handling in decoder
This commit checks for MTK_JPEG_SOURCE_CHANGE in mtk_jpegdec_worker() and
updates ctx->state before queueing the source change event.
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 6e8b83987292c..a34f2d6a5b6e8 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1742,10 +1742,13 @@ static void mtk_jpegdec_worker(struct work_struct *work)
> v4l2_m2m_buf_copy_metadata(src_buf, dst_buf);
> jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(&src_buf->vb2_buf);
>
> + if (ctx->state == MTK_JPEG_SOURCE_CHANGE)
> + goto getbuf_fail;
> +
> if (mtk_jpeg_check_resolution_change(ctx,
> &jpeg_src_buf->dec_param)) {
> - mtk_jpeg_queue_src_chg_event(ctx);
> ctx->state = MTK_JPEG_SOURCE_CHANGE;
> + mtk_jpeg_queue_src_chg_event(ctx);
> goto getbuf_fail;
> }
[Severity: High]
Does jumping to getbuf_fail when ctx->state is MTK_JPEG_SOURCE_CHANGE cause
an infinite workqueue loop on a resolution or format change?
Jumping to getbuf_fail leaves src_buf and dst_buf on the M2M ready queues
and calls v4l2_m2m_job_finish(). Unlike mtk_jpeg_dec_m2m_ops,
mtk_jpeg_multicore_dec_m2m_ops has no .job_ready callback to check
ctx->state, so v4l2_m2m_job_finish() -> v4l2_m2m_schedule_next_job() ->
__v4l2_m2m_try_queue() immediately re-queues the context and schedules
mtk_jpeg_multicore_dec_device_run() -> mtk_jpegdec_worker() again, spinning
across the M2M and decoder workqueues until userspace calls
VIDIOC_STREAMOFF.
Wiring .job_ready = mtk_jpeg_dec_job_ready in
mtk_jpeg_multicore_dec_m2m_ops would prevent M2M from scheduling new jobs
while ctx->state is MTK_JPEG_SOURCE_CHANGE.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116013402.1273016-1-kyrie.wu@mediatek.com?part=7
next prev parent reply other threads:[~2026-11-16 1:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 1:33 [PATCH v19 00/13] media: mediatek: jpeg: add MT8196 JPEG support Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 01/13] media: mediatek: jpeg: fix jpeg cores' amounts setting Kyrie Wu
2026-11-16 1:48 ` sashiko-bot
2026-11-16 1:33 ` [PATCH v19 02/13] media: mediatek: jpeg: fix jpeg buffer payload size setting Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 03/13] media: mediatek: jpeg: fix buffer structure size and layout Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 04/13] media: mediatek: jpeg: Fix buffer completion on multi-core streaming stop Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 05/13] media: mediatek: jpeg: Fix multi-core clk suspend and resume setting Kyrie Wu
2026-11-16 2:03 ` sashiko-bot
2026-11-16 1:33 ` [PATCH v19 06/13] media: mediatek: jpeg: fix buffer state update timing Kyrie Wu
2026-11-16 1:52 ` sashiko-bot
2026-11-16 1:33 ` [PATCH v19 07/13] media: mediatek: jpeg: fix resolution change event handling in decoder Kyrie Wu
2026-11-16 1:55 ` sashiko-bot [this message]
2026-11-16 1:33 ` [PATCH v19 08/13] media: mediatek: jpeg: fix remove buffer removal timing for multi-core Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 09/13] dt-bindings: soc: mediatek: Add MT8196 JPEG SMMU Kyrie Wu
2026-11-16 1:52 ` sashiko-bot
2026-11-16 1:33 ` [PATCH v19 10/13] media: dt-bindings: mediatek,jpeg: Add mediatek, mt8196-jpgdec compatible Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 11/13] media: dt-bindings: mediatek,jpeg: Add mediatek, mt8196-jpgenc compatible Kyrie Wu
2026-11-16 1:33 ` [PATCH v19 12/13] media: mediatek: jpeg: add jpeg compatible Kyrie Wu
2026-11-16 2:04 ` sashiko-bot
2026-11-16 1:33 ` [PATCH v19 13/13] media: mediatek: jpeg: add jpeg smmu sid setting Kyrie Wu
2026-11-16 2:04 ` sashiko-bot
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=sashiko-outbox-216020@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kyrie.wu@mediatek.com \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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