Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp733927rwb; Thu, 8 Dec 2022 02:10:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4/uKFaHwdzur32Jkbv+yUqCOzbctQa82xqq/wvm4WJxiL+s0qZgQs6y2YQeo4M2wGdshVu X-Received: by 2002:a17:902:d1d2:b0:189:d637:cc63 with SMTP id g18-20020a170902d1d200b00189d637cc63mr17313070plb.92.1670494221094; Thu, 08 Dec 2022 02:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670494221; cv=none; d=google.com; s=arc-20160816; b=J6WVF+urtKpWNV4A2NRJ40oc6vBH9POMkW2tmILGVyKSD/FEa1TxoMK3SC3OIEsGZK kcF6P87VaMBY0f3FVhe3iHxcxGa6QczVpteI4nArxU+dKYnyZioV8Xt9OS0OnkK04+k7 F+CgGdTsGd+MBKqjtRxDpcTCOnA1czwU8ul8bKlT6g2qsNhkQNdmXG5QrF+MExw7eoV9 4B0eILsEKznnt0MrtNn++8Xp+rDXTjabRpKFhuZOylhGMEbbuhK32XjwUBlCm4ri/gGQ vyWrCYfrEcT0SXj2weFQ4CGRWy2pgZjb0UYCBVOeFuk+8ku2WD5Xf5clCIXlXsE85xaD U2yA== 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; bh=GzUKdfg5Cx3d5oMi/sxJoqDCZxkDXG27Sq7dbri+xQo=; b=ZkVuKhOS/G6VZ3gckMFOcC94cJFRfPUofQvpBnBjxhdPlRKGP/PPkqSN2HCgOyI24r fUSGEgBS0AF6q1DfMNfyx+BcaxnCMhVN9/hNMfqk8pEYkdIW6SyGxE1ggwCdFF9LJQPB bF5NkndhbeP2B2u/tyGAvFUlu3IiAQwg73jQVWHFGYSg5cq6/DzFCyLeYN231KqGOk6h X+pEklzJpHFgJyR/1JKsYfQvb6lLn8kcbcT7Vbp7x67sJMaihvq5hWz2q8P3nHLgbX37 Bto3vLM9+jeEnzNrqLLM85sDA56PrXuw4TvteuLzJh3IEANV2MNUFdMNcXWdrIQu+ob/ wdyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RaublSEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056a00114700b005755037772fsi24366117pfm.74.2022.12.08.02.10.11; Thu, 08 Dec 2022 02:10:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RaublSEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbiLHJq5 (ORCPT + 73 others); Thu, 8 Dec 2022 04:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbiLHJqe (ORCPT ); Thu, 8 Dec 2022 04:46:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481756E57B; Thu, 8 Dec 2022 01:46:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06FA5B82304; Thu, 8 Dec 2022 09:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49650C433D6; Thu, 8 Dec 2022 09:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670492790; bh=dpBeJVLLnt/wb7IR1Gd04VZ2UovV0cnf+pFYvVnTkNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RaublSEi40KBKPk2OWsAjhjg4ekec+LxdJ+pqFwjmSC3bBAuRQA4IjFuEjWzjDCCK pjqQUIXjhphrgtZKoT+KSCgFIop8EKdQJqlZi4akY7Y2W/GhVX2EYu1iV/rWbuCFuK nqR9fMgIrVyn34c3R5sYkMe4Nb2Z/5YJTVmhrOUXuZqSR/XwpXx5JDO3G/LNKov2e9 4SP9aFKp8l96zdcb5cYZdFQOBE0/IbLCss9So4ZsVt4EPTibKG8cmQzxNmgdXg549X d1N0HNr/yFzJgD8zVhSUByJoLHTaEu/iB2hzKMLy0TF3Pwd9jJ5b7GV+X8nCiSN9P6 6ubn8NQOulBFQ== Date: Thu, 8 Dec 2022 09:46:26 +0000 From: Jarkko Sakkinen To: Kristen Carlson Accardi Cc: dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , zhiquan1.li@intel.com, Sean Christopherson Subject: Re: [PATCH v2 12/18] x86/sgx: Expose sgx_reclaim_pages() for use by EPC cgroup Message-ID: References: <20221202183655.3767674-1-kristen@linux.intel.com> <20221202183655.3767674-13-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202183655.3767674-13-kristen@linux.intel.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 02, 2022 at 10:36:48AM -0800, Kristen Carlson Accardi wrote: > From: Sean Christopherson > > Expose the top-level reclaim function as sgx_reclaim_epc_pages() for use > by the upcoming EPC cgroup, which will initiate reclaim to enforce > changes to high/max limits. > > Signed-off-by: Sean Christopherson > Signed-off-by: Kristen Carlson Accardi > Cc: Sean Christopherson > --- > arch/x86/kernel/cpu/sgx/main.c | 7 ++++--- > arch/x86/kernel/cpu/sgx/sgx.h | 1 + > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c > index 96399e2016a8..c947b4ae06f3 100644 > --- a/arch/x86/kernel/cpu/sgx/main.c > +++ b/arch/x86/kernel/cpu/sgx/main.c > @@ -281,6 +281,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page, > > /** > * sgx_reclaim_pages() - Reclaim EPC pages from the consumers > + * sgx_reclaim_epc_pages() - Reclaim EPC pages from the consumers > * @nr_to_scan: Number of EPC pages to scan for reclaim > * @ignore_age: Reclaim a page even if it is young > * > @@ -385,7 +386,7 @@ static int __sgx_reclaim_pages(int nr_to_scan, bool ignore_age) > return i; > } > > -static int sgx_reclaim_pages(int nr_to_scan, bool ignore_age) > +int sgx_reclaim_epc_pages(int nr_to_scan, bool ignore_age) > { > int ret; > > @@ -441,7 +442,7 @@ static int ksgxd(void *p) > sgx_should_reclaim(SGX_NR_HIGH_PAGES)); > > if (sgx_should_reclaim(SGX_NR_HIGH_PAGES)) > - sgx_reclaim_pages(SGX_NR_TO_SCAN, false); > + sgx_reclaim_epc_pages(SGX_NR_TO_SCAN, false); > } > > return 0; > @@ -624,7 +625,7 @@ struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim) > break; > } > > - sgx_reclaim_pages(SGX_NR_TO_SCAN, false); > + sgx_reclaim_epc_pages(SGX_NR_TO_SCAN, false); > } > > if (sgx_should_reclaim(SGX_NR_LOW_PAGES)) > diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h > index ec8d567cd975..ce859331ddf5 100644 > --- a/arch/x86/kernel/cpu/sgx/sgx.h > +++ b/arch/x86/kernel/cpu/sgx/sgx.h > @@ -206,6 +206,7 @@ void sgx_reclaim_direct(void); > void sgx_record_epc_page(struct sgx_epc_page *page, unsigned long flags); > int sgx_drop_epc_page(struct sgx_epc_page *page); > struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim); > +int sgx_reclaim_epc_pages(int nr_to_scan, bool ignore_age); > > void sgx_ipi_cb(void *info); > > -- > 2.38.1 > Unless, there is a risk of name collision, I think this rename is just adding unnecessary convolution to the patch set. I would revert the rename part, and just export. BR, Jarkko