Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-16 Thread Borislav Petkov
On Thu, Oct 15, 2020 at 02:20:36PM -0700, Ankur Arora wrote: > The case I was thinking of was that clear_huge_page() That loop in clear_gigantic_page() there could be optimized not to iterate over the pages but do a NTA moves in one go, provided they're contiguous. > or faultin_page() would

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-15 Thread Ankur Arora
On 2020-10-15 3:40 a.m., Borislav Petkov wrote: On Wed, Oct 14, 2020 at 08:21:57PM -0700, Ankur Arora wrote: Also, if we did extend clear_page() to take the page-size as parameter we still might not have enough information (ex. a 4K or a 2MB page that clear_page() sees could be part of a GUP of

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-15 Thread Ankur Arora
On 2020-10-15 3:35 a.m., Borislav Petkov wrote: On Wed, Oct 14, 2020 at 08:37:44PM -0700, Ankur Arora wrote: I don't disagree but I think the selection of cached/uncached route should be made where we have enough context available to be able to choose to do this. This could be for example,

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-15 Thread Borislav Petkov
On Wed, Oct 14, 2020 at 08:21:57PM -0700, Ankur Arora wrote: > Also, if we did extend clear_page() to take the page-size as parameter > we still might not have enough information (ex. a 4K or a 2MB page that > clear_page() sees could be part of a GUP of a much larger extent) to > decide whether to

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-15 Thread Borislav Petkov
On Wed, Oct 14, 2020 at 08:37:44PM -0700, Ankur Arora wrote: > I don't disagree but I think the selection of cached/uncached route should > be made where we have enough context available to be able to choose to do > this. > > This could be for example, done in mm_populate() or gup where if say the

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Ankur Arora
On 2020-10-14 2:12 p.m., Borislav Petkov wrote: On Wed, Oct 14, 2020 at 02:07:30PM -0700, Andy Lutomirski wrote: I assume it’s for a little optimization of clearing more than one page per SFENCE. In any event, based on the benchmark data upthread, we only want to do NT clears when they’re

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Ankur Arora
On 2020-10-14 2:07 p.m., Andy Lutomirski wrote: On Oct 14, 2020, at 12:58 PM, Borislav Petkov wrote: On Wed, Oct 14, 2020 at 08:45:37AM -0700, Andy Lutomirski wrote: On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora wrote: Define clear_page_uncached() as an alternative_call() to

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Andy Lutomirski
> On Oct 14, 2020, at 12:58 PM, Borislav Petkov wrote: > > On Wed, Oct 14, 2020 at 08:45:37AM -0700, Andy Lutomirski wrote: >>> On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora >>> wrote: >>> >>> Define clear_page_uncached() as an alternative_call() to clear_page_nt() >>> if the CPU sets

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Borislav Petkov
On Wed, Oct 14, 2020 at 02:07:30PM -0700, Andy Lutomirski wrote: > I assume it’s for a little optimization of clearing more than one > page per SFENCE. > > In any event, based on the benchmark data upthread, we only want to do > NT clears when they’re rather large, so this shouldn’t be just an >

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Ankur Arora
On 2020-10-14 8:45 a.m., Andy Lutomirski wrote: On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora wrote: Define clear_page_uncached() as an alternative_call() to clear_page_nt() if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it doesn't. Similarly define

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Borislav Petkov
On Wed, Oct 14, 2020 at 08:45:37AM -0700, Andy Lutomirski wrote: > On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora wrote: > > > > Define clear_page_uncached() as an alternative_call() to clear_page_nt() > > if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it > > doesn't. > > > >

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Andy Lutomirski
On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora wrote: > > Define clear_page_uncached() as an alternative_call() to clear_page_nt() > if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it > doesn't. > > Similarly define clear_page_uncached_flush() which provides an SFENCE > if the

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread kernel test robot
Hi Ankur, Thank you for the patch! Yet something to improve: [auto build test ERROR on tip/master] [also build test ERROR on linus/master next-20201013] [cannot apply to tip/x86/core linux/master v5.9] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting

Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread kernel test robot
Hi Ankur, Thank you for the patch! Yet something to improve: [auto build test ERROR on tip/master] [also build test ERROR on linus/master next-20201013] [cannot apply to tip/x86/core linux/master v5.9] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting

[PATCH 5/8] x86/clear_page: add clear_page_uncached()

2020-10-14 Thread Ankur Arora
Define clear_page_uncached() as an alternative_call() to clear_page_nt() if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it doesn't. Similarly define clear_page_uncached_flush() which provides an SFENCE if the CPU sets X86_FEATURE_NT_GOOD. Also, add the glue interface