[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201123143149.GG17833@gaia>
Date: Mon, 23 Nov 2020 14:31:49 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: Minchan Kim <minchan@...nel.org>
Cc: Will Deacon <will@...nel.org>, kernel-team@...roid.com,
Yu Zhao <yuzhao@...gle.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
linux-mm@...ck.org, Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/6] arm64: pgtable: Ensure dirty bit is preserved across
pte_wrprotect()
On Fri, Nov 20, 2020 at 09:09:03AM -0800, Minchan Kim wrote:
> On Fri, Nov 20, 2020 at 02:35:53PM +0000, Will Deacon wrote:
> > With hardware dirty bit management, calling pte_wrprotect() on a writable,
> > dirty PTE will lose the dirty state and return a read-only, clean entry.
> >
> > Move the logic from ptep_set_wrprotect() into pte_wrprotect() to ensure that
> > the dirty bit is preserved for writable entries, as this is required for
> > soft-dirty bit management if we enable it in the future.
> >
> > Cc: <stable@...r.kernel.org>
>
> It this stable material if it would be a problem once ARM64 supports
> softdirty in future?
I don't think so. Arm64 did not have a hardware dirty mechanism from the
start, it was added later but in a way as to coexist with other CPUs or
peripherals that don't support it. So instead of setting a PTE_DIRTY bit
as one would expect, the CPU clears the PTE_RDONLY on write access to a
writable PTE (the PTE_DBM/PTE_WRITE bit set). So our pte_wrprotect()
needs to set PTE_RDONLY and clear PTE_DBM (PTE_WRITE) but !PTE_RDONLY is
our only information of a pte having been dirtied, so we have to
transfer it to a software PTE_DIRTY bit. This is different from a
soft-dirty pte bit if we add it in the future.
--
Catalin
Powered by blists - more mailing lists