Messages in this thread | | | Date | Wed, 27 May 2020 22:35:09 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH v30 07/20] x86/sgx: Enumerate and track EPC sections |
| |
On Tue, May 26, 2020 at 08:56:14PM -0700, Sean Christopherson wrote: > > > + if (i == ARRAY_SIZE(sgx_epc_sections)) { > > > + pr_warn("No free slot for an EPC section\n"); > > > + break; > > > + } > > > > This is also the loop termination: do we really need this warn or can > > the loop simply do "i < ARRAY_SIZE" ? > > The warn alerts the user that there will effectively be lost/unused memory, > so IMO it's worth keeping.
Can the user do anything about it? If not, then probably no need to say anything.
> > > + pr_info("EPC section 0x%llx-0x%llx\n", pa, pa + size - 1); > > > > I'm assuming that's useful information to issue in dmesg? > > Yes, it's effectively the equivalent of dumping the e820 tables. It might > not be as useful now that the code is stable, but I suspect it will come in > handy for debug/triage down the road.
Ok.
> > Same for this one: also shared only among sgx code? > > Yes, that one can definitely be buried behind a helper.
Shared only within sgx is fine.
<snip>
> One idea would be to provide a Kconfig a la NR_CPUS or NODES_SHIFT. I.e. > carve out the bits in sgx_epc_page_desc to allow up to N sections, but let > the user limit the number of sections to recoup the unused memory.
I'd prefer a good estimate of a highest value, say 8 bits, which should suffice for the foreseeable future. That's the simplest thing to do and our Kconfig symbols space is an abomination of gazillion symbols.
Thx.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |