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 X-Spam-Level: X-Spam-Status: No, score=-28.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EBC5C433E0 for ; Thu, 18 Mar 2021 20:54:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D6A064ED5 for ; Thu, 18 Mar 2021 20:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233121AbhCRUyC (ORCPT ); Thu, 18 Mar 2021 16:54:02 -0400 Received: from linux.microsoft.com ([13.77.154.182]:49620 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbhCRUxg (ORCPT ); Thu, 18 Mar 2021 16:53:36 -0400 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 5258F209C385; Thu, 18 Mar 2021 13:53:35 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5258F209C385 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1616100815; bh=P8Q00MkxdNHTzV0x6ph/OeeOS76Ja/xwdh4nzwlgQZ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eu5D4JPPdLkKA6GAlxVfLHNybD0L+96o3qtvz6V980xCQSUFyPQQaTKtdCeojjCKL naIy0NAIu0B827IpWnZ31KCnve2K0A4agCTbNiSK0TJhYvHEBnYzjIkkKxLlCnVdav mBpeMdd7AElD0bE4TAn4sKmS/If3AswXn6Ly6v5E= Date: Thu, 18 Mar 2021 15:51:43 -0500 From: Tyler Hicks To: Allen Pais Cc: jens.wiklander@linaro.org, zajec5@gmail.com, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Allen Pais Subject: Re: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot Message-ID: <20210318205143.GA6446@sequoia> References: <20210225090610.242623-1-allen.lkml@gmail.com> <20210225090610.242623-2-allen.lkml@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210225090610.242623-2-allen.lkml@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-02-25 14:36:09, Allen Pais wrote: > From: Allen Pais > > The following out of memory errors are seen on kexec reboot > from the optee core. > > [ 0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed > [ 0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22 > > tee_shm_release() is not invoked on dma shm buffer. > > Implement .shutdown() method to handle the release of the buffers > correctly. > > More info: > https://github.com/OP-TEE/optee_os/issues/3637 > > Signed-off-by: Allen Pais > --- > drivers/tee/optee/core.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > index cf4718c6d35d..80e2774b5e2a 100644 > --- a/drivers/tee/optee/core.c > +++ b/drivers/tee/optee/core.c > @@ -582,6 +582,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) > return ERR_PTR(-EINVAL); > } > > +/* optee_remove - Device Removal Routine > + * @pdev: platform device information struct > + * > + * optee_remove is called by platform subsystem to alter the driver ^ alert? > + * that it should release the device > + */ > + > static int optee_remove(struct platform_device *pdev) > { > struct optee *optee = platform_get_drvdata(pdev); > @@ -612,6 +619,18 @@ static int optee_remove(struct platform_device *pdev) > return 0; > } > > +/* optee_shutdown - Device Removal Routine > + * @pdev: platform device information struct > + * > + * platform_shutdown is called by the platform subsystem to alter ^ alert With those two changes, Reviewed-by: Tyler Hicks Tyler > + * the driver that a shutdown/reboot(or kexec) is happening and > + * device must be disabled. > + */ > +static void optee_shutdown(struct platform_device *pdev) > +{ > + optee_disable_shm_cache(platform_get_drvdata(pdev)); > +} > + > static int optee_probe(struct platform_device *pdev) > { > optee_invoke_fn *invoke_fn; > @@ -738,6 +757,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); > static struct platform_driver optee_driver = { > .probe = optee_probe, > .remove = optee_remove, > + .shutdown = optee_shutdown, > .driver = { > .name = "optee", > .of_match_table = optee_dt_match, > -- > 2.25.1 > 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 X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81271C433DB for ; Thu, 18 Mar 2021 20:55:32 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05FE664E37 for ; Thu, 18 Mar 2021 20:55:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05FE664E37 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ETD3xijYHINUtC3U55KEiki9bPY6aL8Tn1JFTcjUX6E=; b=gjVkExilzA03l46Qk9cM/NChS qLs4dKYkDdbCk7Pr5dlwc2vf0RvGsADZpotvDD+1htd6+BOcp1wvzkrG3Km3A0ygTrlWVa7SnW5SI Ak7MDx4f62DTiVvjVqI/mCXANxHCo+4+p3gc+GglOsO12WubvnFMLlF6nJwytmIrrumtygj0xKJzr p11GzE2qfT5c0yNPyp6SZ8GjcosyfUspcbxfZrb2N+pu8BGc09qDgA5z2gURJcYG6NuG+T7JcNYUL rnufLaq+KE2YGVR9lUrEFSpkZcSwFJN3eKycHFfzXLwthJP71qFTFMSCVFoc67t3DhlEpS3L7kamh Y6zHrSpcA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMzeO-0060oN-0D; Thu, 18 Mar 2021 20:53:48 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMzeF-0060nN-UQ for linux-arm-kernel@lists.infradead.org; Thu, 18 Mar 2021 20:53:43 +0000 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 5258F209C385; Thu, 18 Mar 2021 13:53:35 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5258F209C385 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1616100815; bh=P8Q00MkxdNHTzV0x6ph/OeeOS76Ja/xwdh4nzwlgQZ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eu5D4JPPdLkKA6GAlxVfLHNybD0L+96o3qtvz6V980xCQSUFyPQQaTKtdCeojjCKL naIy0NAIu0B827IpWnZ31KCnve2K0A4agCTbNiSK0TJhYvHEBnYzjIkkKxLlCnVdav mBpeMdd7AElD0bE4TAn4sKmS/If3AswXn6Ly6v5E= Date: Thu, 18 Mar 2021 15:51:43 -0500 From: Tyler Hicks To: Allen Pais Cc: jens.wiklander@linaro.org, zajec5@gmail.com, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Allen Pais Subject: Re: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot Message-ID: <20210318205143.GA6446@sequoia> References: <20210225090610.242623-1-allen.lkml@gmail.com> <20210225090610.242623-2-allen.lkml@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210225090610.242623-2-allen.lkml@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210318_205340_339569_EC90FD6A X-CRM114-Status: GOOD ( 24.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-02-25 14:36:09, Allen Pais wrote: > From: Allen Pais > > The following out of memory errors are seen on kexec reboot > from the optee core. > > [ 0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed > [ 0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22 > > tee_shm_release() is not invoked on dma shm buffer. > > Implement .shutdown() method to handle the release of the buffers > correctly. > > More info: > https://github.com/OP-TEE/optee_os/issues/3637 > > Signed-off-by: Allen Pais > --- > drivers/tee/optee/core.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > index cf4718c6d35d..80e2774b5e2a 100644 > --- a/drivers/tee/optee/core.c > +++ b/drivers/tee/optee/core.c > @@ -582,6 +582,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) > return ERR_PTR(-EINVAL); > } > > +/* optee_remove - Device Removal Routine > + * @pdev: platform device information struct > + * > + * optee_remove is called by platform subsystem to alter the driver ^ alert? > + * that it should release the device > + */ > + > static int optee_remove(struct platform_device *pdev) > { > struct optee *optee = platform_get_drvdata(pdev); > @@ -612,6 +619,18 @@ static int optee_remove(struct platform_device *pdev) > return 0; > } > > +/* optee_shutdown - Device Removal Routine > + * @pdev: platform device information struct > + * > + * platform_shutdown is called by the platform subsystem to alter ^ alert With those two changes, Reviewed-by: Tyler Hicks Tyler > + * the driver that a shutdown/reboot(or kexec) is happening and > + * device must be disabled. > + */ > +static void optee_shutdown(struct platform_device *pdev) > +{ > + optee_disable_shm_cache(platform_get_drvdata(pdev)); > +} > + > static int optee_probe(struct platform_device *pdev) > { > optee_invoke_fn *invoke_fn; > @@ -738,6 +757,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); > static struct platform_driver optee_driver = { > .probe = optee_probe, > .remove = optee_remove, > + .shutdown = optee_shutdown, > .driver = { > .name = "optee", > .of_match_table = optee_dt_match, > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel