Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1358074rdb; Mon, 19 Feb 2024 12:43:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXu3H15CIVxuy2wSOJH+LN/BGxAlQTSn62Fiw0oOCq/ZbhUma6n8W/SaDgJp7B4UUx3vbv/tCiQJM9lw9wQ6+1IM9a++om1xXEMaQwo0w== X-Google-Smtp-Source: AGHT+IHaiDnrgZtCEfnnxDqjKsoo28I0XIk0A8bP/RPDrFlEl8EArWKIWT8d6Ke32qfjVZyZUrgL X-Received: by 2002:a05:620a:2453:b0:787:1e07:d14a with SMTP id h19-20020a05620a245300b007871e07d14amr20841599qkn.66.1708375385097; Mon, 19 Feb 2024 12:43:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708375385; cv=pass; d=google.com; s=arc-20160816; b=JPpTccqC4wPBZZ+sTtQMAdcx6zGp4zljLFL92EBw+qbickUYSPDEhWLrnkZk0pVq4e rsQHDzC3cLacUX5IPfGqOld+pdZbjHhVXKZT7cwtMfs+W6uBBazshapxTfDPrZQiWLFf pVo+M8P+zMSKhy/+aFQ6BKhu9QZAtPv5jhEDEJ9iZaDPb4D8I8efV3gJ73TU+Uffsz35 PqJGCYDF24xyM33DSPZ4S1s9oAjFvG1ms+9SNJse/x3eyGgp0Z7aPuARUX3UOUZdV04o UkoW2vaar/KERVg7rQIoXYvr56hzl7rrX5GXT9fzUE7GnNM5oDDjdacXcSualkBNAvyP Q4Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=HBw4Drjq9OahCr3CxUOTjtmaVtDUgjxrtw9QgJ8BRH0=; fh=RXmZ+XznKxg2vKL7GrHcJHdN8B9p4Unw/LQqJmgKm/s=; b=uX1BQwO34sT1By18WWUSNYjIfn4gIZxXn5yDKTffl8Zv1HrERZwF+o/BbbfkOBC3IX kj8SwoHNisuS7L67B1OQOX1h0tL4nhS/Q5aGG813uyugmeJby7g2Phf2yspXMcT6XQNe 5wWraaVkoDpqP9g/yi7ZUkU2bM8ui9jLh5yaJ8AKSj9L8IoFhP6qqLbQeayw6AbTxEw6 u/wleUwhm0X+zrZAdIDciBKEPReWV5tklFY59hiIlscjS4gldLz2DlUIlTP2lcjG7fCk Oat4SUazJ/L0vD/Zr3NURObl2S5xG0JpDa9jfAG1MQOkQZZSfM9xnlxh9QLJCv4vrbg5 3Psg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5pUuMn6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71979-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vq1-20020a05620a558100b007873ae574aasi7229543qkn.240.2024.02.19.12.43.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 12:43:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5pUuMn6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71979-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 92C7F1C24282 for ; Mon, 19 Feb 2024 20:42:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39F94537E9; Mon, 19 Feb 2024 20:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k5pUuMn6" 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 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