Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp549770pxj; Fri, 11 Jun 2021 05:54:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxw8cYOzauFhsGEkcD5qHXkXP7LW/93JlRibhR5P9hH3dPuVZpzfRdE7ofIZ8Dgqy1kzxbv X-Received: by 2002:a05:6402:1cad:: with SMTP id cz13mr2304615edb.67.1623416092867; Fri, 11 Jun 2021 05:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623416092; cv=none; d=google.com; s=arc-20160816; b=wVuAaSheucrvtwLldG470lOqJuiXubNOeTatecrg49Uhfw6e9TGYJz6NmeO6sKRVUc P3pEMnJYELpmZZmVrcs3sksP3hUwTtxSseAhT0aIcrvCDEDDLaZg1i0w8f4TC9XLuhf/ E2z9/fUYvRKQJnWUOU2EjZUfRvRKQYT0/xBdrE195YqSS7sN5dFxgvkSzKpbU/cxBzb+ 2PN802PuqXwoUOl/xc2spZDuhqSQE54bLTF+T4BjX7eQVWGiigcniKSGB3VP3+BUHbSO 6FRTuCzqHigOWNVSM3O9/59JX45sml/jngyWiygOqRa3x4P434EqUOpzpgPPzGCSRcUN yN+w== 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=/cTsy8OGaEU/zCQc9L/8YrQzHcLViQBgidbXiYXlsFI=; b=kQcJLjQc4/AmT09zM+fYWqimBlSNKQR51LGmle5FDZy7H7gi8sqhEX16EY/sy8d09r 4bVkx7IweEWTEUHWXHfwvii/NawCFvi5simFgY7RITA2C2REX66eGAxmBeZ2YkzcfdHT J/RpwxfsoqEGULL5bo0+cnFNusqTtg09qs95RdbxBh40ePfShj1SMKPhyNhIrR5xy35q UU+u6RxCuqgMWmqtZXMjyKBLr9JIbzNOPDadsKIavMJnZih3vDNudJk2YtY3/FiLplkv uIoBiwAldHclyWzJmXZWpzzxcXXTGu6wJuov5rmvxlUuSgz+EF2j7aaQKdgO0FKDVdn1 nUxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=g5OiGVB4; 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 a16si4674278edy.330.2021.06.11.05.54.29; Fri, 11 Jun 2021 05:54: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=g5OiGVB4; 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 S231251AbhFKMz1 (ORCPT + 99 others); Fri, 11 Jun 2021 08:55:27 -0400 Received: from linux.microsoft.com ([13.77.154.182]:38666 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbhFKMz1 (ORCPT ); Fri, 11 Jun 2021 08:55:27 -0400 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 1E38A20B7178; Fri, 11 Jun 2021 05:53:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1E38A20B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1623416009; bh=/cTsy8OGaEU/zCQc9L/8YrQzHcLViQBgidbXiYXlsFI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g5OiGVB4m3mJcPxTG/Y/h4H/AIbequvqN042kTAxfzpbO/RnN+S9jdNuq7YXQf3SS cGp+pUj2THgiOumGn+Mf2YQ+kUp7ONyzL8mvLHKelSMNmh68wcE4E1CXBSupnVDbVZ SpvH/9rwBxHKKlNq5zxb+ZTeGAEod6vShaKQYbdU= Date: Fri, 11 Jun 2021 07:53:26 -0500 From: Tyler Hicks To: Jens Wiklander 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: <20210611125326.GQ4910@sequoia> References: <20210610210913.536081-1-tyhicks@linux.microsoft.com> <20210610210913.536081-4-tyhicks@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Tyler > > Jens >