Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp590235lqd; Wed, 24 Apr 2024 10:49:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5qKCIiFGo0MoD5Jvy/220wpzr6Q5Oic7+66auzHHlMnd14UM3SlboauZ3H88nxVIyAMvN0M3RVYgaCEMWkoxsw2N4eOSdDIQO2rsIPg== X-Google-Smtp-Source: AGHT+IFmgLCdIL4A30n4wDTXL7e/cAFX+8SPb82eX1AbcGBbTUPg/qHGtxVOSv9VIizNQzDf21k/ X-Received: by 2002:a17:902:eccc:b0:1e8:682b:7f67 with SMTP id a12-20020a170902eccc00b001e8682b7f67mr604062plh.29.1713980948413; Wed, 24 Apr 2024 10:49:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713980948; cv=pass; d=google.com; s=arc-20160816; b=mTBo1C5YruJKh4BbaqX2EHbYBWNz2z9nx/UZi6XBclk85yKvo5Br04RubB/Hg9noaN /LFydwVkXWmMcD3412azcXpET3kJL4zRTxgIalRthjLfRbvjsVa4MHi2H4i7Y8jR7idr c813w/AAieEn2QmFA6zwCMDWG+GRCQVOAiOlgOFPqSaSjUnUy9boVLkOxdj8xceTKTyc 9w9Hg5GVRHAlVnXraSu8LGEkiOZL14Brk5R+SMdBg6n2YL0NpZqUGtbX+hZdAJ6CipfY /b4W/FWch6XneDAOUXj+t1O4xDqMDf0ZhCwLWVlZEIwXLgx1sPC1Sfl60TLDM7ZEDKBZ w+nA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=a+n74rxaOF4+DkOVqzem1w9+0wK2gMczlxpyXMAMSc4=; fh=lY/IMIHEK+pALvlYkNDe9ikBAIgR+RKCekuwR+vuFMo=; b=n/ZQrUVg/DUp5NncjNqw+M5936CcEkI1h3Q1ktB4D8YnLO4L/crP556p5TNPpbR7/E 6izPEv8oz+w5ElvWF1B4z88/pYGHZx5ci19H+PE5kNKORblIIzoue2S+EKJnDSh/nAh6 c1Vl4Clnwq2+zUiXdheqVs+uiJFJSfDw6OPRVUMeSmVKb+9Mcqg+CSatpkrdld9tOg9k 3+39owv+keU8gaywt5MrcJPybApDkbWXMANvFYlF0n9SqCOSf48rK5yuL730jOlEt09H V9dClhksctYfoiiifM7L95sinGp1Ma6gPelwq5udzYzYwt/Nm5qf+G6Dtn5R87nd1gwy z9Bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QDmgGL6x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-157420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l9-20020a170902d34900b001e5560d8535si11214389plk.442.2024.04.24.10.49.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:49:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QDmgGL6x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-157420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CAB91287BDB for ; Wed, 24 Apr 2024 17:47:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C373C16D4EC; Wed, 24 Apr 2024 17:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QDmgGL6x" 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 EB07216D4DD; Wed, 24 Apr 2024 17:47:50 +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=1713980871; cv=none; b=lyLk/PdhDr3kkvu0/VyCN85F/aa6tSKG1fwAiYwSRmidqo+j6ZFtO1CxI0dqH9WTBCP3hzHOlju5Bg0HvvvQqgk+Waq3QcO7bs/UQVGDcjkZ2MFK0yPWMTKUNhQH3MWcA9TyHuy0SLWOhpeWcRxokRKFB38RqPxE6YXBHAlbHSI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713980871; c=relaxed/simple; bh=a+n74rxaOF4+DkOVqzem1w9+0wK2gMczlxpyXMAMSc4=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=DwSb5lsM0eh5OPTyX9NlarU3zDJikjKJKWn5ds3qQe35onXnWLiLyLgdE3gj4spWnh/96Bb09PW/qgkv/g8qDHSLrxvdi/dC+kocrXY98e6bmttXfFVKOtoiIOByLAEAix76gr31j24DtNwr3L7Ch5JUNdmeePOZDH6DNLY8zns= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QDmgGL6x; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B68F1C113CD; Wed, 24 Apr 2024 17:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713980870; bh=a+n74rxaOF4+DkOVqzem1w9+0wK2gMczlxpyXMAMSc4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QDmgGL6xi8606me5qaR5+4uSai8DhMTbeOnm3XCe7aV4lCga+EFQEs19L3ofUS3ga vHoELpWL6BPdv+faFoP8NpGx+JXmlRWWqdM8nVCLH29wuQa+knkAaZ1efDTBuBtipz yeGM2Z9vV3jI58juoQbJfd6e0AWgrkQpAqu2aeF0bTf0ZEIOOstkiRVxd3vr+Rwpwv sMRn3Mr2P88U0JN98Zn9/PGwFes6UCa4GXLOppD7MA5BhOT9QDPa1sYJ2i34OQFuZm Z+DQBrhS+8NXgPkKmsqo8QYtWg4cLy0c+/DqtsLtpPXllDC+tUiju86gZaci+5F8tP b06pL4HGFRHHg== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 24 Apr 2024 20:47:46 +0300 Message-Id: From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "Bojun Zhu" Cc: "Huang, Kai" , "linux-sgx@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "dave.hansen@linux.intel.com" , =?utf-8?b?5YiY5Y+MKOi9qeWxuSk=?= , "Chatre, Reinette" Subject: Re: [RFC PATCH 1/1] x86/sgx: Explicitly give up the CPU in EDMM's ioctl() to avoid softlockup X-Mailer: aerc 0.17.0 References: <20240423092550.59297-1-zhubojun.zbj@antgroup.com> <20240423092550.59297-2-zhubojun.zbj@antgroup.com> <02fe00c3b10e4476d500ad7a34024b7eae5e3c97.camel@intel.com> <85dfbebc-a2d5-4828-b3b9-f929cd6e30cf@antgroup.com> In-Reply-To: On Wed Apr 24, 2024 at 8:44 PM EEST, Jarkko Sakkinen wrote: > On Wed Apr 24, 2024 at 2:50 PM EEST, Bojun Zhu wrote: > > I still have some questions: > > > > It seems that the variable "ret" is set to 0 if there is **some** EPC p= ages have been=20 > > added when interrupted by signal(Supposed that sgx_encl_add_page()=20 > > always returns successfully). > > Ah, ok. > > Returning zero is right thing to do because it also returns count of > pages successfully added. I.e. the function does not guarantee that > all pages are processsed but it does guarantee that the system is in > predictable state. > > It could be that e.g. sgx_alloc_epc_page() calls fails. > > So, it is a bit like how read system call works. Good that you asked that had rethink for a while. What I would suggest that you just put out 2nd verson out and then we see where it is going. For sgx_ioc_encl_add_pages() it is important to maintain exact semantics as we need to maintain backwards compatibility. BR, Jarkko