Skip to content

Commit 8a4e274

Browse files
yamahatabonzini
authored andcommitted
KVM: x86/tdp_mmu: Sprinkle __must_check
The TDP MMU function __tdp_mmu_set_spte_atomic uses a cmpxchg64 to replace the SPTE value and returns -EBUSY on failure. The caller must check the return value and retry. Add __must_check to it, as well as to two more functions that forward the return value of __tdp_mmu_set_spte_atomic to their caller. Signed-off-by: Isaku Yamahata <[email protected]> Reviewed-by: Binbin Wu <[email protected]> Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com> Acked-by: Kai Huang <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d814738 commit 8a4e274

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
530530
kvm_set_pfn_accessed(spte_to_pfn(old_spte));
531531
}
532532

533-
static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte)
533+
static inline int __must_check __tdp_mmu_set_spte_atomic(struct tdp_iter *iter,
534+
u64 new_spte)
534535
{
535536
u64 *sptep = rcu_dereference(iter->sptep);
536537

@@ -572,9 +573,9 @@ static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte)
572573
* no side-effects other than setting iter->old_spte to the last
573574
* known value of the spte.
574575
*/
575-
static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm,
576-
struct tdp_iter *iter,
577-
u64 new_spte)
576+
static inline int __must_check tdp_mmu_set_spte_atomic(struct kvm *kvm,
577+
struct tdp_iter *iter,
578+
u64 new_spte)
578579
{
579580
int ret;
580581

@@ -590,8 +591,8 @@ static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm,
590591
return 0;
591592
}
592593

593-
static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm,
594-
struct tdp_iter *iter)
594+
static inline int __must_check tdp_mmu_zap_spte_atomic(struct kvm *kvm,
595+
struct tdp_iter *iter)
595596
{
596597
int ret;
597598

0 commit comments

Comments
 (0)