Message ID | 20190715110212.18617-3-joro@8bytes.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Sync unmappings in vmalloc/ioremap areas | expand |
On Mon, 15 Jul 2019, Joerg Roedel wrote: > From: Joerg Roedel <jroedel@suse.de> > > With huge-page ioremap areas the unmappings also need to be > synced between all page-tables. Otherwise it can cause data > corruption when a region is unmapped and later re-used. > > Make the vmalloc_sync_one() function ready to sync > unmappings. > > Signed-off-by: Joerg Roedel <jroedel@suse.de> Lacks a Fixes tag methinks. > --- > arch/x86/mm/fault.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > index 4a4049f6d458..d71e167662c3 100644 > --- a/arch/x86/mm/fault.c > +++ b/arch/x86/mm/fault.c > @@ -194,11 +194,12 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) > > pmd = pmd_offset(pud, address); > pmd_k = pmd_offset(pud_k, address); > - if (!pmd_present(*pmd_k)) > - return NULL; > > - if (!pmd_present(*pmd)) > + if (pmd_present(*pmd) ^ pmd_present(*pmd_k)) > set_pmd(pmd, *pmd_k); It took me a while to understand what this is doing. Can we please have a comment here? > + > + if (!pmd_present(*pmd_k)) > + return NULL; Thanks, tglx
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 4a4049f6d458..d71e167662c3 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -194,11 +194,12 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) pmd = pmd_offset(pud, address); pmd_k = pmd_offset(pud_k, address); - if (!pmd_present(*pmd_k)) - return NULL; - if (!pmd_present(*pmd)) + if (pmd_present(*pmd) ^ pmd_present(*pmd_k)) set_pmd(pmd, *pmd_k); + + if (!pmd_present(*pmd_k)) + return NULL; else BUG_ON(pmd_pfn(*pmd) != pmd_pfn(*pmd_k));