Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2500519pxb; Tue, 23 Feb 2021 08:29:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvljFKJeEQvHYokz6hqzsAVvqqQ7LQ1WtO3ldqCl9Nctxe6joXdy5LPTH7vj1jlM4yXmvj X-Received: by 2002:a17:906:5195:: with SMTP id y21mr27311559ejk.345.1614097756048; Tue, 23 Feb 2021 08:29:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614097756; cv=none; d=google.com; s=arc-20160816; b=PZ7RrarhqkTH3EyDautqksASRmn/Zd2nYXVoOYCZQQOHxxSJQ/Tqrw38yJ0K+F6a9x m237BAFWinz0co41P5r2wAa6zLMCSTKm6YDXkOBPc/lRIYbiE4MO5kNqDLxWpSmEzExe Q/RIx3L79xKbO2t1uwKoMZTGYxG8B06vKcNuRZib7WFuLh8LJqU3l7LXXeA+vgVl8gPI BR0agOkvlPlww3qKNE2lW/eWJMwl/jWtBa8rbquqMEMab+dLqG49Pp1U3EmO+jFkJFu5 zT1vP4zWzMvdobZEoVS+8AVrRj4m/+M+9hrf6iqifEGN9Mo3OCE2PkfBCYd+z1A4LA2o A/FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-filter; bh=rgm+/skqLaNd7iHFRgkr7ujP2+6UCRA1yFShyxec1jY=; b=rw5h01gSwno93iaFSE1Um/mjseob5UgSGiYHIJkvuSZ04MdX/Kg4Uh8pKg9qtqN8NP jkaEnLq3XU1k92W56EWMwoLx7uxcIZJQ58kwPiImZYSVtJR7T53HfXVJ3rg/k1+1FxWT NX+tUTLTe2Xq7Qn8ve8R9jJF5/Qd1yZxZRcdFl85o8+HtrGxICVTGSKyTJbEv45A5rka 1VZrLE6u4qg7fX5kF8ztS3kLO7Qg6bH8N8RRLOPel8PQgp7Io6HgfkfRta2XKEAPrLY4 +ODAcmF18Zsd6M7gqVkdNsQ7bQr6jfKCBbsWY6cUG5UDUnzs1ngpK7cSD9wqtRDPjZSJ lqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lf4sWGLL; 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 x40si2285311ede.323.2021.02.23.08.28.51; Tue, 23 Feb 2021 08:29:16 -0800 (PST) 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=lf4sWGLL; 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 S233247AbhBWQ1B (ORCPT + 99 others); Tue, 23 Feb 2021 11:27:01 -0500 Received: from linux.microsoft.com ([13.77.154.182]:45978 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbhBWQ1B (ORCPT ); Tue, 23 Feb 2021 11:27:01 -0500 Received: from [192.168.0.114] (unknown [49.207.208.227]) by linux.microsoft.com (Postfix) with ESMTPSA id 5988820B6C40; Tue, 23 Feb 2021 08:26:16 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5988820B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1614097579; bh=rgm+/skqLaNd7iHFRgkr7ujP2+6UCRA1yFShyxec1jY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lf4sWGLLPk44GWLVBceyKSvrSqpY3QJTFmZuXPgN8DBoeCzp3w5f34tPLcES1g2+9 40MDhiURkmlff0O75wrSP3dW0uFIvOi/TUTtAO0YQBOJwQ1/eXhwOA3zoHgzRfNMib dbeMQSJvu0iCpjo74UV4Osgyl0RtvS+6JozOqh20= Subject: Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot To: Jens Wiklander Cc: Dhananjay Phadke , allen.lkml@gmail.com, zajec5@gmail.com, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, op-tee@lists.trustedfirmware.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com References: <20210217092714.121297-2-allen.lkml@gmail.com> <20210217092714.121297-2-allen.lkml@gmail.com> <8d87655f-27c6-6a66-6eb0-9244279fbf2c@linux.microsoft.com> <20210223081948.GA1836717@jade> From: Allen Pais Message-ID: Date: Tue, 23 Feb 2021 21:56:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210223081948.GA1836717@jade> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> - /* >>>> - * Ask OP-TEE to free all cached shared memory objects to decrease >>>> - * reference counters and also avoid wild pointers in secure world >>>> - * into the old shared memory range. >>>> - */ >>>> - optee_disable_shm_cache(optee); >>>> + if (shutdown) { >>>> + optee_disable_shm_cache(optee); >>>> + } else { >>>> + /* >>>> + * Ask OP-TEE to free all cached shared memory >>>> + * objects to decrease reference counters and >>>> + * also avoid wild pointers in secure world >>>> + * into the old shared memory range. >>>> + */ >>>> + optee_disable_shm_cache(optee); >>> Calling optee_disable_shm_cache() in both if and else. It could be >>> put in front of if(). >>> >> >> Ideally, I could just use optee_remove for shutdown() too. >> But it would not look good. Hence this approach. > > What is the problem with using optee_remove() for shutdown()? > There is no problem, I just thought it would be more cleaner/readable with this approach. If you'd like to keep it simple by just calling optee_remove() for shutdown() too, I could quickly send out V2. Thanks for the review. - Allen