Skip to content

Commit 27cb12b

Browse files
jacksonlee77Sasha Levin
authored andcommitted
media: chips-media: wave5: Fix SError of kernel panic when closed
[ Upstream commit cbb9c0d ] SError of kernel panic rarely happened while testing fluster. The root cause was to enter suspend mode because timeout of autosuspend delay happened. [ 48.834439] SError Interrupt on CPU0, code 0x00000000bf000000 -- SError [ 48.834455] CPU: 0 UID: 0 PID: 1067 Comm: v4l2h265dec0:sr Not tainted 6.12.9-gc9e21a1ebd75-dirty linux4microchip#7 [ 48.834461] Hardware name: ti Texas Instruments J721S2 EVM/Texas Instruments J721S2 EVM, BIOS 2025.01-00345-gbaf3aaa8ecfa 01/01/2025 [ 48.834464] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 48.834468] pc : wave5_dec_clr_disp_flag+0x40/0x80 [wave5] [ 48.834488] lr : wave5_dec_clr_disp_flag+0x40/0x80 [wave5] [ 48.834495] sp : ffff8000856e3a30 [ 48.834497] x29: ffff8000856e3a30 x28: ffff0008093f6010 x27: ffff000809158130 [ 48.834504] x26: 0000000000000000 x25: ffff00080b625000 x24: ffff000804a9ba80 [ 48.834509] x23: ffff000802343028 x22: ffff000809158150 x21: ffff000802218000 [ 48.834513] x20: ffff0008093f6000 x19: ffff0008093f6000 x18: 0000000000000000 [ 48.834518] x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffff74009618 [ 48.834523] x14: 000000010000000c x13: 0000000000000000 x12: 0000000000000000 [ 48.834527] x11: ffffffffffffffff x10: ffffffffffffffff x9 : ffff000802343028 [ 48.834532] x8 : ffff00080b6252a0 x7 : 0000000000000038 x6 : 0000000000000000 [ 48.834536] x5 : ffff00080b625060 x4 : 0000000000000000 x3 : 0000000000000000 [ 48.834541] x2 : 0000000000000000 x1 : ffff800084bf0118 x0 : ffff800084bf0000 [ 48.834547] Kernel panic - not syncing: Asynchronous SError Interrupt [ 48.834549] CPU: 0 UID: 0 PID: 1067 Comm: v4l2h265dec0:sr Not tainted 6.12.9-gc9e21a1ebd75-dirty linux4microchip#7 [ 48.834554] Hardware name: ti Texas Instruments J721S2 EVM/Texas Instruments J721S2 EVM, BIOS 2025.01-00345-gbaf3aaa8ecfa 01/01/2025 [ 48.834556] Call trace: [ 48.834559] dump_backtrace+0x94/0xec [ 48.834574] show_stack+0x18/0x24 [ 48.834579] dump_stack_lvl+0x38/0x90 [ 48.834585] dump_stack+0x18/0x24 [ 48.834588] panic+0x35c/0x3e0 [ 48.834592] nmi_panic+0x40/0x8c [ 48.834595] arm64_serror_panic+0x64/0x70 [ 48.834598] do_serror+0x3c/0x78 [ 48.834601] el1h_64_error_handler+0x34/0x4c [ 48.834605] el1h_64_error+0x64/0x68 [ 48.834608] wave5_dec_clr_disp_flag+0x40/0x80 [wave5] [ 48.834615] wave5_vpu_dec_clr_disp_flag+0x54/0x80 [wave5] [ 48.834622] wave5_vpu_dec_buf_queue+0x19c/0x1a0 [wave5] [ 48.834628] __enqueue_in_driver+0x3c/0x74 [videobuf2_common] [ 48.834639] vb2_core_qbuf+0x508/0x61c [videobuf2_common] [ 48.834646] vb2_qbuf+0xa4/0x168 [videobuf2_v4l2] [ 48.834656] v4l2_m2m_qbuf+0x80/0x238 [v4l2_mem2mem] [ 48.834666] v4l2_m2m_ioctl_qbuf+0x18/0x24 [v4l2_mem2mem] [ 48.834673] v4l_qbuf+0x48/0x5c [videodev] [ 48.834704] __video_do_ioctl+0x180/0x3f0 [videodev] [ 48.834725] video_usercopy+0x2ec/0x68c [videodev] [ 48.834745] video_ioctl2+0x18/0x24 [videodev] [ 48.834766] v4l2_ioctl+0x40/0x60 [videodev] [ 48.834786] __arm64_sys_ioctl+0xa8/0xec [ 48.834793] invoke_syscall+0x44/0x100 [ 48.834800] el0_svc_common.constprop.0+0xc0/0xe0 [ 48.834804] do_el0_svc+0x1c/0x28 [ 48.834809] el0_svc+0x30/0xd0 [ 48.834813] el0t_64_sync_handler+0xc0/0xc4 [ 48.834816] el0t_64_sync+0x190/0x194 [ 48.834820] SMP: stopping secondary CPUs [ 48.834831] Kernel Offset: disabled [ 48.834833] CPU features: 0x08,00002002,80200000,4200421b [ 48.834837] Memory Limit: none [ 49.161404] ---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]--- Fixes: 2092b38 ("media: chips-media: wave5: Support runtime suspend/resume") Cc: stable@vger.kernel.org Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com> Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Brandon Brnich <b-brnich@ti.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 526816f commit 27cb12b

4 files changed

Lines changed: 3 additions & 22 deletions

File tree

drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ static void wave5_vpu_dec_buf_queue_dst(struct vb2_buffer *vb)
12431243
struct vpu_instance *inst = vb2_get_drv_priv(vb->vb2_queue);
12441244
struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx;
12451245

1246+
pm_runtime_resume_and_get(inst->dev->dev);
12461247
vbuf->sequence = inst->queued_dst_buf_num++;
12471248

12481249
if (inst->state == VPU_INST_STATE_PIC_RUN) {
@@ -1275,6 +1276,7 @@ static void wave5_vpu_dec_buf_queue_dst(struct vb2_buffer *vb)
12751276
} else {
12761277
v4l2_m2m_buf_queue(m2m_ctx, vbuf);
12771278
}
1279+
pm_runtime_put_autosuspend(inst->dev->dev);
12781280
}
12791281

12801282
static void wave5_vpu_dec_buf_queue(struct vb2_buffer *vb)
@@ -1827,9 +1829,6 @@ static int wave5_vpu_open_dec(struct file *filp)
18271829
if (ret)
18281830
goto cleanup_inst;
18291831

1830-
if (list_empty(&dev->instances))
1831-
pm_runtime_use_autosuspend(inst->dev->dev);
1832-
18331832
list_add_tail(&inst->list, &dev->instances);
18341833

18351834
mutex_unlock(&dev->dev_lock);

drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,9 +1773,6 @@ static int wave5_vpu_open_enc(struct file *filp)
17731773
if (ret)
17741774
goto cleanup_inst;
17751775

1776-
if (list_empty(&dev->instances))
1777-
pm_runtime_use_autosuspend(inst->dev->dev);
1778-
17791776
list_add_tail(&inst->list, &dev->instances);
17801777

17811778
mutex_unlock(&dev->dev_lock);

drivers/media/platform/chips-media/wave5/wave5-vpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int wave5_vpu_probe(struct platform_device *pdev)
322322
dev_info(&pdev->dev, "Product Code: 0x%x\n", dev->product_code);
323323
dev_info(&pdev->dev, "Firmware Revision: %u\n", fw_revision);
324324

325-
pm_runtime_set_autosuspend_delay(&pdev->dev, 100);
325+
pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
326326
pm_runtime_use_autosuspend(&pdev->dev);
327327
pm_runtime_enable(&pdev->dev);
328328
wave5_vpu_sleep_wake(&pdev->dev, true, NULL, 0);

drivers/media/platform/chips-media/wave5/wave5-vpuapi.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ int wave5_vpu_dec_close(struct vpu_instance *inst, u32 *fail_res)
207207
int retry = 0;
208208
struct vpu_device *vpu_dev = inst->dev;
209209
int i;
210-
int inst_count = 0;
211-
struct vpu_instance *inst_elm;
212210

213211
*fail_res = 0;
214212
if (!inst->codec_info)
@@ -250,11 +248,6 @@ int wave5_vpu_dec_close(struct vpu_instance *inst, u32 *fail_res)
250248

251249
wave5_vdi_free_dma_memory(vpu_dev, &p_dec_info->vb_task);
252250

253-
list_for_each_entry(inst_elm, &vpu_dev->instances, list)
254-
inst_count++;
255-
if (inst_count == 1)
256-
pm_runtime_dont_use_autosuspend(vpu_dev->dev);
257-
258251
unlock_and_return:
259252
mutex_unlock(&vpu_dev->hw_lock);
260253
pm_runtime_put_sync(inst->dev->dev);
@@ -720,8 +713,6 @@ int wave5_vpu_enc_close(struct vpu_instance *inst, u32 *fail_res)
720713
int ret;
721714
int retry = 0;
722715
struct vpu_device *vpu_dev = inst->dev;
723-
int inst_count = 0;
724-
struct vpu_instance *inst_elm;
725716

726717
*fail_res = 0;
727718
if (!inst->codec_info)
@@ -764,12 +755,6 @@ int wave5_vpu_enc_close(struct vpu_instance *inst, u32 *fail_res)
764755
}
765756

766757
wave5_vdi_free_dma_memory(vpu_dev, &p_enc_info->vb_task);
767-
768-
list_for_each_entry(inst_elm, &vpu_dev->instances, list)
769-
inst_count++;
770-
if (inst_count == 1)
771-
pm_runtime_dont_use_autosuspend(vpu_dev->dev);
772-
773758
mutex_unlock(&vpu_dev->hw_lock);
774759
pm_runtime_put_sync(inst->dev->dev);
775760

0 commit comments

Comments
 (0)