Messages in this thread | | | Date | Sun, 16 Jul 2023 08:10:33 -0700 | From | Catalin Marinas <> | Subject | Re: [RFC] arm64: properly define SOFT_DIRTY for arm64 |
| |
(I noticed Mark already replied in another thread along the same lines)
On Tue, Jul 04, 2023 at 06:08:59AM -0400, Nico Pache wrote: > Is it possible to add the same DBM check I'm using > (!arch_has_hw_pte_young) in these pte helper functions to only clear > it when DBM is not present?
It's not possible since we don't have a way to encode a read-only + dirty PTE (e.g. after ptep_set_wrprotect()). The PTE_WRITE/PTE_DBM bit in the architecture only tells that the hardware is allowed to clear the PTE_RDONLY bit on a write access and that's what we consider hw-dirty. When a dirty/writeable PTE is made read-only, we clear PTE_WRITE, set PTE_RDONLY _and_ the software PTE_DIRTY bit.
With the permission indirection extensions (PIE, see patches from Joey), PTE_RDONLY can be treated as a true !PTE_DIRTY bit but there's no hardware around yet.
So if you need software dirty, it can only be done with another software PTE bit. The problem is that we are short of such bits (only one left if we move PTE_PROT_NONE to a different location). The userfaultfd people also want such bit.
Personally I'd reuse the four PBHA bits but I keep hearing that they may be used with some out of tree patches.
-- Catalin
| |