Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2529569pxj; Mon, 14 Jun 2021 00:26:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjIZy2BDGVsCxfqlTGrJvbbw6nZAkxRsgQk4g9yjR60BeaqoxH65SkTVq3GE7ZmoAdObK+ X-Received: by 2002:a17:906:4697:: with SMTP id a23mr14107891ejr.305.1623655559989; Mon, 14 Jun 2021 00:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623655559; cv=none; d=google.com; s=arc-20160816; b=dOcEQYlzFjmtb39542YRw8WQeSuSJRp4hv/f/3envHD42DoKPSHujGWiyXmgabN0sB jExG8TPmDJs3A/6IFTe51EleesJigMJf8WaGsY7UtTKZP7shM3HjgKiCDfC9GoawkWY8 Xq/h2/InRVFc0XzRsinOkWGQTIss8ooUi6acJVItdJsztDDLBXVUgZuiOQDMo+RWQtNl IZYcSM2ZK5Q7FfhC0fXchNtskoxEZqcU2x2zrPJFvjMe5PDhuCDZwCwJuXcYzeE4JpJy 7F79vdXsNH10Vy6bZaddcFutBIBAhbsC3Wkn+5QxlR7bsG7+usF82q9opZsJRckWUmey 87FA== 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=5jRGcJHTiG11neoPHXUv36GnpvlTeRnUszQDb6yQd7o=; b=LDcLQvr0cJZc4QSjtlgobU45WQeyMw9fEXpWUdImS9BhbJEXlcYC6+O8891gEa+PwP SLSqX7tULTudZVfjBvnv41iQUk3pARx9iw/QI6/9EI4GXOZu+HeR+9qrgDIZBGWOYalP uWnonaW0ajpoIXuF3xL7WZJW7X2q89v+LxjwEunpuAXZC/8ovp6aryK086tzcgoB2996 kb/aeCqNAR8hkYKPNv0rMGD55ScHZbo6F3trKEhizzdhZi8sD/hWSeaVCchhTW4lNa1s ho7FZf2wUxx3PAa1unnbzRbL1gP1fGz15HzovBscZGOxK1ryznuQ+svZkLC9jEYgkDoE VPxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bgtvZq4z; 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 f22si10794349ejb.54.2021.06.14.00.25.36; Mon, 14 Jun 2021 00:25:59 -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=@linaro.org header.s=google header.b=bgtvZq4z; 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 S232499AbhFNHYd (ORCPT + 99 others); Mon, 14 Jun 2021 03:24:33 -0400 Received: from mail-lf1-f41.google.com ([209.85.167.41]:43573 "EHLO mail-lf1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbhFNHYZ (ORCPT ); Mon, 14 Jun 2021 03:24:25 -0400 Received: by mail-lf1-f41.google.com with SMTP id x24so13809173lfr.10 for ; Mon, 14 Jun 2021 00:22:10 -0700 (PDT) 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=5jRGcJHTiG11neoPHXUv36GnpvlTeRnUszQDb6yQd7o=; b=bgtvZq4zv7MwlB4Sryfox6og15pTfRc5ZDO8AQ+3IuzoLGNa3Mb96UIlb8kDoC0GU6 O/2LnLlz0s30Pdse44EOriQkIkHFnYo/pcETCkBkH/RWCMmvAQnP0mFSs/XMvI/75Qc2 XkMT0mqwH6lOvvO/kzqG/tRpdbUE+xzp3NqV3C9bhtEK0kOqwRGtbKn9DJy4G46o9N5P UBoJKiFux8RcyLdjYhLXHDCGdRPPdMmezpf5zgoNiM6kq/akmIQxXteXo7ClTUMRb7Gu 6rcduJwVvZK0vNhbH0llqwT72tyqqCZRr689LmXffHlFlbHfE+5qtTaUG1PqDs8R3oou +Rpg== 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=5jRGcJHTiG11neoPHXUv36GnpvlTeRnUszQDb6yQd7o=; b=BYq38lwZyIIkFyt6G/Y57fFVqKOr7gjnc/SlVzHFIBliYHld7vKXvUlWC9BVAsBhnw irFsQflFFhR+AFVRjrb6mGH5E6ZRBiGjnE6SJZWChygKbhN0mGSbvFQfvgABqRMefG4I vtprPUkWbwP288RpEvLG93MxTkX3wVVvFWkckaov8UkHPC8lvcq/BEJeYzCBrmH5vUtk 5qQ6fzAv0VrCogNcJoShFKToG6ODN8dTGpCQ3MUda/S2OYTcRnngdJXK7hOAOgSdgTP+ ZuD7H9up+D3mlcE8NiJXhxPc8gCcNkfdSnD0JM4sO9xlyQA6h0Sys35MgEiqkmYZQUFx rUWw== X-Gm-Message-State: AOAM531K/uGF5/Q+YnD8eqvmGhlGC99nxIMoiol9FA8UHLb9YPoAJRdD efzie5CxR+qNnP5dYk65OVaNOg== X-Received: by 2002:a05:6512:3f17:: with SMTP id y23mr10687281lfa.412.1623655269462; Mon, 14 Jun 2021 00:21:09 -0700 (PDT) Received: from jade (h-79-136-85-3.A175.priv.bahnhof.se. [79.136.85.3]) by smtp.gmail.com with ESMTPSA id o14sm1388113lfi.193.2021.06.14.00.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 00:21:09 -0700 (PDT) Date: Mon, 14 Jun 2021 09:21:07 +0200 From: Jens Wiklander To: Tyler Hicks Cc: Allen Pais , Sumit Garg , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Vikas Gupta , Thirupathaiah Annapureddy , Pavel Tatashin , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , OP-TEE TrustedFirmware , linux-integrity , bcm-kernel-feedback-list@broadcom.com, linux-mips@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH v4 3/8] optee: fix tee out of memory failure seen during kexec reboot Message-ID: <20210614072107.GA1033436@jade> References: <20210610210913.536081-1-tyhicks@linux.microsoft.com> <20210610210913.536081-4-tyhicks@linux.microsoft.com> <20210611125326.GQ4910@sequoia> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210611125326.GQ4910@sequoia> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 07:53:26AM -0500, Tyler Hicks wrote: > On 2021-06-11 11:11:33, Jens Wiklander wrote: > > On Thu, Jun 10, 2021 at 11:09 PM Tyler Hicks > > 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 > > > Reviewed-by: Tyler Hicks > > > > Do we really need this considering the patch "optee: Refuse to load > > the driver under the kdump kernel"? > > Yes. That patch fixes boot hangs when all of the OP-TEE threads were in > the suspended state at the time of a kernel panic. The kexec into the > kdump kernel after a panic is an "emergency" kexec that doesn't even > call .shutdown hooks. There's no way for the OP-TEE driver to clean up > after itself. > > This patch disables the shm cache (and unregisters the shm buffers) > during a normal kexec from one perfectly working kernel into a new > kernel. This is required because the new kernel will not be able to > handle the virtual addresses that were cached under the old kernel. The > new kernel has an entirely different memory layout and the old addresses > point to unmapped memory or memory that's mapped but probably not a TEE > shm. Got it, thanks. Jens