Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leonardo Bras <leo.bras@arm.com>
To: Tian Zheng <zhengtian10@huawei.com>
Cc: Leonardo Bras <leo.bras@arm.com>,
	maz@kernel.org, oupton@kernel.org, catalin.marinas@arm.com,
	will@kernel.org, yuzenghui@huawei.com, wangzhou1@hisilicon.com,
	yangjinqian1@huawei.com, caijian11@h-partners.com,
	liuyonglong@huawei.com, yezhenyu2@huawei.com,
	yubihong@huawei.com, linuxarm@huawei.com, joey.gouly@arm.com,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, seiden@linux.ibm.com,
	suzuki.poulose@arm.com
Subject: Re: [PATCH v4 0/6] Support the FEAT_HDBSS introduced in Armv9.5
Date: Mon, 13 Jul 2026 11:31:46 +0100	[thread overview]
Message-ID: <alS-kcwvlASwPIzL@LeoBrasDK> (raw)
In-Reply-To: <20260709104026.2612599-1-zhengtian10@huawei.com>

On Thu, Jul 09, 2026 at 06:40:20PM +0800, Tian Zheng wrote:
> This series of patches add support to the Hardware Dirty state tracking
> Structure (HDBSS) feature, which is introduced by the ARM architecture
> in the DDI0601 (ID121123) version.
> 
> The HDBSS feature is an extension to the architecture that enhances
> tracking translation table descriptors' dirty state, identified as
> FEAT_HDBSS. This feature utilizes hardware assistance to achieve dirty
> page tracking, aiming to significantly reduce the overhead of scanning
> for dirty pages.
> 
> The purpose of this feature is to make the execution overhead of live
> migration lower to both the guest and the host, compared to existing
> approaches (write-protect or search stage-2 tables).
> 
> The required sysreg definitions for FEAT_HDBSS have been merged into
> arm64 /sysregs:
>   [1/5] arm64/sysreg: Add HDBSS related register information
>         https://git.kernel.org/arm64/c/72f7be0c2e30
> 
> 
> After these patches, the kernel automatically enables HDBSS when dirty
> logging is enabled on any memslot, and disables HDBSS when dirty logging
> is disabled on all memslots. This series does not support dirty ring
> mode.
> 
> Depends-on: "KVM: arm64: Enable eager hugepage splitting if HDBSS is available"
> 	https://lore.kernel.org/linux-arm-kernel/20260629111820.1873540-3-leo.bras@arm.com/

On this, FYI, there have been some discussion on this:
https://lore.kernel.org/all/alETGFD2Ogx6N0HB@LeoBrasDK/

Oliver's suggestion is that we don't automatically enable eager splitting, 
but instead we have different behaviours if the user enables it.

This is still under discussion there, but I think it can be useful reading. 

> 
> This dependency is mandatory. Unlike v3, where DBM was added lazily on
> the first dirty access via a page fault, v4 injects DBM into pgt->flags
> at stage-2 MMU initialization time. Combined with HDBSS being auto-enabled
> during migration setup, the first dirty access no longer triggers a page
> fault. Consequently, if lazy hugepage splitting were relied upon (which
> requires a page fault to trigger splitting), hugepages would never be
> split, leading to guest hang after migration. Leonardo's patch above
> ensures eager hugepage splitting is enabled (chunk_size != 0) when HDBSS
> is available, guaranteeing that hugepages are properly split before
> migration starts.
> 
> v3: https://lore.kernel.org/linux-arm-kernel/20260225040421.2683931-1-zhengtian10@huawei.com/
> 
> v3->v4 changes:
> - Merge sysreg definitions into the FEAT_HDBSS detection patch (was a
>   separate patch in v3).
> - Add auto DBM (Dirty Bit Modifier) support as a new patch, suggested
>   by Leonardo Bras. DBM is now controlled as a page-table level flag
>   (KVM_PGTABLE_S2_DBM) rather than per-PTE. Note that DBM is injected
>   at stage-2 MMU creation time, not lazily on first dirty access. This
>   means the first write to a dirty-logged page does not generate a
>   page fault, which is a key reason for the mandatory dependency on
>   Leonardo's eager hugepage splitting patch (see Depends-on above).
> - Split the v3 "Enable HDBSS support and handle HDBSSF events" patch
>   into three patches: per-vCPU buffer management, fault handling and
>   buffer flush, and auto enable/disable on dirty logging change. This
>   implements kernel-managed automatic HDBSS enable/disable.
> - Remove the KVM_CAP_ARM_HW_DIRTY_STATE_TRACK ioctl for manual HDBSS
>   on/off. HDBSS is now automatically enabled/disabled based on dirty
>   logging state via kvm_arch_commit_memory_region().
> - Change HDBSS buffer flush triggers to vcpu_put, check_vcpu_requests,
>   and kvm_handle_guest_abort.
> - Store hdbss_order at VM level (kvm->arch.hdbss_order) instead of
>   per-vCPU, since all vCPUs share the same order.
> - Document patch is not included in this version; will be sent in a
>   follow-up series.
> 
> Leonardo Bras (1):
>   KVM: arm64: Enable eager hugepage splitting if HDBSS is available
> 
> Tian Zheng (2):
>   KVM: arm64: Add support for FEAT_HDBSS
>   KVM: arm64: Add auto DBM support for hardware dirty tracking
> 
> eillon (3):
>   KVM: arm64: Add HDBSS per-vCPU buffer management
>   KVM: arm64: Add HDBSS fault handling and buffer flush
>   KVM: arm64: Add auto HDBSS enable/disable on dirty logging change
> 
>  arch/arm64/include/asm/cpufeature.h    |   5 +
>  arch/arm64/include/asm/esr.h           |   5 +
>  arch/arm64/include/asm/kvm_dirty_bit.h |  29 ++++
>  arch/arm64/include/asm/kvm_host.h      |  14 ++
>  arch/arm64/include/asm/kvm_pgtable.h   |   4 +
>  arch/arm64/include/asm/sysreg.h        |  11 ++
>  arch/arm64/kernel/cpufeature.c         |  12 ++
>  arch/arm64/kvm/Makefile                |   1 +
>  arch/arm64/kvm/arm.c                   |  29 ++++
>  arch/arm64/kvm/dirty_bit.c             | 219 +++++++++++++++++++++++++
>  arch/arm64/kvm/hyp/pgtable.c           |  35 +++-
>  arch/arm64/kvm/hyp/vhe/switch.c        |  15 ++
>  arch/arm64/kvm/mmu.c                   |  19 ++-
>  arch/arm64/kvm/reset.c                 |   4 +
>  arch/arm64/tools/cpucaps               |   1 +
>  15 files changed, 399 insertions(+), 4 deletions(-)
>  create mode 100644 arch/arm64/include/asm/kvm_dirty_bit.h
>  create mode 100644 arch/arm64/kvm/dirty_bit.c
> 
> --
> 2.33.0
> 


  parent reply	other threads:[~2026-07-13 10:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 10:40 [PATCH v4 0/6] Support the FEAT_HDBSS introduced in Armv9.5 Tian Zheng
2026-07-09 10:40 ` [PATCH v4 1/6] KVM: arm64: Enable eager hugepage splitting if HDBSS is available Tian Zheng
2026-07-09 10:40 ` [PATCH v4 2/6] KVM: arm64: Add support for FEAT_HDBSS Tian Zheng
2026-07-09 10:40 ` [PATCH v4 3/6] KVM: arm64: Add auto DBM support for hardware dirty tracking Tian Zheng
2026-07-13 11:17   ` Leonardo Bras
2026-07-14  1:14     ` Tian Zheng
2026-07-09 10:40 ` [PATCH v4 4/6] KVM: arm64: Add HDBSS per-vCPU buffer management Tian Zheng
2026-07-13 13:39   ` Leonardo Bras
2026-07-09 10:40 ` [PATCH v4 5/6] KVM: arm64: Add HDBSS fault handling and buffer flush Tian Zheng
2026-07-13 14:06   ` Leonardo Bras
2026-07-09 10:40 ` [PATCH v4 6/6] KVM: arm64: Add auto HDBSS enable/disable on dirty logging change Tian Zheng
2026-07-13 14:50   ` Leonardo Bras
2026-07-13 10:31 ` Leonardo Bras [this message]
2026-07-13 16:27   ` [PATCH v4 0/6] Support the FEAT_HDBSS introduced in Armv9.5 Leonardo Bras

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=alS-kcwvlASwPIzL@LeoBrasDK \
    --to=leo.bras@arm.com \
    --cc=caijian11@h-partners.com \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=will@kernel.org \
    --cc=yangjinqian1@huawei.com \
    --cc=yezhenyu2@huawei.com \
    --cc=yubihong@huawei.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhengtian10@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