From: Marc Zyngier <maz@kernel.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, will@kernel.org,
catalin.marinas@arm.com, mark.rutland@arm.com,
Mark Brown <broonie@kernel.org>,
James Clark <james.clark@arm.com>, Rob Herring <robh@kernel.org>,
Suzuki Poulose <suzuki.poulose@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
linux-perf-users@vger.kernel.org,
Oliver Upton <oliver.upton@linux.dev>,
James Morse <james.morse@arm.com>,
kvmarm@lists.linux.dev
Subject: Re: [PATCH V18 2/9] KVM: arm64: Explicitly handle BRBE traps as UNDEFINED
Date: Mon, 17 Jun 2024 08:41:06 +0100 [thread overview]
Message-ID: <86jzioj9t9.wl-maz@kernel.org> (raw)
In-Reply-To: <df348434-85af-4bae-a31a-4a4a93c3cf49@arm.com>
On Mon, 17 Jun 2024 07:27:13 +0100,
Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> On 6/14/24 18:39, Marc Zyngier wrote:
> > On Fri, 14 Jun 2024 13:33:37 +0100,
> >
> > Actually, to disable the *instructions*, a similar hack must be
> > applied to HFGITR_EL2. The resulting patch should be something like:
> >
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index ee33f5467ce5..49d86dae8d80 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> > @@ -4964,6 +4964,15 @@ void kvm_init_sysreg(struct kvm_vcpu *vcpu)
> > kvm->arch.fgu[HAFGRTR_GROUP] |= ~(HAFGRTR_EL2_RES0 |
> > HAFGRTR_EL2_RES1);
> >
> > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, BRBE, IMP)) {
> > + kvm->arch.fgu[HDFGRTR_GROUP] |= (HDFGRTR_nBRBDATA |
> > + HDFGRTR_nBRBCTL |
> > + HDFGRTR_nBRBIDR);
Obviously, this needs to be spelled HDFGRTR_EL2_nBRB* so that it
actually compiles.
> > + kvm->arch.fgu[HFGITR_GROUP] |= (HFGITR_EL2_nBRBINJ |
> > + HFGITR_EL2_nBRBIALL);
> > + }
> > +
> > +
> > set_bit(KVM_ARCH_FLAG_FGU_INITIALIZED, &kvm->arch.flags);
> > out:
> > mutex_unlock(&kvm->arch.config_lock);
>
> This makes sense, will remove all the changes to sys_reg table and
> instead fold the above suggestion into the patch.
>
> >
> > The implicit dependency here is that FGT is always present on a system
> > that implements BRBE. The architecture supports this assertion:
> >
> > - BRBE is not available before ARMv9.1
> > - FGT is mandatory from ARMv8.6
> >
> > Given that v9.1 is congruent to v8.6, we have the required overlap.
>
> So this overlap need not be asserted in software again ?
I don't think there's a need for that.
We went through the same thing with SME (which has the exact same
dependency), and concluded that there was no need to paper over broken
implementations at the moment (only QEMU was affected, and that was
quickly fixed). If we find an implementation in the wild that didn't
get the memo, we can add a workaround at that time.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2024-06-17 7:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 6:17 [PATCH V18 0/9] arm64/perf: Enable branch stack sampling Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 1/9] arm64/sysreg: Add BRBE registers and fields Anshuman Khandual
2024-06-13 10:10 ` Mark Rutland
2024-06-13 6:17 ` [PATCH V18 2/9] KVM: arm64: Explicitly handle BRBE traps as UNDEFINED Anshuman Khandual
2024-06-13 10:14 ` Mark Rutland
2024-06-14 12:33 ` Marc Zyngier
2024-06-14 13:09 ` Marc Zyngier
2024-06-17 6:27 ` Anshuman Khandual
2024-06-17 7:41 ` Marc Zyngier [this message]
2024-06-13 6:17 ` [PATCH V18 3/9] drivers: perf: arm_pmu: Add infrastructure for branch stack sampling Anshuman Khandual
2024-06-14 15:01 ` Mark Rutland
2024-06-17 4:37 ` Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 4/9] arm64/boot: Enable EL2 requirements for BRBE Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 5/9] drivers: perf: arm_pmuv3: Enable branch stack sampling via FEAT_BRBE Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 6/9] KVM: arm64: nvhe: Disable branch generation in nVHE guests Anshuman Khandual
2024-06-14 15:23 ` Mark Rutland
2024-06-17 6:45 ` Anshuman Khandual
2024-06-17 9:39 ` Mark Rutland
2024-06-20 4:22 ` Anshuman Khandual
2024-06-21 13:12 ` Mark Rutland
2024-06-13 6:17 ` [PATCH V18 7/9] perf: test: Speed up running brstack test on an Arm model Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 8/9] perf: test: Remove empty lines from branch filter test output Anshuman Khandual
2024-06-13 6:17 ` [PATCH V18 9/9] perf: test: Extend branch stack sampling test for Arm64 BRBE Anshuman Khandual
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=86jzioj9t9.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=acme@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.clark@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=oliver.upton@linux.dev \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).