Re: [PATCH 00 of 10] x86: unify asm/pgtable.h

Jan Beulich
2008-01-09T09:37:55Z

>The "problem" is a BUG() in pageattr_64.c:change_page_attr(), which to
>me looks spurious. It arises because __PAGE_KERNEL_* doesn't contain
>_PAGE_GLOBAL, but PAGE_KERNEL_* does. When ioremap()
>change_page_attr(), it does so in a way that guarentees that the test
>
> if (pgprot_val(prot) != pgprot_val(ref_prot)) {
>
>in __change_page_attr() always succeeds. When I folded _PAGE_GLOBAL
>into the __PAGE_KERNEL_* definitions, it mostly works except it causes
>this if() to fail, falling into the otherwise dead else clause and
>triggers a BUG().

Indeed, and my patch version for fixing the ref-counting problem does
away with that (I don't recall whether Andi's version did, too):

if (!pgprot_match(prot, ref_prot)) {
if (!pte_huge(*kpte)) {
set_pte(kpte, pfn_pte(pfn, prot));
} else {
BUG_ON(!pgprot_match(old_prot, ref_prot));
kpte_page = split_large_page(address, prot, ref_prot);
if (!kpte_page)
return -ENOMEM;
set_pte(kpte, mk_pte(kpte_page, PAGE_KERNEL_EXEC));
}
if (pgprot_match(old_prot, ref_prot))
page_private(kpte_page)++;
} else if (!pgprot_match(ref_prot, old_prot)) {
BUG_ON(pte_huge(*kpte));
set_pte(kpte, pfn_pte(pfn, ref_prot));
BUG_ON(page_private(kpte_page) == 0);
page_private(kpte_page)--;
} else
return 0;

Jan