From: "Jackson.lee" <jackson.lee@chipsnmedia.com>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
sebastian.fricke@collabora.com, nicolas.dufresne@collabora.com,
bob.beckett@collabora.com, dafna.hirschfeld@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
jackson.lee@chipsnmedia.com, lafley.kim@chipsnmedia.com,
b-brnich@ti.com, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com
Subject: [PATCH v2 4/7] media: chips-media: wave5: Use spinlock whenever statue is changed
Date: Thu, 22 May 2025 16:26:03 +0900 [thread overview]
Message-ID: <20250522072606.51-5-jackson.lee@chipsnmedia.com> (raw)
In-Reply-To: <20250522072606.51-1-jackson.lee@chipsnmedia.com>
From: Jackson Lee <jackson.lee@chipsnmedia.com>
The device_run and finish_decode is not any more synchronized,
so lock was needed in the device_run whenever state was changed.
Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
---
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
index 42981c3b49bc..719c5527eb7f 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
@@ -1577,6 +1577,7 @@ static void wave5_vpu_dec_device_run(void *priv)
struct queue_status_info q_status;
u32 fail_res = 0;
int ret = 0;
+ unsigned long flags;
dev_dbg(inst->dev->dev, "%s: Fill the ring buffer with new bitstream data", __func__);
pm_runtime_resume_and_get(inst->dev->dev);
@@ -1617,7 +1618,9 @@ static void wave5_vpu_dec_device_run(void *priv)
}
spin_unlock_irqrestore(&inst->state_spinlock, flags);
} else {
+ spin_lock_irqsave(&inst->state_spinlock, flags);
switch_state(inst, VPU_INST_STATE_INIT_SEQ);
+ spin_unlock_irqrestore(&inst->state_spinlock, flags);
}
break;
@@ -1628,8 +1631,9 @@ static void wave5_vpu_dec_device_run(void *priv)
* we had a chance to switch, which leads to an invalid state
* change.
*/
+ spin_lock_irqsave(&inst->state_spinlock, flags);
switch_state(inst, VPU_INST_STATE_PIC_RUN);
-
+ spin_unlock_irqrestore(&inst->state_spinlock, flags);
/*
* During DRC, the picture decoding remains pending, so just leave the job
* active until this decode operation completes.
@@ -1643,7 +1647,9 @@ static void wave5_vpu_dec_device_run(void *priv)
ret = wave5_prepare_fb(inst);
if (ret) {
dev_warn(inst->dev->dev, "Framebuffer preparation, fail: %d\n", ret);
+ spin_lock_irqsave(&inst->state_spinlock, flags);
switch_state(inst, VPU_INST_STATE_STOP);
+ spin_unlock_irqrestore(&inst->state_spinlock, flags);
break;
}
--
2.43.0
next prev parent reply other threads:[~2025-05-22 7:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 7:25 [PATCH v2 0/7] Performance improvement of decoder Jackson.lee
2025-05-22 7:26 ` [PATCH v2 1/7] media: chips-media: wave5: Fix Null reference while testing fluster Jackson.lee
2025-05-23 17:20 ` Nicolas Dufresne
2025-05-27 4:05 ` jackson.lee
2025-05-27 12:57 ` Nicolas Dufresne
2025-05-22 7:26 ` [PATCH v2 2/7] media: chips-media: wave5: Improve performance of decoder Jackson.lee
2025-05-23 17:39 ` Nicolas Dufresne
2025-05-27 4:58 ` jackson.lee
2025-05-28 13:46 ` Nicolas Dufresne
2025-06-04 4:09 ` jackson.lee
2025-06-04 13:47 ` Nicolas Dufresne
2025-06-05 4:50 ` jackson.lee
2025-06-05 13:28 ` Nicolas Dufresne
2025-06-09 8:47 ` jackson.lee
2025-05-30 14:33 ` Nicolas Dufresne
2025-05-22 7:26 ` [PATCH v2 3/7] media: chips-media: wave5: Fix not to be closed Jackson.lee
2025-05-22 7:26 ` Jackson.lee [this message]
2025-05-23 17:41 ` [PATCH v2 4/7] media: chips-media: wave5: Use spinlock whenever statue is changed Nicolas Dufresne
2025-05-27 5:02 ` jackson.lee
2025-05-28 13:49 ` Nicolas Dufresne
2025-05-22 7:26 ` [PATCH v2 5/7] media: chips-media: wave5: Fix not to free resources normally when instance was destroyed Jackson.lee
2025-05-23 17:42 ` Nicolas Dufresne
2025-05-27 5:04 ` jackson.lee
2025-05-22 7:26 ` [PATCH v2 6/7] media: chips-media: wave5: Reduce high CPU load Jackson.lee
2025-05-23 17:43 ` Nicolas Dufresne
2025-05-27 5:05 ` jackson.lee
2025-05-22 7:26 ` [PATCH v2 7/7] media: chips-media: wave5: Fix SError of kernel panic when closed Jackson.lee
2025-05-23 17:48 ` Nicolas Dufresne
2025-05-27 5:07 ` jackson.lee
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=20250522072606.51-5-jackson.lee@chipsnmedia.com \
--to=jackson.lee@chipsnmedia.com \
--cc=b-brnich@ti.com \
--cc=bob.beckett@collabora.com \
--cc=dafna.hirschfeld@collabora.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=hverkuil@xs4all.nl \
--cc=lafley.kim@chipsnmedia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nas.chung@chipsnmedia.com \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.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®