Re: [PATCH v2] RFC: clear 1G pages with streaming stores on x86
From: Cannon Matthews
Date: Mon Jul 30 2018 - 20:28:53 EST
Thanks for all the feedback from everyone.
I am going to try to fix this up, and do some more robust benchmarking,
including the 2MB case, and try to have an updated/non-RFC patch(es) in
a few days.
Thanks!
Cannon
On Mon, Jul 30, 2018 at 9:29 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Tue, Jul 24, 2018 at 07:37:28PM -0700, Cannon Matthews wrote:
> > diff --git a/arch/x86/lib/clear_page_64.S b/arch/x86/lib/clear_page_64.S
> > index 88acd349911b..81a39804ac72 100644
> > --- a/arch/x86/lib/clear_page_64.S
> > +++ b/arch/x86/lib/clear_page_64.S
> > @@ -49,3 +49,23 @@ ENTRY(clear_page_erms)
> > ret
> > ENDPROC(clear_page_erms)
> > EXPORT_SYMBOL_GPL(clear_page_erms)
> > +
> > +/*
> > + * Zero memory using non temporal stores, bypassing the cache.
> > + * Requires an `sfence` (wmb()) afterwards.
> > + * %rdi - destination.
> > + * %rsi - page size. Must be 64 bit aligned.
> > +*/
> > +ENTRY(__clear_page_nt)
> > + leaq (%rdi,%rsi), %rdx
> > + xorl %eax, %eax
> > + .p2align 4,,10
> > + .p2align 3
> > +.L2:
> > + movnti %rax, (%rdi)
> > + addq $8, %rdi
> > + cmpq %rdx, %rdi
> > + jne .L2
> > + ret
> > +ENDPROC(__clear_page_nt)
> > +EXPORT_SYMBOL(__clear_page_nt)
>
> EXPORT_SYMBOL_GPL like the other functions in that file.
>
> --
> Regards/Gruss,
> Boris.
>
> ECO tip #101: Trim your mails when you reply.
> --