From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55F1FC4332F for ; Wed, 18 May 2022 12:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236237AbiERMHD (ORCPT ); Wed, 18 May 2022 08:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236152AbiERMHB (ORCPT ); Wed, 18 May 2022 08:07:01 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDEFDAF1D4; Wed, 18 May 2022 05:06:56 -0700 (PDT) X-UUID: 19150da488a94fdab41ab2d65bdac7cb-20220518 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.5,REQID:cd629019-1e6a-4897-aec4-87e755b2b50b,OB:0,LO B:10,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:45,FILE:0,RULE:Release_Ham,AC TION:release,TS:45 X-CID-INFO: VERSION:1.1.5,REQID:cd629019-1e6a-4897-aec4-87e755b2b50b,OB:0,LOB: 10,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:45,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:45 X-CID-META: VersionHash:2a19b09,CLOUDID:feb5a6e2-edbf-4bd4-8a34-dfc5f7bb086d,C OID:65e73d4f7736,Recheck:0,SF:28|17|19|48,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,QS:0,BEC:nil X-UUID: 19150da488a94fdab41ab2d65bdac7cb-20220518 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1917153530; Wed, 18 May 2022 20:06:51 +0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Wed, 18 May 2022 20:06:50 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 May 2022 20:06:49 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 18 May 2022 20:06:48 +0800 Message-ID: Subject: Re: [PATCH v6, 6/7] media: mediatek: vcodec: prevent kernel crash when scp ipi timeout From: "yunfei.dong@mediatek.com" To: Hans Verkuil , Alexandre Courbot , Nicolas Dufresne , AngeloGioacchino Del Regno , Benjamin Gaignard , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa CC: George Sun , Xiaoyong Lu , Hsin-Yi Wang , "Fritz Koenig" , Daniel Vetter , dri-devel , Irui Wang , "Steve Cho" , , , , , , Date: Wed, 18 May 2022 20:06:48 +0800 In-Reply-To: <31992c67-400e-8e14-38c2-4655995886f5@xs4all.nl> References: <20220513092526.9670-1-yunfei.dong@mediatek.com> <20220513092526.9670-7-yunfei.dong@mediatek.com> <31992c67-400e-8e14-38c2-4655995886f5@xs4all.nl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Hans, Thanks for your suggestion. On Wed, 2022-05-18 at 13:34 +0200, Hans Verkuil wrote: > > On 5/18/22 13:29, yunfei.dong@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 > > > > > > > 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. > I will change the message in next patch like below. mtk_v4l2_err("ap_inst_addr is NULL, did the SCP hang or crash?"); > Shouldn't there be a \n at the end of this message as well? Or does > mtk_v4l2_err add that? > mtk_v4l2_err add '\n' in the end. > Regards, > > Hans > Best Regards, Yunfei Dong > > > > + return; > > > > + } > > > > + > > > > mtk_vcodec_debug(vpu, "+ id=%X", msg->msg_id); > > > > > > > > vpu->failure = msg->status;