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 57E3252F98; Mon, 19 Feb 2024 20:42:37 +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=1708375357; cv=none; b=qs1plX5ZoryiFMVf9e3DgC85dg/QH98/WrRUXXBuLbXmrnBlp0XlfPqkBSfsQtwiB/II6ElMlMF0h97LMG3I0DJwWOtKzJDZENY5ijCI4OSU4EhQ19WNQM/KDHTY71asMVboz0OuNS9zstdr25hTJ5EjrSsASFSsSGwflZ2BFVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708375357; c=relaxed/simple; bh=d17JEQ94N0uoQLFj1CrJnlh4bPeyeziOZO+AvWt/zv4=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=FEqLzjrViO0dn/8XMPL/suBP39virOurIsxftgQ7so8FtP8cABOx083Uh0CvcN9Z2X3/YW9/GuJCrCJZhl6M6wzvdQQCtgQpq0Dwdfkh4OzZAZ4RaviDVSbBq4LboUqtsrNNU59ubxtwuoRimfnNbTMPT59YkG632Ir2MLoowZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k5pUuMn6; 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="k5pUuMn6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11862C433F1; Mon, 19 Feb 2024 20:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708375356; bh=d17JEQ94N0uoQLFj1CrJnlh4bPeyeziOZO+AvWt/zv4=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=k5pUuMn6H9zU70hz/4BM/+jJxWd/6P6s/GlNOpjI4aNHEb3h5QgU2Yt70L+sc8jmV fSkW8AmYGlxnkTmvoyP9Y1aHKonKRM3URipwp05cKQ7ACRaQtkCe7Y4sFsU9EwCL2U 2w9s32jXTwzeELjkiU0MV1puiNRbVcJyyr7b00p+jGrTlncA70/aFTfprcWq3NEK3C P+Wk+zTniMfKYvHn72jZ1RDXt4yql2kWAY64zYJgvPNBjgVxeb3YKzcrkRrXO7+8WB DypU8nvqIGMr+zwVR5VT+S65iPgxIMOT0vJ9ERJVx4utYWdCmQ1jtMfEu7L68w4JlN /HmhjwWxzFELw== 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: Mon, 19 Feb 2024 20:42:29 +0000 Message-Id: Cc: , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH] x86/sgx: Remove 'reclaim' boolean parameters From: "Jarkko Sakkinen" To: "Dave Hansen" , "Haitao Huang" X-Mailer: aerc 0.15.2 References: <20240219153957.9957-1-haitao.huang@linux.intel.com> <40f95b90-8698-42dd-89d7-cd73d1e311b1@intel.com> In-Reply-To: <40f95b90-8698-42dd-89d7-cd73d1e311b1@intel.com> On Mon Feb 19, 2024 at 3:56 PM UTC, Dave Hansen wrote: > On 2/19/24 07:39, Haitao Huang wrote: > > Remove all boolean parameters for 'reclaim' from the function > > sgx_alloc_epc_page() and its callers by making two versions of each > > function. > >=20 > > Also opportunistically remove non-static declaration of > > __sgx_alloc_epc_page() and a typo > >=20 > > Signed-off-by: Haitao Huang > > Suggested-by: Jarkko Sakkinen > > --- > > arch/x86/kernel/cpu/sgx/encl.c | 56 +++++++++++++++++++++------ > > arch/x86/kernel/cpu/sgx/encl.h | 6 ++- > > arch/x86/kernel/cpu/sgx/ioctl.c | 23 ++++++++--- > > arch/x86/kernel/cpu/sgx/main.c | 68 ++++++++++++++++++++++----------- > > arch/x86/kernel/cpu/sgx/sgx.h | 4 +- > > arch/x86/kernel/cpu/sgx/virt.c | 2 +- > > 6 files changed, 115 insertions(+), 44 deletions(-) > > Jarkko, did this turn out how you expected? > > I think passing around a function pointer to *only* communicate 1 bit of > information is a _bit_ overkill here. > > Simply replacing the bool with: > > enum sgx_reclaim { > SGX_NO_RECLAIM, > SGX_DO_RECLAIM > }; > > would do the same thing. Right? > > Are you sure you want a function pointer for this? To look this in context I drafted quickly two branches representing imaginary next version of the patch set. I guess this would simpler and totally sufficient approach. With this approach I'd then change also: [PATCH v9 04/15] x86/sgx: Implement basic EPC misc cgroup functionality And add the enum-parameter already in that patch with just "no reclaim" enum. I.e. then 10/15 will add only "do reclaim" and the new functionality. BR, Jarkko