FAILED: patch "[PATCH] KVM: arm64: Ensure level is always initialized when relaxing" failed to apply to 6.18-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 100baf0184896f859290a684f864b8200d8ac872
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072032-musty-tightly-d28e@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 100baf0184896f859290a684f864b8200d8ac872 Mon Sep 17 00:00:00 2001
From: Oliver Upton <[email protected]>
Date: Wed, 1 Jul 2026 16:16:19 -0700
Subject: [PATCH] KVM: arm64: Ensure level is always initialized when relaxing
perms
stage2_update_leaf_attrs() returns early before writing to @level if the table walker returned an error. At the same time, kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the error was EAGAIN, indicating the vCPU raced with a table update and the TLB entry it hit is now stale.
Fall back to an unknown TTL if none was provided by the walk.
arch/arm64/kvm/hyp/pgtable.c +1 -1
@@ -1356,7 +1356,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr, enum kvm_pgtable_prot prot, enum kvm_pgtable_walk_flags flags) { kvm_pte_t xn = 0, set = 0, clr = 0; -s8 level; +s8 level =TLBI_TTL_UNKNOWN ;int ret;if (prot &KVM_PTE_LEAF_ATTR_HI_SW )
Marc Zyngier
maintainerPATCH 1/2 KVM: arm64: Ensure level is always initialized when relaxing perms
From: Oliver Upton <[email protected]>
stage2_update_leaf_attrs() returns early before writing to @level if the table walker returned an error. At the same time, kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the error was EAGAIN, indicating the vCPU raced with a table update and the TLB entry it hit is now stale.
Fall back to an unknown TTL if none was provided by the walk.
--- arch/arm64/kvm/hyp/pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/hyp/pgtable.c +1 -1
@@ -1291,7 +1291,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr, enum kvm_pgtable_prot prot, enum kvm_pgtable_walk_flags flags) { int ret; -s8 level; +s8 level =TLBI_TTL_UNKNOWN ;kvm_pte_t set =0 , clr =0 ;if (prot &KVM_PTE_LEAF_ATTR_HI_SW )
Signature · 1 line
2.47.3
Marc Zyngier
maintainerPATCH 2/2 KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms()
Assigning the invalidation level (an s8 value) with TLBI_TTL_UNKNOWN (a 32bit signed value) is not ideal, to say the least. Instead of this, only pass TLBI_TTL_UNKNOWN to __kvm_tlb_flush_vmid_ipa_nsh() when we know for sure that we don't have a provided level.
--- arch/arm64/kvm/hyp/pgtable.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/kvm/hyp/pgtable.c +3 -2
@@ -1291,7 +1291,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr, enum kvm_pgtable_prot prot, enum kvm_pgtable_walk_flags flags) { int ret; -s8 level =TLBI_TTL_UNKNOWN ; +s8 level;kvm_pte_t set =0 , clr =0 ;if (prot &KVM_PTE_LEAF_ATTR_HI_SW )
@@ -1308,7 +1308,8 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr, ret =stage2_update_leaf_attrs (pgt, addr,1 , set, clr,NULL , &level, flags);if (!ret || ret == -EAGAIN ) -kvm_call_hyp (__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr, level); +kvm_call_hyp (__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr, + (ret == -EAGAIN ) ?TLBI_TTL_UNKNOWN : level);return ret; }
Signature · 1 line
2.47.3