2022-09-06 03:36:55

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH RFC] x86/sgx: Use a heap allocated list head for unsanitized pages

On 9/5/22 20:12, Jarkko Sakkinen wrote:
> Allocate the list head for the unsanitized pages from heap, and transfer
> its to ownership to ksgxd, which takes care of destroying it. Remove
> sgx_dirty_page_list, as a global list is no longer required.
>
> Signed-off-by: Jarkko Sakkinen <[email protected]>
> ---
> Depends on https://lore.kernel.org/linux-sgx/[email protected]/T/#t
> Would this be plausible?
> ---
> arch/x86/kernel/cpu/sgx/main.c | 44 ++++++++++++++++++++++++----------
> 1 file changed, 31 insertions(+), 13 deletions(-)

What's the benefit? I guess it saves 16 bytes of kernel image for ~20
lines of code. Does it add more than 16 bytes to kernel text? ;)


2022-09-06 04:49:51

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH RFC] x86/sgx: Use a heap allocated list head for unsanitized pages

On Mon, Sep 05, 2022 at 08:20:18PM -0700, Dave Hansen wrote:
> On 9/5/22 20:12, Jarkko Sakkinen wrote:
> > Allocate the list head for the unsanitized pages from heap, and transfer
> > its to ownership to ksgxd, which takes care of destroying it. Remove
> > sgx_dirty_page_list, as a global list is no longer required.
> >
> > Signed-off-by: Jarkko Sakkinen <[email protected]>
> > ---
> > Depends on https://lore.kernel.org/linux-sgx/[email protected]/T/#t
> > Would this be plausible?
> > ---
> > arch/x86/kernel/cpu/sgx/main.c | 44 ++++++++++++++++++++++++----------
> > 1 file changed, 31 insertions(+), 13 deletions(-)
>
> What's the benefit? I guess it saves 16 bytes of kernel image for ~20
> lines of code. Does it add more than 16 bytes to kernel text? ;)

That's why I asked, and added RFC. It was so small step that I thought to
try it out.

I agree that it does not save memory for any significant amount but it
does take a bit way from driver global data, which is IMHO most of the
time +1 (simplifies state). Not saying that enough to pick this but
perhaps it will find its place as part of a patch set. By itself it
does not stand, I agree.

BR, Jarkko