From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAE9928EA54; Thu, 3 Apr 2025 19:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707566; cv=none; b=l7gKEtFPpWUshsnasa7wf8SGOQg9D8/koiKNlmpDPaeb/9clE3+/wDZssbnIVfimxIJJ8LpnrrN9HrCVdC6Fnza2ToBbK4/kzPsGlZ53Tin0OYourNSZOR9FZ5bGWSQbuUqG7sdEY1tV3zcF89kgHsnSbTG7plhCyTLEPBq1ukw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707566; c=relaxed/simple; bh=ti7BnFPRNxZsXgYT542e+xpuaGAeILN68OLZFikaWow=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MuJ7Nwi55rrSHMnur4JDASEU+aYNDbKEHUhDYNFUSWhQznlGZk7d5DZ5fo7YaTEF9rd57heoV/4eFRrKh2f9Cx9WeMIria/n697mhhYk0K85SUs5lfP/CPm2CRsZ9FSgXqaaCOQeeklZuqvQgdOjl0w6ZgzJe3eABCeDiJIFOYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WlgCDi5s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WlgCDi5s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3C9C4CEE3; Thu, 3 Apr 2025 19:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743707566; bh=ti7BnFPRNxZsXgYT542e+xpuaGAeILN68OLZFikaWow=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WlgCDi5sjxy5cssmx2bWJiubLmFGbFQMqDTYkizHNxGUJR2jr6DZGqKeqUQ9BWM76 7pp5KS/oktb7tp879Teyy+sklLOyVdzNZ/tlpVU8CoUcu7IxDuF968QRHEGxPTpoF6 c1LjANMobPQSLVbs7CE4Ol4VMeKIfek1MD7uy0TODFQ1RBJw1lXDUH1cLXC7LejF/d ElIItSylmAc881BhB8AkhG+YXDQ4PZyHP0TB8LV0f6BTtyBcnt0aq9nvIpG+QP0mzC 4uEhTGu6N5VfClttHIYslj7K2nGQGCRB6EGpUxQTSojJf1SAchg9f1SvY7KFcpgKrk x07NsG1x7FNqw== Date: Thu, 3 Apr 2025 22:12:41 +0300 From: Jarkko Sakkinen To: "Reshetova, Elena" Cc: "Annapurve, Vishal" , "Hansen, Dave" , "linux-sgx@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "Mallick, Asit K" , "Scarlata, Vincent R" , "Cai, Chong" , "Aktas, Erdem" , "dionnaglaze@google.com" , "bondarn@google.com" , "Raynor, Scott" Subject: Re: [PATCH v2 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc Message-ID: References: <20250328125859.73803-1-elena.reshetova@intel.com> <20250328125859.73803-3-elena.reshetova@intel.com> Precedence: bulk X-Mailing-List: linux-sgx@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Apr 02, 2025 at 01:11:25PM +0000, Reshetova, Elena wrote: > > > current SGX kernel code does not handle such errors in any other way > > > than notifying that operation failed for other ENCLS leaves. So, I don't > > > see why ENCLS[EUPDATESVN] should be different from existing behaviour? > > > > While not disagreeing fully (it depends on call site), in some > > situations it is more difficult to take more preventive actions. > > > > This is a situation where we know that there are *zero* EPC pages in > > traffic so it is relatively easy to stop the madness, isn't it? > > > > I guess the best action would be make sgx_alloc_epc_page() return > > consistently -ENOMEM, if the unexpected happens. > > But this would be very misleading imo. We do have memory, even page > allocation might function as normal in EPC, the only thing that is broken > can be EUPDATESVN functionality. Returning -ENOMEM in this case seems > wrong. This makes it not misleading at all: pr_err("EUPDATESVN: unknown error %d\n", ret); Since hardware should never return this, it indicates a kernel bug. BR, Jarkko