Re: [PATCH] mm: Track page table modifications in __apply_to_page_range() construction

Chris Wilson
2020-08-21T10:14:05Z

Quoting Joerg Roedel (2020-08-21 11:09:02)
> @@ -2333,6 +2339,7 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
> pgd_t *pgd;
> unsigned long next;
> unsigned long end = addr + size;
> + pgtbl_mod_mask mask = 0;
> int err = 0;
>
> if (WARN_ON(addr >= end))
> @@ -2343,11 +2350,14 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
> next = pgd_addr_end(addr, end);
> if (!create && pgd_none_or_clear_bad(pgd))
> continue;
> - err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create);
> + err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask);
> if (err)
> break;
> } while (pgd++, addr = next, addr != end);
>
> + if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
> + arch_sync_kernel_mappings(addr, addr + size);

We need to store the initial addr, as here addr == end [or earlier on
earlier], so range is (start, addr).
-Chris