From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"maz@kernel.org" <maz@kernel.org>,
"will@kernel.org" <will@kernel.org>,
"oliver.upton@linux.dev" <oliver.upton@linux.dev>,
"james.morse@arm.com" <james.morse@arm.com>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
yuzenghui <yuzenghui@huawei.com>,
zhukeqian <zhukeqian1@huawei.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Linuxarm <linuxarm@huawei.com>
Subject: RE: [RFC PATCH v2 4/8] KVM: arm64: Set DBM for previously writeable pages
Date: Mon, 25 Sep 2023 08:04:06 +0000 [thread overview]
Message-ID: <0149ecd0a88c4938b21169182e706fb9@huawei.com> (raw)
In-Reply-To: <ZQ21YYGqcAhOq/UO@arm.com>
> -----Original Message-----
> From: Catalin Marinas [mailto:catalin.marinas@arm.com]
> Sent: 22 September 2023 16:40
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: kvmarm@lists.linux.dev; kvm@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; maz@kernel.org; will@kernel.org;
> oliver.upton@linux.dev; james.morse@arm.com; suzuki.poulose@arm.com;
> yuzenghui <yuzenghui@huawei.com>; zhukeqian
> <zhukeqian1@huawei.com>; Jonathan Cameron
> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>
> Subject: Re: [RFC PATCH v2 4/8] KVM: arm64: Set DBM for previously
> writeable pages
>
> On Fri, Aug 25, 2023 at 10:35:24AM +0100, Shameer Kolothum wrote:
> > We only set DBM if the page is writeable (S2AP[1] == 1). But once
> migration
> > starts, CLEAR_LOG path will write protect the pages (S2AP[1] = 0) and
> there
> > isn't an easy way to differentiate the writeable pages that gets write
> > protected from read-only pages as we only have S2AP[1] bit to check.
>
> Don't we have enough bits without an additional one?
>
> writeable: DBM == 1 || S2AP[1] == 1
> clean: S2AP[1] == 0
> dirty: S2AP[1] == 1 (irrespective of DBM)
>
> read-only: DBM == 0 && S2AP[1] == 0
>
> For S1 we use a software dirty bit as well to track read-only dirty
> mappings but I don't think it is necessary for S2 since KVM unmaps the
> PTE when changing the VMM permission.
>
We don't set the DBM for all the memory. In order to reduce the overhead
associated with scanning PTEs, this series sets the DBM for the nearby pages
on page fault during the migration phase.
See patch #8,
user_mem_abort()
kvm_arm_enable_nearby_hwdbm()
But once migration starts, on CLEAR_LOG path,
kvm_arch_mmu_enable_log_dirty_pt_masked()
stage2_wp_range() --> set the page read only
kvm_mmu_split_huge_pages() --> split huge pages and pages are read only.
This in effect means there are no writeable-clean near-by pages to set the DBM on
kvm_arm_enable_nearby_hwdbm().
To identify the pages that can be set DBM, we provide a hint to
stage2_wp_range( ) --> kvm_pgtable_stage2_wrprotect() table walker and make
use of a new software bit to mark the PTE as writeable-clean.
Hope, I am clear.
Thanks,
Shameer
next prev parent reply other threads:[~2023-09-25 8:04 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 9:35 [RFC PATCH v2 0/8] KVM: arm64: Implement SW/HW combined dirty log Shameer Kolothum
2023-08-25 9:35 ` [RFC PATCH v2 1/8] arm64: cpufeature: Add API to report system support of HWDBM Shameer Kolothum
2023-08-25 9:35 ` [RFC PATCH v2 2/8] KVM: arm64: Add KVM_PGTABLE_WALK_HW_DBM for HW DBM support Shameer Kolothum
2023-09-15 22:05 ` Oliver Upton
2023-09-18 9:52 ` Shameerali Kolothum Thodi
2023-08-25 9:35 ` [RFC PATCH v2 3/8] KVM: arm64: Add some HW_DBM related pgtable interfaces Shameer Kolothum
2023-09-15 22:22 ` Oliver Upton
2023-09-18 9:53 ` Shameerali Kolothum Thodi
2023-09-22 15:24 ` Catalin Marinas
2023-09-22 17:49 ` Oliver Upton
2023-09-25 8:04 ` Shameerali Kolothum Thodi
2023-09-26 15:20 ` Catalin Marinas
2023-09-26 15:52 ` Shameerali Kolothum Thodi
2023-09-26 16:37 ` Catalin Marinas
2023-08-25 9:35 ` [RFC PATCH v2 4/8] KVM: arm64: Set DBM for previously writeable pages Shameer Kolothum
2023-09-15 22:54 ` Oliver Upton
2023-09-18 9:54 ` Shameerali Kolothum Thodi
2023-09-22 15:40 ` Catalin Marinas
2023-09-25 8:04 ` Shameerali Kolothum Thodi [this message]
2023-08-25 9:35 ` [RFC PATCH v2 5/8] KVM: arm64: Add some HW_DBM related mmu interfaces Shameer Kolothum
2023-08-25 9:35 ` [RFC PATCH v2 6/8] KVM: arm64: Only write protect selected PTE Shameer Kolothum
2023-09-22 16:00 ` Catalin Marinas
2023-09-22 16:59 ` Oliver Upton
2023-09-26 15:58 ` Catalin Marinas
2023-09-26 16:10 ` Catalin Marinas
2023-08-25 9:35 ` [RFC PATCH v2 7/8] KVM: arm64: Add KVM_CAP_ARM_HW_DBM Shameer Kolothum
2023-08-25 9:35 ` [RFC PATCH v2 8/8] KVM: arm64: Start up SW/HW combined dirty log Shameer Kolothum
2023-09-13 17:30 ` [RFC PATCH v2 0/8] KVM: arm64: Implement " Oliver Upton
2023-09-14 9:47 ` Shameerali Kolothum Thodi
2023-09-15 0:36 ` Oliver Upton
2023-09-18 9:55 ` Shameerali Kolothum Thodi
2023-09-20 21:12 ` Oliver Upton
2023-10-12 7:51 ` Shameerali Kolothum Thodi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0149ecd0a88c4938b21169182e706fb9@huawei.com \
--to=shameerali.kolothum.thodi@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linuxarm@huawei.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
--cc=zhukeqian1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox