Changeset View
Standalone View
sys/i386/i386/pmap.c
Context not available. | |||||
if ((origpte & PG_A) != 0) | if ((origpte & PG_A) != 0) | ||||
pmap_invalidate_page_int(pmap, va); | pmap_invalidate_page_int(pmap, va); | ||||
} else | } else | ||||
pte_store(pte, newpte); | pte_store_z(pte, newpte); | ||||
unchanged: | unchanged: | ||||
Context not available. | |||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec) | if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec) | ||||
newpte |= pg_nx; | newpte |= pg_nx; | ||||
#endif | #endif | ||||
if (pmap != kernel_pmap) | if (pmap != kernel_pmap) { | ||||
newpte |= PG_U; | newpte |= PG_U; | ||||
pte_store(pte, newpte); | pte_store_z(pte, newpte); | ||||
markj: Hmm, I think you can unconditionally use pte_store_z() here since the old entry is known to be… | |||||
kibAuthorUnsubmitted Done Inline ActionsBut then it returns the question of random pmap_kextract() seeing torn write. kib: But then it returns the question of random pmap_kextract() seeing torn write.
(I think that it… | |||||
markjUnsubmitted Not Done Inline ActionsDon't you still have this problem in the pmap_enter() change then? I suspect it is a bug to call pmap_kextract() on an unmapped address, and this reasoning can be used to justify the use of pte_store_z() on invalid entries, even in the kernel pmap. I believe the issue is only with stores that modify a valid PTE or PDE in the kernel pmap. markj: Don't you still have this problem in the pmap_enter() change then?
I suspect it is a bug to… | |||||
kibAuthorUnsubmitted Done Inline ActionsI would have the answer to this question if Peter can reproduce the torn write issue with the patch. It is not even clear to me if e.g. pmap_kenter() or pmap_qenter() can use pte_store_zero(). kib: I would have the answer to this question if Peter can reproduce the torn write issue with the… | |||||
markjUnsubmitted Not Done Inline ActionsDo either of those routines get used often on i386? markj: Do either of those routines get used often on i386? | |||||
kibAuthorUnsubmitted Done Inline Actionspmap_qenter() absolutely, it is used when buffer needs to be mapped, which is always for a buffer with metadata. pmap_kenter() not so much, AFAIR. kib: pmap_qenter() absolutely, it is used when buffer needs to be mapped, which is always for a… | |||||
} else { | |||||
pte_store(pte, newpte); | |||||
} | |||||
sched_unpin(); | sched_unpin(); | ||||
return (mpte); | return (mpte); | ||||
} | } | ||||
Context not available. |
Hmm, I think you can unconditionally use pte_store_z() here since the old entry is known to be invalid.