Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp879604pxf; Thu, 18 Mar 2021 13:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKnmXUfYbgsteqKK4VXhz8W/DnObGYoom4GAe89ASyQvxt92mYHPYa3vFv34It+LVOzUxl X-Received: by 2002:a17:906:86c6:: with SMTP id j6mr473875ejy.197.1616100952227; Thu, 18 Mar 2021 13:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616100952; cv=none; d=google.com; s=arc-20160816; b=gWBMDZhxYFeyhHeK/88IXqIbK1p71kDZHo3MT+vKuUgtEuZlqX514wHztydxbvTmtA bCx1p+n+RmPWPEkfZ2WFH2iOmgvQ/bEqyb4QzXvsPS+U1t/SN2WUnbc0Yu8K1khpKGI/ U88NiMVbTtw6lVMNMY31m6rNaU/GgcpjSNrL3dAaHiRfv6UICK8ebY4yuKRpKuh4j9G9 U3m5tvYKMthwz5pZ/kDGlnE2Ev4edm+aLlcbrGR9TDKJGsMPqN84Q81/5BTw51jgijRC ahukPHkFWfxsNVS1pjgSZ8+1ezbNuyj6Wq+w8cOElNUaPMXZcyxyY25r2TVVFyVfGgXx gS9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=P8Q00MkxdNHTzV0x6ph/OeeOS76Ja/xwdh4nzwlgQZ0=; b=F9c0aQH2a2YCi8d2F1t4Rw9bNxOV1YsKFcyWOnJz75lQCh6QsEVyMT1EDJui1+yVUV niB8zFesNlc2AiYqP4J8VBugC2SmBqWfICgPqjNSu373boflK4MA3gq6Gf2CWvH4ne/J 1JGv9cEo2ra6OZxiOeUKD2tFQeGlVH0Yar5IZugcZxvvIU2qhB6tZh1aXKnfeew9mr78 2oXaJ2g/kUms9u3tbSl9ptVn3jqkeabniEbD0HLx/6fywmPE9p6Xkppk+5hNR+XZ74hm zofdcelOa1Yu63zEQ5Hx+dwjFZdDmPIOUp23Vs0pxhAyKddDXi3AK/5lcCjFufCXbmnr N8Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eu5D4JPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si2393753ejh.313.2021.03.18.13.55.30; Thu, 18 Mar 2021 13:55:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eu5D4JPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233094AbhCRUyB (ORCPT + 99 others); Thu, 18 Mar 2021 16:54:01 -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 >