[PATCH v6, 6/7] media: mediatek: vcodec: prevent kernel crash when scp ipi timeout
Hans Verkuil
hverkuil-cisco at xs4all.nl
Wed May 18 04:34:13 PDT 2022
On 5/18/22 13:29, yunfei.dong at mediatek.com wrote:
> Dear Hans,
>
> Thanks for your review.
> On Wed, 2022-05-18 at 11:37 +0200, Hans Verkuil wrote:
>> Hi Yunfei,
>>
>> On 5/13/22 11:25, Yunfei Dong wrote:
>>> When SCP timeout during playing video, kernel crashes with
>>> following
>>> message. It's caused by accessing NULL pointer in
>>> vpu_dec_ipi_handler.
>>> This patch doesn't solve the root cause of NULL pointer, but merely
>>> prevent kernel crashed when encounter the NULL pointer.
>>
>> Is the root cause being addressed as well? Where is the root cause?
>> Is it
>> in this driver or in the scp (i.e. the remoteproc) driver?
>>
>> I need a bit more information to decide whether this series is ready
>> to
>> be merged for 5.20 or not.
>>
>> Regards,
>>
>> Hans
>>
> Vpu will be NUll when scp(micro processor) is hang or crash. Need to
> keep kernel works well , so add this patch.
OK, I think this should be stated in the commit log, and also in the code
(see below).
>
> Best Regards,
> Yunfei Dong
<snip>
>>> diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c
>>> b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c
>>> index 35f4d5583084..1041dd663e76 100644
>>> --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c
>>> +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c
>>> @@ -91,6 +91,11 @@ static void vpu_dec_ipi_handler(void *data,
>>> unsigned int len, void *priv)
>>> struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *)
>>> (unsigned long)msg-
>>>> ap_inst_addr;
>>>
>>> + if (!vpu) {
>>> + mtk_v4l2_err("ap_inst_addr is NULL");
E.g., either add a comment here or perhaps change the error message to:
"ap_inst_addr is NULL, did the SCP hang?"
Or something along those lines.
Shouldn't there be a \n at the end of this message as well? Or does
mtk_v4l2_err add that?
Regards,
Hans
>>> + return;
>>> + }
>>> +
>>> mtk_vcodec_debug(vpu, "+ id=%X", msg->msg_id);
>>>
>>> vpu->failure = msg->status;
>
More information about the Linux-mediatek
mailing list