Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

When to initialize pvh_attrs?



I'm getting assertion failures on a VIPT, non-page colored CPU.  A page is
allocated via uvm_pglistalloc() (via bus_dmamem_alloc()), then wired by
pmap_enter() (via bus_dmamem_map()).  Then the following assertion fails,
because no one has initialize PVF_WRITE in pvh_attrs:

   3043 #if defined(PMAP_CACHE_VIPT) && defined(DIAGNOSTIC)
   3044         if (pg) {
   3045                 simple_lock(&pg->mdpage.pvh_slock);
   3046                 KASSERT((pg->mdpage.pvh_attrs & PVF_DMOD) == 0 || \
                            (pg->mdpage.pvh_attrs & (PVF_DIRTY|PVF_NC)));
   3047                 KASSERT(((pg->mdpage.pvh_attrs & PVF_WRITE) == 0) == \
                            (pg->mdpage.urw_mappings + pg->mdpage.krw_mappings 
== 0));

(pvh_attrs & PVF_WRITE == 0, krw_mappings == 1)

This leads to a question: when should pvh_attrs be initialized and how?

Masao

Index: sys/arch/arm/arm32/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm32/pmap.c,v
retrieving revision 1.207
diff -u -r1.207 pmap.c
--- sys/arch/arm/arm32/pmap.c   31 Dec 2009 02:36:14 -0000      1.207
+++ sys/arch/arm/arm32/pmap.c   31 Dec 2009 03:02:49 -0000
@@ -888,7 +888,7 @@
 #endif
        SLIST_NEXT(pv, pv_link) = *pvp;         /* add to ... */
        *pvp = pv;                              /* ... locked list */
-       pg->mdpage.pvh_attrs |= flags & (PVF_REF | PVF_MOD);
+       pg->mdpage.pvh_attrs |= flags & (PVF_REF | PVF_MOD | PVF_WRITE);        
/* XXX what else? */
 #ifdef PMAP_CACHE_VIPT
        if ((pv->pv_flags & PVF_KWRITE) == PVF_KWRITE)
                pg->mdpage.pvh_attrs |= PVF_KMOD;
@@ -1070,8 +1070,8 @@
         * There is at least one VA mapping this page.
         */
 
-       if (clr_mask & (PVF_REF | PVF_MOD)) {
-               pg->mdpage.pvh_attrs |= set_mask & (PVF_REF | PVF_MOD);
+       if (clr_mask & (PVF_REF | PVF_MOD | PVF_WRITE)) {
+               pg->mdpage.pvh_attrs |= set_mask & (PVF_REF | PVF_MOD | 
PVF_WRITE);     /* XXX what else? */
 #ifdef PMAP_CACHE_VIPT
                if ((pg->mdpage.pvh_attrs & (PVF_DMOD|PVF_NC)) != PVF_NC)
                        pg->mdpage.pvh_attrs |= PVF_DIRTY;

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index