diff mbox series

[1/8] KVM: x86/mmu: Drop unused CMPXCHG macro from paging_tmpl.h

Message ID 20220613225723.2734132-2-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86/mmu: Use separate namespaces gPTEs and SPTEs | expand

Commit Message

Sean Christopherson June 13, 2022, 10:57 p.m. UTC
Drop the CMPXCHG macro from paging_tmpl.h, it's no longer used now that
KVM uses a common uaccess helper to do 8-byte CMPXCHG.

Fixes: f122dfe44768 ("KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits")
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/mmu/paging_tmpl.h | 6 ------
 1 file changed, 6 deletions(-)

Comments

Lai Jiangshan June 14, 2022, 2:13 a.m. UTC | #1
On Tue, Jun 14, 2022 at 6:59 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Drop the CMPXCHG macro from paging_tmpl.h, it's no longer used now that
> KVM uses a common uaccess helper to do 8-byte CMPXCHG.
>
> Fixes: f122dfe44768 ("KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits")
> Signed-off-by: Sean Christopherson <seanjc@google.com>


In https://lore.kernel.org/lkml/20220605063417.308311-2-jiangshanlai@gmail.com/
two other unused macros are also removed.
Sean Christopherson June 14, 2022, 2:31 p.m. UTC | #2
On Tue, Jun 14, 2022, Lai Jiangshan wrote:
> On Tue, Jun 14, 2022 at 6:59 AM Sean Christopherson <seanjc@google.com> wrote:
> >
> > Drop the CMPXCHG macro from paging_tmpl.h, it's no longer used now that
> > KVM uses a common uaccess helper to do 8-byte CMPXCHG.
> >
> > Fixes: f122dfe44768 ("KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits")
> > Signed-off-by: Sean Christopherson <seanjc@google.com>
> 
> 
> In https://lore.kernel.org/lkml/20220605063417.308311-2-jiangshanlai@gmail.com/
> two other unused macros are also removed.

I'd prefer to keep them around as it allows using them to generate the other masks
that are used.

My apologies for colliding with your series, I saw it flash by but didn't look at
what it contained.  If it's ok with you, I'll grab patches 1-3 from your series,
tweak patch 1 to drop only CMPXCH, and send them as the basis of v2 for the rest
of the patches in this series.
Paolo Bonzini June 14, 2022, 5:10 p.m. UTC | #3
On 6/14/22 04:13, Lai Jiangshan wrote:
> On Tue, Jun 14, 2022 at 6:59 AM Sean Christopherson <seanjc@google.com> wrote:
>>
>> Drop the CMPXCHG macro from paging_tmpl.h, it's no longer used now that
>> KVM uses a common uaccess helper to do 8-byte CMPXCHG.
>>
>> Fixes: f122dfe44768 ("KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits")
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
> 
> 
> In https://lore.kernel.org/lkml/20220605063417.308311-2-jiangshanlai@gmail.com/
> two other unused macros are also removed.
> 

Queued that one, thanks!

Paolo
Paolo Bonzini June 14, 2022, 5:12 p.m. UTC | #4
On 6/14/22 16:31, Sean Christopherson wrote:
> I'd prefer to keep them around as it allows using them to generate the other masks
> that are used.

Ok, I see what you're doing in patch 6.  Yeah, I'll wait for v2.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
index fe35d8fd3276..f595c4b8657f 100644
--- a/arch/x86/kvm/mmu/paging_tmpl.h
+++ b/arch/x86/kvm/mmu/paging_tmpl.h
@@ -34,7 +34,6 @@ 
 	#define PT_HAVE_ACCESSED_DIRTY(mmu) true
 	#ifdef CONFIG_X86_64
 	#define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL
-	#define CMPXCHG "cmpxchgq"
 	#else
 	#define PT_MAX_FULL_LEVELS 2
 	#endif
@@ -51,7 +50,6 @@ 
 	#define PT_GUEST_DIRTY_SHIFT PT_DIRTY_SHIFT
 	#define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT
 	#define PT_HAVE_ACCESSED_DIRTY(mmu) true
-	#define CMPXCHG "cmpxchgl"
 #elif PTTYPE == PTTYPE_EPT
 	#define pt_element_t u64
 	#define guest_walker guest_walkerEPT
@@ -64,9 +62,6 @@ 
 	#define PT_GUEST_DIRTY_SHIFT 9
 	#define PT_GUEST_ACCESSED_SHIFT 8
 	#define PT_HAVE_ACCESSED_DIRTY(mmu) (!(mmu)->cpu_role.base.ad_disabled)
-	#ifdef CONFIG_X86_64
-	#define CMPXCHG "cmpxchgq"
-	#endif
 	#define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL
 #else
 	#error Invalid PTTYPE value
@@ -1100,7 +1095,6 @@  static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
 #undef PT_MAX_FULL_LEVELS
 #undef gpte_to_gfn
 #undef gpte_to_gfn_lvl
-#undef CMPXCHG
 #undef PT_GUEST_ACCESSED_MASK
 #undef PT_GUEST_DIRTY_MASK
 #undef PT_GUEST_DIRTY_SHIFT