* [PATCH] KVM: x86/mmu: Remove the repeated declaration
@ 2021-05-25 2:43 Shaokun Zhang
2021-05-25 16:09 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: Shaokun Zhang @ 2021-05-25 2:43 UTC (permalink / raw)
To: x86, kvm; +Cc: Shaokun Zhang, Ben Gardon, Paolo Bonzini
Function 'is_nx_huge_page_enabled' is declared twice, remove the
repeated declaration.
Cc: Ben Gardon <bgardon@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
arch/x86/kvm/mmu/mmu_internal.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
index d64ccb417c60..54c6e6193ff2 100644
--- a/arch/x86/kvm/mmu/mmu_internal.h
+++ b/arch/x86/kvm/mmu/mmu_internal.h
@@ -158,8 +158,6 @@ int kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
void disallowed_hugepage_adjust(u64 spte, gfn_t gfn, int cur_level,
kvm_pfn_t *pfnp, int *goal_levelp);
-bool is_nx_huge_page_enabled(void);
-
void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc);
void account_huge_nx_page(struct kvm *kvm, struct kvm_mmu_page *sp);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Remove the repeated declaration
2021-05-25 2:43 [PATCH] KVM: x86/mmu: Remove the repeated declaration Shaokun Zhang
@ 2021-05-25 16:09 ` Sean Christopherson
2021-05-26 6:09 ` Shaokun Zhang
0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2021-05-25 16:09 UTC (permalink / raw)
To: Shaokun Zhang; +Cc: x86, kvm, Ben Gardon, Paolo Bonzini
On Tue, May 25, 2021, Shaokun Zhang wrote:
> Function 'is_nx_huge_page_enabled' is declared twice, remove the
> repeated declaration.
>
> Cc: Ben Gardon <bgardon@google.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> ---
> arch/x86/kvm/mmu/mmu_internal.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
> index d64ccb417c60..54c6e6193ff2 100644
> --- a/arch/x86/kvm/mmu/mmu_internal.h
> +++ b/arch/x86/kvm/mmu/mmu_internal.h
> @@ -158,8 +158,6 @@ int kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
> void disallowed_hugepage_adjust(u64 spte, gfn_t gfn, int cur_level,
> kvm_pfn_t *pfnp, int *goal_levelp);
>
> -bool is_nx_huge_page_enabled(void);
Rather than simply delete the extra declaration, what about converting this to
static inline and opportunistically deleting the duplicate? The implementation
is a single operation and this is MMU-internal, i.e. there's no need to export
and limited exposure of nx_huge_pages to other code.
> -
> void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc);
>
> void account_huge_nx_page(struct kvm *kvm, struct kvm_mmu_page *sp);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Remove the repeated declaration
2021-05-25 16:09 ` Sean Christopherson
@ 2021-05-26 6:09 ` Shaokun Zhang
2021-05-26 14:45 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: Shaokun Zhang @ 2021-05-26 6:09 UTC (permalink / raw)
To: Sean Christopherson; +Cc: x86, kvm, Ben Gardon, Paolo Bonzini
Hi Sean,
On 2021/5/26 0:09, Sean Christopherson wrote:
> On Tue, May 25, 2021, Shaokun Zhang wrote:
>> Function 'is_nx_huge_page_enabled' is declared twice, remove the
>> repeated declaration.
>>
>> Cc: Ben Gardon <bgardon@google.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>> ---
>> arch/x86/kvm/mmu/mmu_internal.h | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
>> index d64ccb417c60..54c6e6193ff2 100644
>> --- a/arch/x86/kvm/mmu/mmu_internal.h
>> +++ b/arch/x86/kvm/mmu/mmu_internal.h
>> @@ -158,8 +158,6 @@ int kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
>> void disallowed_hugepage_adjust(u64 spte, gfn_t gfn, int cur_level,
>> kvm_pfn_t *pfnp, int *goal_levelp);
>>
>> -bool is_nx_huge_page_enabled(void);
>
> Rather than simply delete the extra declaration, what about converting this to
> static inline and opportunistically deleting the duplicate? The implementation
It seems that you want to make it static inline in mmu_internal.h, right?
> is a single operation and this is MMU-internal, i.e. there's no need to export
> and limited exposure of nx_huge_pages to other code.
If is_nx_huge_page_enabled is inline in mmu_internal.h, nx_huge_pages will be
external in mmu_internal.h and exposed to other code. Do I miss something?
Thanks,
Shaokun
>
>> -
>> void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc);
>>
>> void account_huge_nx_page(struct kvm *kvm, struct kvm_mmu_page *sp);
>> --
>> 2.7.4
>>
> .
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Remove the repeated declaration
2021-05-26 6:09 ` Shaokun Zhang
@ 2021-05-26 14:45 ` Sean Christopherson
0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2021-05-26 14:45 UTC (permalink / raw)
To: Shaokun Zhang; +Cc: x86, kvm, Ben Gardon, Paolo Bonzini
On Wed, May 26, 2021, Shaokun Zhang wrote:
> Hi Sean,
>
> On 2021/5/26 0:09, Sean Christopherson wrote:
> > Rather than simply delete the extra declaration, what about converting this to
> > static inline and opportunistically deleting the duplicate? The implementation
>
> It seems that you want to make it static inline in mmu_internal.h, right?
Yep.
> > is a single operation and this is MMU-internal, i.e. there's no need to export
> > and limited exposure of nx_huge_pages to other code.
>
> If is_nx_huge_page_enabled is inline in mmu_internal.h, nx_huge_pages will be
> external in mmu_internal.h and exposed to other code. Do I miss something?
Yes, it will be theoretically exposed to other code, but as the name suggests,
mmu_internal.h should not be included by anything outside of mmu/, and of course
we can reject patches that try to access nx_guest_pages directly.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-26 14:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 2:43 [PATCH] KVM: x86/mmu: Remove the repeated declaration Shaokun Zhang
2021-05-25 16:09 ` Sean Christopherson
2021-05-26 6:09 ` Shaokun Zhang
2021-05-26 14:45 ` Sean Christopherson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.