]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Fix the pte_hw_dirty() check when AF/DBM is enabled
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 11 Sep 2015 17:22:00 +0000 (18:22 +0100)
committerWill Deacon <will.deacon@arm.com>
Mon, 14 Sep 2015 11:28:31 +0000 (12:28 +0100)
commitc839b84af1f9c983a0a077fb7552762b6b44a353
tree2a1d016f5eaae2b9d00fa1d5d2e06a64b73e105c
parentba3331b8be1907564a223c27145727e0d1d71482
arm64: Fix the pte_hw_dirty() check when AF/DBM is enabled

Commit c8c9afd8f09e ("arm64: Add support for hardware updates of the
access and dirty pte bits") introduced support for handling hardware
updates of the access flag and dirty status. The PTE is automatically
dirtied in hardware (if supported) by clearing the PTE_RDONLY bit when
the PTE_DBM/PTE_WRITE bit is set. The pte_hw_dirty() macro was added to
detect a hardware dirtied pte. The pte_dirty() macro checks for both
software PTE_DIRTY and pte_hw_dirty().

Functions like pte_modify() clear the PTE_RDONLY bit since it is meant
to be set in set_pte_at() when written to memory. In such cases,
pte_hw_dirty() would return true even though such pte is clean. This
patch changes pte_hw_dirty() to test the PTE_DBM/PTE_WRITE bit together
with PTE_RDONLY.

Fixes: c8c9afd8f09e ("arm64: Add support for hardware updates of the access and dirty pte bits")
Reported-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/pgtable.h