Re: [PATCH v2 1/2] KVM: arm64: skip pKVM cache flushes for non cacheable mappings
From: Marc Zyngier
Date: Tue Jun 23 2026 - 13:03:29 EST
Bradley,
Just a few things to keep in mind for your next contributions:
- If you are sending more than a single patch, add a cover letter.
- Don't send a v2 in reply to a v1. It messes the threading we are
relying on, and makes it hard to ignore replies to an older version.
Always send new series standalone.
- Don't immediately send a V2, even if (especially if!) a bot is
pestering you. 34 minutes between versions is way too short (at
least a few days is the norm).
On Tue, 23 Jun 2026 17:37:55 +0100,
Bradley Morgan <include@xxxxxxxxx> wrote:
>
> pKVM keeps its own mapping list for stage 2 operations. Its flush path
> uses that list directly, so it lost the PTE attribute check done by the
> generic stage 2 walker.
>
> Record whether a mapping is cacheable and skip cache maintenance for
> mappings that are not cacheable.
>
> Fixes: e912efed485a ("KVM: arm64: Introduce the EL1 pKVM MMU")
> Cc: stable@xxxxxxxxxxxxxxx
What device memory gets mapped in an upstream pKVM guest that would
require a backport to stable?
> Signed-off-by: Bradley Morgan <include@xxxxxxxxx>
> ---
> Changes in v2:
> - Add patch 2 for the pKVM permission fault mapping cache bug.
This is the sort of information that goes in the cover letter.
>
> arch/arm64/include/asm/kvm_pkvm.h | 1 +
> arch/arm64/kvm/pkvm.c | 8 +++++++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/kvm_pkvm.h b/arch/arm64/include/asm/kvm_pkvm.h
> index 74fedd9c5ff0..d9dd8239910d 100644
> --- a/arch/arm64/include/asm/kvm_pkvm.h
> +++ b/arch/arm64/include/asm/kvm_pkvm.h
> @@ -196,6 +196,7 @@ struct pkvm_mapping {
> u64 gfn;
> u64 pfn;
> u64 nr_pages;
> + bool cacheable;
Errr, no. That's a terrible idea.
This thing is already big enough, let's not add a bool right in the
middle (use pahole to find out why this is bad). Given that nr_pages
is for a range, and that the minimum page size uses 12 bits, the
largest number of pages you can have here is 56-12=48 bit wide. That's
another 16 bits worth of flags you can use.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.