Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579404pxb; Mon, 22 Feb 2021 05:53:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAcWRt7I7S4NLtmdJ66BlYvJOf2TB0HFuo03XlZpJ3EwYVIfy0+oU6Y2VgNmmFFNgaZXbT X-Received: by 2002:a17:906:9603:: with SMTP id s3mr10721484ejx.442.1614002032367; Mon, 22 Feb 2021 05:53:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614002032; cv=none; d=google.com; s=arc-20160816; b=QEbSBUx6/epN0OMIUfkORB5Rnv4/wnFxDsW3YF8mpZS0RziTFWOM/SxGeH++BLY3PF hCDQSDkxI+p4FRrSqW4V7DMLSCdJae4oY1ydCDThJU3VOPNUOJQTmQuUHng8Znwa8kKo ANdSDr+ZSrQLRj9D3OGXPeQz3jbqwpmpHHxeef6kZNkszWsZPKJrdyzHrh0uSGgJjT1l 4wTIiqRJOIsS+/AjUWZlJ4jC4T1Bjvfwe/R8rsq0OxMpoVdCoc1iyKARKEMAYlJgIQ5A T7SqTDMSXtrDFiQsTuFFPIgDx25aTysbSpEJvgZCUQYVwgcaML5nB80Arh3YF8M2Njnb 9Idg== 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=0cItSrOHNyqAnHmYlMTDJGOB4+40TVteNywMP5altWI=; b=vSZEcHRxDn7mwUXNIaKr2mU+v6SuCqD7UzDLUinTf+BAYKNUyzixYTkmdaDPNp53By u2KQ/mfnSkkBTM2yquFc6GckPkMvjul0OSOrtod8C5mUVwR7GnaNjcaVdJaJ6TEdEsDB Htxg7kRWltm+KCcH+rGEb1eTp64D/tGZR0YtOY9+O4zFhpEFoTer+sM51VcmsfnUy7mg WIXrQsRQqQFIgfAv4vBRqeWJrKmORrS/+KAKP9jS7MKz2mBollNOXmxs/RHfph6fvjU+ Ms0LlSIBMNizQQG5MugWeh2KrmhLo5u8AM6RHG6mI27l3dQOw9mBtDdv7ZIUuKwopm8O Ko2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=S3opWeTu; 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 mb25si12623627ejb.519.2021.02.22.05.53.30; Mon, 22 Feb 2021 05:53:52 -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=S3opWeTu; 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 S231650AbhBVNua (ORCPT + 99 others); Mon, 22 Feb 2021 08:50:30 -0500 Received: from linux.microsoft.com ([13.77.154.182]:40572 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbhBVMpz (ORCPT ); Mon, 22 Feb 2021 07:45:55 -0500 Received: from [192.168.0.114] (unknown [49.207.208.227]) by linux.microsoft.com (Postfix) with ESMTPSA id D5C6B20B6C40; Mon, 22 Feb 2021 04:45:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D5C6B20B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1613997914; bh=0cItSrOHNyqAnHmYlMTDJGOB4+40TVteNywMP5altWI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=S3opWeTuHjAN4qY/hX6uq5/M2WjhFUhmr0tuz2c0Py7eyP7QBLEFjbQHSe5KTYoEG qg2ou051HmRjivkRNBMs5ii9KUYdRE4ur3owyF1Hqr9aqEwUuOQ/yDQZS2cx0CvTy6 SJTC53nhIk598tm7DvObgpudGc3MEObOHOwwZNzA= Subject: Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot To: Dhananjay Phadke , allen.lkml@gmail.com, jens.wiklander@linaro.org, zajec5@gmail.com Cc: 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> From: Allen Pais Message-ID: <8d87655f-27c6-6a66-6eb0-9244279fbf2c@linux.microsoft.com> Date: Mon, 22 Feb 2021 18:15:08 +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: <20210217092714.121297-2-allen.lkml@gmail.com> 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 > On Wed, 17 Feb 2021 14:57:12 +0530, Allen Pais wrote: >> - /* >> - * 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. - Allen