• Yunfei Dong's avatar
    media: mediatek: vcodec: fix cancel_work_sync fail with fluster test · d05dea76
    Yunfei Dong authored
    Will cause below warning then reboot when exercising the decoder with
    fluster on mt8192-asurada-spherion.
    
    This deinit function is called on the v4l2 release callback, even though
    the work might not have been initialized as that only happens if/when the
    codec specific 'decode' callback is called (as a result of device_run m2m
    callback).
    
    CPU: 5 PID: 2338 Comm: gst-launch-1.0 Tainted: G        W          6.4.0-rc5-next-20230607+ #475
    Hardware name: Google Spherion (rev0 - 3) (DT)
    pstate: 00400009 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : __flush_work.isra.0+0x23c/0x258
    lr : __cancel_work_timer+0x14c/0x1c8
    sp : ffff8000896e3b00
    x29: ffff8000896e3b00 x28: ffff57c3d4079f80 x27: 0000000000000000
    x26: ffff57c3d4079f80 x25: ffffb76395b59dc8 x24: 0000000000000001
    x23: ffffb763928daab8 x22: ffff57c3d4079f80 x21: 0000000000000000
    x20: ffffb763955f6778 x19: ffff57c3cf06f4a0 x18: 0000000000000000
    x17: 000000040044ffff x16: 005000f2b5503510 x15: 0000000000000000
    x14: ffff57c3c03a1f80 x13: ffffa0616a2fc000 x12: 000000003464d91d
    x11: 0000000000000000 x10: 0000000000001b10 x9 : ffffb763928de61c
    x8 : ffff57c3d407baf0 x7 : 0000000000000000 x6 : ffff57c3d4079f80
    x5 : ffff57c3d4079f80 x4 : 0000000000000000 x3 : 0000000000000000
    x2 : ffff8000896e3bf0 x1 : 0000000000000011 x0 : 0000000000000000
    Call trace:
     __flush_work.isra.0+0x23c/0x258
     __cancel_work_timer+0x14c/0x1c8
     cancel_work_sync+0x1c/0x30
     vdec_msg_queue_deinit+0xac/0xc8
     vdec_h264_slice_deinit+0x64/0xb8
     vdec_if_deinit+0x3c/0x68
     mtk_vcodec_dec_release+0x20/0x40
     fops_vcodec_release+0x50/0xd8
     v4l2_release+0x7c/0x100
     __fput+0x80/0x270
     ____fput+0x18/0x30
     task_work_run+0x78/0xe0
     do_notify_resume+0x29c/0x7f8
     el0_svc+0xa4/0xb8
     el0t_64_sync_handler+0xc0/0xc8
     el0t_64_sync+0x1a8/0x1b0
    ---[ end trace 0000000000000000 ]---
    
    Fixes: 297160d4 ("media: mediatek: vcodec: move core context from device to each instance")
    Reported-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
    Signed-off-by: default avatarYunfei Dong <yunfei.dong@mediatek.com>
    Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    d05dea76
vdec_msg_queue.c 10.3 KB