linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	linux-sgx@vger.kernel.org, kai.svahn@intel.com,
	bruce.schlobohm@intel.com
Subject: Re: [PATCH RFC] x86/sgx: Allocate form local NUMA node first
Date: Wed, 24 Jun 2020 16:54:07 -0700	[thread overview]
Message-ID: <20200624235406.GH25092@linux.intel.com> (raw)
In-Reply-To: <57c83d3d-54ab-fc07-cefc-c3ebe478a8e9@intel.com>

On Wed, Jun 24, 2020 at 04:24:25PM -0700, Dave Hansen wrote:
> On 6/22/20 9:39 PM, Jarkko Sakkinen wrote:
> > +static int __init sgx_pfn_to_nid(unsigned long pfn)
> > +{
> > +	pg_data_t *pgdat;
> > +	int nid;
> > +
> > +	for (nid = 0; nid < nr_node_ids; nid++) {
> > +		pgdat = NODE_DATA(nid);
> > +
> > +		if (pfn >= pgdat->node_start_pfn &&
> > +		    pfn < (pgdat->node_start_pfn + pgdat->node_spanned_pages))
> 
> pgdat_end_pfn(), perhaps?
> 
> > +			return nid;
> > +	}
> > +
> > +	return 0;
> > +}
> 
> Does this actually work?
> 
> The node span (->node_start_pfn through start+->node_spanned_pages) only
> contains pages which the OS is actively managing, usually RAM but
> sometimes also persistent memory.  This has some assumption that the SGX
> PFNs are within the node's span.  I would only _expect_ that to happen
> if the node was built like this:
> 
> 	| Node-X RAM | EPC | Node-X RAM |
> 
> If the EPC was on either end:
> 
> 	| Node-X RAM | EPC |
> or
> 	| EPC | Node-X RAM |
> 
> I suspect that the pgdat span wouldn't include EPC.  EPC is, if I
> remember correctly, a E820_RESERVED region.

It is indeed E820_RESERVED, but the BIOS WG for ICX states that EPC regions
should be enumerated in ACPI SRAT along with regular memory.

But, I haven't actually verified that info makes its way into the kernel's
pgdata stuff.

  reply	other threads:[~2020-06-24 23:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  4:39 [PATCH RFC] x86/sgx: Allocate form local NUMA node first Jarkko Sakkinen
2020-06-24 23:12 ` Jarkko Sakkinen
2020-06-24 23:24 ` Dave Hansen
2020-06-24 23:54   ` Sean Christopherson [this message]
2020-06-25  0:25     ` Dave Hansen
2020-06-25  0:57       ` Sean Christopherson
2020-06-25  2:57         ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200624235406.GH25092@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=bruce.schlobohm@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=kai.svahn@intel.com \
    --cc=linux-sgx@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).