Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp249046pxb; Wed, 24 Feb 2021 00:37:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJywaYkQ1oF0ObsXoYraOFKazpe9bLVx36QDAC19jMSeW6hE23kUXYRnATRDdE+DjWTa5CvW X-Received: by 2002:a17:906:9b86:: with SMTP id dd6mr30657669ejc.516.1614155878963; Wed, 24 Feb 2021 00:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614155878; cv=none; d=google.com; s=arc-20160816; b=M4W8Ry9xFuNkBNJBEiRvD3MtSSRHIHvVTIJfQYhf5zCI3PWDuSSp3iqQ6EsTKoNLhc 26ayhYFJJ/2a91pygPVl909k1rpxaizkb6F6vLgBt7EiWWLwVKwuYyMbKB1IEiB9Cvbb h6WFRhOzZ0idy5Q/cJ7KqS2e2uXCl0ERN6FkUl9x4iPrGwfvhpHSHybx5pA/embNAXgs LsOGs/oupRBBTRBtrxGNRx9AboLql6vfYTuQmOX/7+pfU9oZReAclajm7e5EKz7RX3qh 8zMQlS/ndSQK6Oo2qk+ufWDLges/7Mhzw7d/7aAWz/Ja3QW3JnwhZRkNAJEKcVqR8ANJ 8NOw== 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; bh=zgACkb1Gl2wYqG0IX7Bk5ltVRdUXsQvJfegYjpg1tZE=; b=sQAicv+PeJD5ClfsZiiCytnoXI5Ix+Y1fSpYHDny8wfAxHLvgFFAi+cY+ddJg7Yhgx a94GdQmH3cPq1q84CpSUl1gvkJn3kPKxBvnYhnwCwiuO3VEl7Y9s+ZDHbVtChrsMJ1y9 lSazzifSXVmGLgfPW27u96F6jFFWrcDQreiU44j6YxvCN1WvEfx/R5APDloGWJi5VO1f ZVhe18Vwjzj3iOQ+w+zCzE4MZ2MngBteV/EuhmyZB8bqujy8Gkg8xU0m4IlPh1VKY9ig Be/ehyM/F6Rpb6duHW2445prcXT7kYKGsFnUq8HJKpNmooD2Cn04rjxjS2T1fJutKWsB cPVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u2YysyXZ; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si994092ejh.724.2021.02.24.00.37.35; Wed, 24 Feb 2021 00:37:58 -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=@linaro.org header.s=google header.b=u2YysyXZ; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbhBXIQ7 (ORCPT + 99 others); Wed, 24 Feb 2021 03:16:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232545AbhBXIQh (ORCPT ); Wed, 24 Feb 2021 03:16:37 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78678C06178B for ; Wed, 24 Feb 2021 00:15:57 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id z11so1692418lfb.9 for ; Wed, 24 Feb 2021 00:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zgACkb1Gl2wYqG0IX7Bk5ltVRdUXsQvJfegYjpg1tZE=; b=u2YysyXZkhrGm+nkbp3dNTPKlj2GGxT9cW+rv/Buicw/cO1h6RLXqSOfZQdk8ReIy/ i0v9BFCu5O8v/MQvq6V0DKaLPa3lt7rWT3yBlnpvXUw797B3oiK7yt88SrG8fRSkIHXj 9SqHGaFl3reLD3jznmhj86LLdkmGpZxmVoVuJIuJiRi9KHVrSQaC/NWckup0MiQ7jriK G0KYBU1xHnczdcN0rJ6t2RJf3OAiCohpVp49ZWdzOEhZ05A5JesIKPPi0CBHokQscnCo W19xIYp4DIWx6eLTctD3RsfPU4bYgU/7yIfCaYyEeD/Apj+Ul3Oxtj6NEGuC29wmVDfl QrFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zgACkb1Gl2wYqG0IX7Bk5ltVRdUXsQvJfegYjpg1tZE=; b=eMUDXsCOKjbReI1U2TCWYuRYikGc7+okYxQUJC+lM6JxoNHKcjGyYmgbddF5jEF3cW qZyMi0BmL+RLBmjTIWV50IsfBpoCIX0kxIi+8qm8st0jtJ+QVmn94wCiX7VvxaatylG0 CcbMBv1sXwSfSF1t4ZDr5A3o8YFCN5anMK6nve64QYqxqhr+MHAHNfbVaWF0+BF/w3T2 cl+rPRQN9b0K/f5DEAATaualThevrPT2UG0HrH1jwDX+3ouVbEVt2rfSt1q5F/BCew37 AcR6wFtSDW1dl47CQyfzB+qAqwbtDlaUZLIIGY4APAwQp8sP0EUFhSIfqFS88MqB+My1 GKGw== X-Gm-Message-State: AOAM531Qw/PERnNmIIxTy+zAjTkMfMQsx2BDw529jjvhix0kQzUfgZmp hQrguziLM6Qu37WCliKOybguvg== X-Received: by 2002:a05:6512:96e:: with SMTP id v14mr18111051lft.513.1614154555890; Wed, 24 Feb 2021 00:15:55 -0800 (PST) Received: from jade (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id a4sm290291ljk.50.2021.02.24.00.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 00:15:55 -0800 (PST) Date: Wed, 24 Feb 2021 09:15:53 +0100 From: Jens Wiklander To: Allen Pais 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 Subject: Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot Message-ID: <20210224081553.GB2653493@jade> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 09:56:13PM +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. > > > > 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. In the patch you posted it looks like you'd like to call only optee_disable_shm_cache() in the case of shutdown. Like: static void optee_shutdown(struct platform_device *pdev) { optee_disable_shm_cache(platform_get_drvdata(pdev)); } and optee_remove() kept as it was before this patch. Cheers, Jens