* [PATCH] KVM: x86/tdp_mmu: Sprinkle __must_check
@ 2024-06-11 8:11 Paolo Bonzini
2024-06-11 9:41 ` Huang, Kai
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2024-06-11 8:11 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: Isaku Yamahata, Binbin Wu
From: Isaku Yamahata <isaku.yamahata@intel.com>
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 <isaku.yamahata@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/mmu/tdp_mmu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 36539c1b36cd..effb70f7dcba 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -530,7 +530,8 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
kvm_set_pfn_accessed(spte_to_pfn(old_spte));
}
-static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte)
+static inline int __must_check __tdp_mmu_set_spte_atomic(struct tdp_iter *iter,
+ u64 new_spte)
{
u64 *sptep = rcu_dereference(iter->sptep);
@@ -572,9 +573,9 @@ static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte)
* no side-effects other than setting iter->old_spte to the last
* known value of the spte.
*/
-static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm,
- struct tdp_iter *iter,
- u64 new_spte)
+static inline int __must_check tdp_mmu_set_spte_atomic(struct kvm *kvm,
+ struct tdp_iter *iter,
+ u64 new_spte)
{
int ret;
@@ -590,8 +591,8 @@ static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm,
return 0;
}
-static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm,
- struct tdp_iter *iter)
+static inline int __must_check tdp_mmu_zap_spte_atomic(struct kvm *kvm,
+ struct tdp_iter *iter)
{
int ret;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: x86/tdp_mmu: Sprinkle __must_check
2024-06-11 8:11 [PATCH] KVM: x86/tdp_mmu: Sprinkle __must_check Paolo Bonzini
@ 2024-06-11 9:41 ` Huang, Kai
0 siblings, 0 replies; 2+ messages in thread
From: Huang, Kai @ 2024-06-11 9:41 UTC (permalink / raw)
To: kvm, pbonzini, linux-kernel; +Cc: binbin.wu, Yamahata, Isaku
On Tue, 2024-06-11 at 04:11 -0400, Paolo Bonzini wrote:
> From: Isaku Yamahata <isaku.yamahata@intel.com>
>
> 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 <isaku.yamahata@intel.com>
> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
> Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>
Acked-by: Kai Huang <kai.huang@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-11 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 8:11 [PATCH] KVM: x86/tdp_mmu: Sprinkle __must_check Paolo Bonzini
2024-06-11 9:41 ` Huang, Kai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®