panic: pmap_page_protect: illegal for unmanaged page

Matthew Dillon dillon at
Thu Jan 10 21:42:24 PST 2008

:I think I found a bug somewhere in the code chain of msync(..., MS_INVALIDATE), if refering to mmap()ed device memory.
:device memory has pages of type PG_FICTITIOUS, but pmap_remove_all() complains:
:#if defined(PMAP_DIAGNOSTIC)
:        /*      
:         * XXX this makes pmap_page_protect(NONE) illegal for non-managed
:         * pages!
:         */
:        if (!pmap_initialized || (m->flags & PG_FICTITIOUS)) {
:                panic("pmap_page_protect: illegal for unmanaged page, va: 0x%08llx", (long long)VM_PAGE_TO_PHYS(m));
:        }
:I guess the XXX is correct and we need to either a) avoid calling pmap_remove_all() or b) return without error.
:  simon

    The comment itself is correct in that fictitious pages are not managed
    by PV lists, so its impossible for pmap_remove_all() to function on
    a fictitiuos page.  pmap_remove_all() is typically called to remove
    user mappings of pages undergoing write I/O to prevent the pages from
    being modified by userland while the I/O is in progress.

    If there is a code path calling that function on fictitious pages we
    have to examine and fix it (and the 'fix' might be as you suggest, just
    ignoring it for such pages).  I don't think its possible to put fictitious
    pages under PV management due to the physical-to-virtual translations
    that might be needed in that codepath... device pages tend to be at
    physical addresses that just don't work with the way the translation code
    was written.

    madvise() or file I/O with such mapped pages specified as the address
    might cause it to hit the code path.


More information about the Bugs mailing list