From: Inochi Amaoto <inochiama@gmail.com>
To: Marc Zyngier <maz@kernel.org>, Inochi Amaoto <inochiama@gmail.com>
Cc: Tian Zheng <zhengtian10@huawei.com>,
oupton@kernel.org, catalin.marinas@arm.com, corbet@lwn.net,
pbonzini@redhat.com, will@kernel.org, yuzenghui@huawei.com,
wangzhou1@hisilicon.com, liuyonglong@huawei.com,
Jonathan.Cameron@huawei.com, yezhenyu2@huawei.com,
linuxarm@huawei.com, joey.gouly@arm.com, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, suzuki.poulose@arm.com,
leo.bras@arm.com
Subject: Re: [PATCH v3 3/5] KVM: arm64: Add support for FEAT_HDBSS
Date: Mon, 1 Jun 2026 17:05:29 +0800 [thread overview]
Message-ID: <ah1KLrpYBXSMM91H@inochi.infowork> (raw)
In-Reply-To: <864ijmvdpy.wl-maz@kernel.org>
On Mon, Jun 01, 2026 at 09:58:49AM +0100, Marc Zyngier wrote:
> On Mon, 01 Jun 2026 01:50:22 +0100,
> Inochi Amaoto <inochiama@gmail.com> wrote:
> >
> > On Wed, Feb 25, 2026 at 12:04:19PM +0800, Tian Zheng wrote:
> > > From: eillon <yezhenyu2@huawei.com>
> > >
> > > Armv9.5 introduces the Hardware Dirty Bit State Structure (HDBSS) feature,
> > > indicated by ID_AA64MMFR1_EL1.HAFDBS == 0b0100. A CPU capability is added
> > > to notify the user of the feature.
> > >
> > > Add KVM_CAP_ARM_HW_DIRTY_STATE_TRACK ioctl and basic framework for
> > > ARM64 HDBSS support. Since the HDBSS buffer size is configurable and
> > > cannot be determined at KVM initialization, an IOCTL interface is
> > > required.
> > >
> > > Actually exposing the new capability to user space happens in a later
> > > patch.
> > >
> > > Signed-off-by: eillon <yezhenyu2@huawei.com>
> > > Signed-off-by: Tian Zheng <zhengtian10@huawei.com>
> > > ---
> > > arch/arm64/include/asm/cpufeature.h | 5 +++++
> > > arch/arm64/kernel/cpufeature.c | 12 ++++++++++++
> > > arch/arm64/tools/cpucaps | 1 +
> > > include/uapi/linux/kvm.h | 1 +
> > > tools/include/uapi/linux/kvm.h | 1 +
> > > 5 files changed, 20 insertions(+)
> > >
> > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> > > index 4de51f8d92cb..dcc2e2cad5ad 100644
> > > --- a/arch/arm64/include/asm/cpufeature.h
> > > +++ b/arch/arm64/include/asm/cpufeature.h
> > > @@ -856,6 +856,11 @@ static inline bool system_supports_haft(void)
> > > return cpus_have_final_cap(ARM64_HAFT);
> > > }
> > >
> > > +static inline bool system_supports_hdbss(void)
> > > +{
> > > + return cpus_have_final_cap(ARM64_HAS_HDBSS);
> > > +}
> > > +
> > > static __always_inline bool system_supports_mpam(void)
> > > {
> > > return alternative_has_cap_unlikely(ARM64_MPAM);
> > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> > > index c31f8e17732a..348b0afffc3e 100644
> > > --- a/arch/arm64/kernel/cpufeature.c
> > > +++ b/arch/arm64/kernel/cpufeature.c
> > > @@ -2124,6 +2124,11 @@ static bool hvhe_possible(const struct arm64_cpu_capabilities *entry,
> > > return arm64_test_sw_feature_override(ARM64_SW_FEATURE_OVERRIDE_HVHE);
> > > }
> > >
> > > +static bool has_vhe_hdbss(const struct arm64_cpu_capabilities *entry, int cope)
> > > +{
> > > + return is_kernel_in_hyp_mode() && has_cpuid_feature(entry, cope);
> > > +}
> > > +
> > > bool cpu_supports_bbml2_noabort(void)
> > > {
> > > /*
> > > @@ -2759,6 +2764,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
> > > ARM64_CPUID_FIELDS(ID_AA64MMFR1_EL1, HAFDBS, HAFT)
> > > },
> > > #endif
> > > + {
> > > + .desc = "Hardware Dirty state tracking structure (HDBSS)",
> > > + .type = ARM64_CPUCAP_SYSTEM_FEATURE,
> > > + .capability = ARM64_HAS_HDBSS,
> > > + .matches = has_vhe_hdbss,
> > > + ARM64_CPUID_FIELDS(ID_AA64MMFR1_EL1, HAFDBS, HDBSS)
> > > + },
> > > {
> > > .desc = "CRC32 instructions",
> > > .capability = ARM64_HAS_CRC32,
> > > diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
> > > index 7261553b644b..f6ece5b85532 100644
> > > --- a/arch/arm64/tools/cpucaps
> > > +++ b/arch/arm64/tools/cpucaps
> > > @@ -68,6 +68,7 @@ HAS_VA52
> > > HAS_VIRT_HOST_EXTN
> > > HAS_WFXT
> > > HAS_XNX
> > > +HAS_HDBSS
> > > HAFT
> > > HW_DBM
> > > KVM_HVHE
> >
> >
> > > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> > > index 65500f5db379..15ee42cdbd51 100644
> > > --- a/include/uapi/linux/kvm.h
> > > +++ b/include/uapi/linux/kvm.h
> > > @@ -985,6 +985,7 @@ struct kvm_enable_cap {
> > > #define KVM_CAP_ARM_SEA_TO_USER 245
> > > #define KVM_CAP_S390_USER_OPEREXEC 246
> > > #define KVM_CAP_S390_KEYOP 247
> > > +#define KVM_CAP_ARM_HW_DIRTY_STATE_TRACK 248
> > >
> > > struct kvm_irq_routing_irqchip {
> > > __u32 irqchip;
> > > diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h
> > > index dddb781b0507..93e0a1e14dc7 100644
> > > --- a/tools/include/uapi/linux/kvm.h
> > > +++ b/tools/include/uapi/linux/kvm.h
> > > @@ -974,6 +974,7 @@ struct kvm_enable_cap {
> > > #define KVM_CAP_GUEST_MEMFD_FLAGS 244
> > > #define KVM_CAP_ARM_SEA_TO_USER 245
> > > #define KVM_CAP_S390_USER_OPEREXEC 246
> > > +#define KVM_CAP_ARM_HW_DIRTY_STATE_TRACK 248
> > >
> > > struct kvm_irq_routing_irqchip {
> > > __u32 irqchip;
> > > --
> > > 2.33.0
> > >
> >
> > Instead of having these architecture specific capability, I wonder if
> > we can add a generic capability like "KVM_CAP_HW_DIRTY_STATE", so
> > other architecture supports similar things can reuse this capability,
>
> What of the existing stuff doing the same thing? x86's PML, to start
> with?
>
In fact I think the HDBSS is the first one with non-fixed size.
Although there is a in process RISC-V extension for it, there will
be a long story to make it ratified.
> > For this generic thing I suggest, the getter returns the max support
> > entry count (or the buffer size) it supports like the dirty ring
> > capability. And the setter just let the architecture set the parameters
> > based on the user request.
>
> This looks wrong on a number of levels.
>
> - If you want something generic, there is the existing dirty
> log/bitmap. How this stuff is populated is none of the user's
> business (trapping write accesses, dirty bit collection from the
> PTs, or HW-generated log), and we don't need an extra feature for
> it. Performance will obviously suck, but that's what you pay for
> something abstracted and cross-architecture.
>
> - If you want something architecture specific, then it can't be
> generic, by definition. You get the raw speed and compatibility with
> other arch-specific extensions.
>
OK, I agree, it is better to keep this thing arch-specific. Doing a
generic thing does not benefit too much, I have made a mistake on
it. Thanks for your kindly explanation.
> > This should do no harm to this implement, as everything still depends
> > on the architecture behavior, and leave room for other architecture
> > to reuse this.
>
> Again, the generic framework exists, you just have to implement the
> backend you want.
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.
Regards,
Inochi
next prev parent reply other threads:[~2026-06-01 9:05 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 4:04 [PATCH v3 0/5] Support the FEAT_HDBSS introduced in Armv9.5 Tian Zheng
2026-02-25 4:04 ` [PATCH v3 1/5] arm64/sysreg: Add HDBSS related register information Tian Zheng
2026-02-25 4:04 ` [PATCH v3 2/5] KVM: arm64: Add support to set the DBM attr during memory abort Tian Zheng
2026-02-25 4:04 ` [PATCH v3 3/5] KVM: arm64: Add support for FEAT_HDBSS Tian Zheng
2026-06-01 0:50 ` Inochi Amaoto
2026-06-01 8:58 ` Marc Zyngier
2026-06-01 9:05 ` Inochi Amaoto [this message]
2026-06-05 8:29 ` Tian Zheng
2026-07-06 14:01 ` Leonardo Bras
2026-07-07 6:11 ` Tian Zheng
2026-07-07 10:07 ` Leonardo Bras
2026-02-25 4:04 ` [PATCH v3 4/5] KVM: arm64: Enable HDBSS support and handle HDBSSF events Tian Zheng
2026-02-25 17:46 ` Leonardo Bras
2026-02-27 10:47 ` Tian Zheng
2026-02-27 14:10 ` Leonardo Bras
2026-03-04 3:06 ` Tian Zheng
2026-03-04 12:08 ` Leonardo Bras
2026-03-05 7:37 ` Tian Zheng
2026-03-04 15:40 ` Leonardo Bras
2026-03-06 9:27 ` Tian Zheng
2026-03-06 15:01 ` Leonardo Bras
2026-03-12 6:17 ` Tian Zheng
2026-03-12 12:06 ` Leonardo Bras
2026-03-12 13:13 ` Tian Zheng
2026-03-12 14:58 ` Leonardo Bras
2026-03-25 18:05 ` Leonardo Bras
2026-03-25 18:20 ` [PATCH] arm64/kvm: Enable eager hugepage splitting if HDBSS is available Leonardo Bras
2026-03-27 7:40 ` Tian Zheng
2026-03-27 14:37 ` Leonardo Bras
2026-03-26 14:31 ` [PATCH v3 4/5] KVM: arm64: Enable HDBSS support and handle HDBSSF events Leonardo Bras
2026-03-27 7:35 ` Tian Zheng
2026-03-27 15:00 ` Leonardo Bras
2026-03-28 6:05 ` Tian Zheng
2026-03-30 11:31 ` Leonardo Bras
2026-04-21 14:18 ` Leonardo Bras
2026-04-24 6:48 ` Tian Zheng
2026-04-24 10:08 ` Leonardo Bras
2026-02-25 4:04 ` [PATCH v3 5/5] KVM: arm64: Document HDBSS ioctl Tian Zheng
2026-03-31 14:13 ` [PATCH v3 0/5] Support the FEAT_HDBSS introduced in Armv9.5 Leonardo Bras
2026-04-02 2:40 ` Tian Zheng
2026-04-02 12:42 ` Leonardo Bras
2026-05-19 15:23 ` Will Deacon
2026-05-19 15:35 ` Leonardo Bras
2026-05-20 8:51 ` Tian Zheng
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=ah1KLrpYBXSMM91H@inochi.infowork \
--to=inochiama@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=leo.bras@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=skhan@linuxfoundation.org \
--cc=suzuki.poulose@arm.com \
--cc=wangzhou1@hisilicon.com \
--cc=will@kernel.org \
--cc=yezhenyu2@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