Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-02-01 Thread Andrew Cooper
On 01/02/2021 05:58, Nadav Amit wrote: >> On Jan 31, 2021, at 4:10 AM, Andrew Cooper wrote: >> >> On 31/01/2021 01:07, Andy Lutomirski wrote: >>> Adding Andrew Cooper, who has a distressingly extensive understanding >>> of the x86 PTE magic. >> Pretty sure it is all learning things the hard

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-31 Thread Nadav Amit
> On Jan 31, 2021, at 4:10 AM, Andrew Cooper wrote: > > On 31/01/2021 01:07, Andy Lutomirski wrote: >> Adding Andrew Cooper, who has a distressingly extensive understanding >> of the x86 PTE magic. > > Pretty sure it is all learning things the hard way... > >> On Sat, Jan 30, 2021 at 4:16 PM

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-31 Thread Andrew Cooper
On 31/01/2021 01:07, Andy Lutomirski wrote: > Adding Andrew Cooper, who has a distressingly extensive understanding > of the x86 PTE magic. Pretty sure it is all learning things the hard way... > On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: >> diff --git a/mm/mprotect.c b/mm/mprotect.c >>

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-31 Thread Andrew Cooper
On 31/01/2021 02:59, Andy Lutomirski wrote: diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 8c87a2e0b660..a617dc0a9b06 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -255,6 +255,50 @@ static

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-30 Thread Andy Lutomirski
On Sat, Jan 30, 2021 at 5:17 PM Nadav Amit wrote: > > > On Jan 30, 2021, at 5:07 PM, Andy Lutomirski wrote: > > > > Adding Andrew Cooper, who has a distressingly extensive understanding > > of the x86 PTE magic. > > > > On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: > >> From: Nadav Amit >

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-30 Thread Nadav Amit
> On Jan 30, 2021, at 5:07 PM, Andy Lutomirski wrote: > > Adding Andrew Cooper, who has a distressingly extensive understanding > of the x86 PTE magic. > > On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: >> From: Nadav Amit >> >> Currently, using mprotect() to unprotect a memory region or

Re: [RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-30 Thread Andy Lutomirski
Adding Andrew Cooper, who has a distressingly extensive understanding of the x86 PTE magic. On Sat, Jan 30, 2021 at 4:16 PM Nadav Amit wrote: > > From: Nadav Amit > > Currently, using mprotect() to unprotect a memory region or uffd to > unprotect a memory region causes a TLB flush. At least on

[RFC 03/20] mm/mprotect: do not flush on permission promotion

2021-01-30 Thread Nadav Amit
From: Nadav Amit Currently, using mprotect() to unprotect a memory region or uffd to unprotect a memory region causes a TLB flush. At least on x86, as protection is promoted, no TLB flush is needed. Add an arch-specific pte_may_need_flush() which tells whether a TLB flush is needed based on the