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

Andi Kleen
2008-01-09T01:11:29Z

> Is _PAGE_GLOBAL causing the first if() to fall through to the second

Yes it obviously is.

> clause? Because otherwise it shouldn't have any effect on the pte_huge()
> test.

>
> Gah! This can't be right! I think the original change_page_attr() code is
> plain buggy.

It has a few rough edges. I was fixing various issues in the c_p_a() patch
series I posted recently.

The code bugs when you set the same area to the same protection several
times. That likely happens here.

The cpa series adds a helpful comment explaining this.

/*
* When you're here you either set the same page to PAGE_KERNEL
* two times in a row or the page table reference counting is
* broken again. To catch the later bug for now (sorry)
*/
printk(KERN_ERR "address %lx\n", address);
dump_pagetable(address);
BUG();

I've been considering taking it out, but is there ever a good reason
to do that? I left it in because it catches bugs in c_p_a itself.

-Andi