Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1423470rwb; Thu, 8 Dec 2022 10:24:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6EI5D8jYjgAIHjSkWO15wk2feGWhc8UPv4bq6ojjgPIInGuIPUwF50JDGmT/whovaICPBI X-Received: by 2002:aa7:d314:0:b0:46c:fc3f:cf8a with SMTP id p20-20020aa7d314000000b0046cfc3fcf8amr10819083edq.386.1670523891569; Thu, 08 Dec 2022 10:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670523891; cv=none; d=google.com; s=arc-20160816; b=hxNl7yyuDjvYoh4MAruFbPOuH5SrKvxMkQ6LpB3V7vPpaUPx/xEOLCUi4smbY5F+gk xRNQJfD1KeeOd3JGWuvuqeYWmkoHLAGSJt70tt6C7y8YWlBsv4Puz1QdInzNVhS9gqlr abdhI0MoD6ZAuHyVK1ZsO9BWADSIKyjHPIZ743SwROWZhQ1Ldoq/hoqN7vBShmWZQESp 4KvO75glvkEPt8jTRYQc/Wap//d2zyp65GEkIGqyxieBPIROqFH08VTX4xKCKWCPfCPb cHUns+g7cCqixtg5kIau0Cnk6H44Zi19ryKsWNOL180eejsolpICEnu1fno2rUvQGXxX 74oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=a5QVaJCW+1KfH+RIxcXb6CC8DOjg9E8IGIEr6DurHN4=; b=b/Scr4WD/5kdEBaOCu4E1LGhKCwYgvmAW905Ns2gkjHaORZJkSciEtezaJ7N/khriW 7C5FRpUrXCqLRzFL5V+K//7Q55elkV0ol7T0r0P9oPXag8cPyQhKiEk/h8wEnEmwjv9U 8Uu7BlNU1jB3W8e5B/Gtu7TF242OxqHe0Q/kEhnCc6nfdpyQfmzG4/SEwWfp57uMz2oQ q5G4jTn/IR1AtFtMtMOyzqduPbcldlEvPrChl9UvmBOYTkUKXB/tgPawtXF4o58fR/rU 8L2r6wYBOF8tTGtpODh2liq8/jOZ+11O/kXdyUhO1vECS5JyO8IinoOpoL+piXWwtedq 5VPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GZuGOMlk; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb20-20020a1709076d9400b0077b45792af2si8138062ejc.464.2022.12.08.10.24.34; Thu, 08 Dec 2022 10:24:51 -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=@intel.com header.s=Intel header.b=GZuGOMlk; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiLHSDq (ORCPT + 72 others); Thu, 8 Dec 2022 13:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229969AbiLHSDa (ORCPT ); Thu, 8 Dec 2022 13:03:30 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3B72AD33C; Thu, 8 Dec 2022 10:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670522609; x=1702058609; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=a5QVaJCW+1KfH+RIxcXb6CC8DOjg9E8IGIEr6DurHN4=; b=GZuGOMlkP+zF9wHo7SHVTokw/nl48YpRT0CYYAXRoIrdfryA9SkNIcX6 kpiwtN+tR82YC6fGzonfqI081wmtM2D4i6lIxKyxi7eh79gH1Pw7Uqdwm dp96rdTbLgAxN18Dx3xYpD29uc5C2sH03I8lLNAfD2tp4e0jNfH851NXk BA2Ls5d8Nu5DMSeybuvpKFfWlVPnp56giV1T17hFcoGN5XE4SZsjnCBcP gWPEA1kqBrjwJnAuMMjwRog7UHvimecZBHcK7/7Qs16QYWi9d0l31bCgQ imqijagBcvfKFLmeaiBGQudyLz44uZNd+EUasJdv0nKe0cqxlizaDiiT0 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="319116038" X-IronPort-AV: E=Sophos;i="5.96,227,1665471600"; d="scan'208";a="319116038" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 10:03:06 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="640720980" X-IronPort-AV: E=Sophos;i="5.96,227,1665471600"; d="scan'208";a="640720980" Received: from nmanikan-mobl1.amr.corp.intel.com (HELO [10.251.3.168]) ([10.251.3.168]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 10:03:05 -0800 Message-ID: <08a420401b2fb539f37cbf21a0ded6bf8c68c72b.camel@linux.intel.com> Subject: Re: [PATCH v2 03/18] x86/sgx: Add 'struct sgx_epc_lru_lists' to encapsulate lru list(s) From: Kristen Carlson Accardi To: Jarkko Sakkinen 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 Date: Thu, 08 Dec 2022 10:03:04 -0800 In-Reply-To: References: <20221202183655.3767674-1-kristen@linux.intel.com> <20221202183655.3767674-4-kristen@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Thu, 2022-12-08 at 15:31 +0000, Jarkko Sakkinen wrote: > On Fri, Dec 02, 2022 at 10:36:39AM -0800, Kristen Carlson Accardi > wrote: > > Introduce a data structure to wrap the existing reclaimable list > > and its spinlock in a struct to minimize the code changes needed > > to handle multiple LRUs as well as reclaimable and non-reclaimable > > lists, both of which will be introduced and used by SGX EPC > > cgroups. > >=20 > > Signed-off-by: Sean Christopherson > > > > Signed-off-by: Kristen Carlson Accardi > > Cc: Sean Christopherson > > --- > > =C2=A0arch/x86/kernel/cpu/sgx/sgx.h | 65 > > +++++++++++++++++++++++++++++++++++ > > =C2=A01 file changed, 65 insertions(+) > >=20 > > diff --git a/arch/x86/kernel/cpu/sgx/sgx.h > > b/arch/x86/kernel/cpu/sgx/sgx.h > > index 39cb15a8abcb..5e6d88438fae 100644 > > --- a/arch/x86/kernel/cpu/sgx/sgx.h > > +++ b/arch/x86/kernel/cpu/sgx/sgx.h > > @@ -90,6 +90,71 @@ static inline void *sgx_get_epc_virt_addr(struct > > sgx_epc_page *page) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return section->virt_ad= dr + index * PAGE_SIZE; > > =C2=A0} > > =C2=A0 > > +/* > > + * This data structure wraps a list of reclaimable EPC pages, and > > a list of > > + * non-reclaimable EPC pages and is used to implement a LRU policy > > during > > + * reclamation. > > + */ > > +struct sgx_epc_lru_lists { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0spinlock_t lock; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct list_head reclaimable= ; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct list_head unreclaimab= le; > > +}; > =C2=A0 > Why this is named like this, and not sgx_epc_global_rcu? Are there > any other use cases? >=20 > BR, Jarkko Yes, there are other use cases that are introduced in the other patches. This structure is used to in the cgroup struct to hold cgroup specific LRUs.