Messages in this thread | | | Date | Tue, 18 Sep 2018 09:14:10 +0200 | From | Peter Zijlstra <> | Subject | Re: [patch V3 08/11] x86/mm/cpa: Add sanity check for existing mappings |
| |
On Mon, Sep 17, 2018 at 04:29:14PM +0200, Thomas Gleixner wrote: > +static void split_set_pte(struct cpa_data *cpa, pte_t *pte, unsigned long pfn, > + pgprot_t ref_prot, unsigned long address, > + unsigned long size) > +{ > + unsigned int npg = PFN_DOWN(size); > + pgprot_t prot; > + > + /* > + * If try_preserve_large_page() discovered an inconsistent mapping,
You just renamed that thing.. :-)
> + * remove the invalid protection in the split mapping. > + */ > + if (!cpa->force_static_prot) > + goto set; > + > + prot = static_protections(ref_prot, address, pfn, npg, CPA_PROTECT); > + > + if (pgprot_val(prot) == pgprot_val(ref_prot)) > + goto set; > + > + /* > + * If this is splitting a PMD, fix it up. PUD splits cannot be > + * fixed trivially as that would require to rescan the newly > + * installed PMD mappings after returning from split_large_page() > + * so an eventual further split can allocate the necessary PTE > + * pages. Warn for now and revisit it in case this actually > + * happens. > + */ > + if (size == PAGE_SIZE) > + ref_prot = prot; > + else > + pr_warn_once("CPA: Cannot fixup static protections for PUD split\n"); > +set: > + set_pte(pte, pfn_pte(pfn, ref_prot)); > +}
| |