* [PATCH 01/14] KVM: x86: Remove unnecessary export of kvm_cpu_has_pending_timer()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-11-14 9:55 ` [PATCH 02/14] KVM: x86: Remove unnecessary export of kvm_inject_pending_timer_irqs() Like Xu
` (13 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Sean Christopherson <seanjc@google.com>
Don't export x86's kvm_cpu_has_pending_timer(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/irq.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index d8d50558f165..04a009fbdf8a 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -31,7 +31,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
return r;
}
-EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
/*
* check if there is a pending userspace external interrupt
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 02/14] KVM: x86: Remove unnecessary export of kvm_inject_pending_timer_irqs()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
2022-11-14 9:55 ` [PATCH 01/14] KVM: x86: Remove unnecessary export of kvm_cpu_has_pending_timer() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-11-14 9:55 ` [PATCH 03/14] KVM: x86: Remove unnecessary export of kvm_get_apic_base() Like Xu
` (12 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_inject_pending_timer_irqs(), the helper isn't used
by KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/irq.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 04a009fbdf8a..a70952eca905 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -149,7 +149,6 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
if (kvm_xen_timer_enabled(vcpu))
kvm_xen_inject_timer_irqs(vcpu);
}
-EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 03/14] KVM: x86: Remove unnecessary export of kvm_get_apic_base()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
2022-11-14 9:55 ` [PATCH 01/14] KVM: x86: Remove unnecessary export of kvm_cpu_has_pending_timer() Like Xu
2022-11-14 9:55 ` [PATCH 02/14] KVM: x86: Remove unnecessary export of kvm_inject_pending_timer_irqs() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-11-14 9:55 ` [PATCH 04/14] KVM: x86: Remove unnecessary export of kvm_set_apic_base() Like Xu
` (11 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_get_apic_base(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e46e458c5b08..1c5a675dc04a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -463,7 +463,6 @@ u64 kvm_get_apic_base(struct kvm_vcpu *vcpu)
{
return vcpu->arch.apic_base;
}
-EXPORT_SYMBOL_GPL(kvm_get_apic_base);
enum lapic_mode kvm_get_apic_mode(struct kvm_vcpu *vcpu)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 04/14] KVM: x86: Remove unnecessary export of kvm_set_apic_base()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (2 preceding siblings ...)
2022-11-14 9:55 ` [PATCH 03/14] KVM: x86: Remove unnecessary export of kvm_get_apic_base() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-11-14 9:55 ` [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault() Like Xu
` (10 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_set_apic_base(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1c5a675dc04a..38a42ca86ab2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -490,7 +490,6 @@ int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
kvm_recalculate_apic_map(vcpu->kvm);
return 0;
}
-EXPORT_SYMBOL_GPL(kvm_set_apic_base);
/*
* Handle a fault on a hardware virtualization (VMX or SVM) instruction.
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (3 preceding siblings ...)
2022-11-14 9:55 ` [PATCH 04/14] KVM: x86: Remove unnecessary export of kvm_set_apic_base() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-12-01 2:04 ` Sean Christopherson
2022-11-14 9:55 ` [PATCH 06/14] KVM: x86: Remove unnecessary export of kvm_inject_nmi() Like Xu
` (9 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_inject_page_fault(), the helper isn't used by
KVM x86's vendor modules. Add declaration to header file out of
existing callers' need.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
arch/x86/kvm/x86.h | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 38a42ca86ab2..818aff135261 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -774,7 +774,6 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault)
kvm_queue_exception_e_p(vcpu, PF_VECTOR, fault->error_code,
fault->address);
}
-EXPORT_SYMBOL_GPL(kvm_inject_page_fault);
void kvm_inject_emulated_page_fault(struct kvm_vcpu *vcpu,
struct x86_exception *fault)
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 9de72586f406..69811b4f3eac 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -307,6 +307,7 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type,
int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
int emulation_type, void *insn, int insn_len);
fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu);
+void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
extern u64 host_xcr0;
extern u64 host_xss;
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault()
2022-11-14 9:55 ` [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault() Like Xu
@ 2022-12-01 2:04 ` Sean Christopherson
2022-12-01 2:08 ` Like Xu
0 siblings, 1 reply; 21+ messages in thread
From: Sean Christopherson @ 2022-12-01 2:04 UTC (permalink / raw)
To: Like Xu; +Cc: Paolo Bonzini, kvm, linux-kernel
On Mon, Nov 14, 2022, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
>
> Don't export x86's kvm_inject_page_fault(), the helper isn't used by
> KVM x86's vendor modules. Add declaration to header file out of
> existing callers' need.
...
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 9de72586f406..69811b4f3eac 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -307,6 +307,7 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type,
> int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
> int emulation_type, void *insn, int insn_len);
> fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu);
> +void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
arch/x86/include/asm/kvm_host.h already has a definition, no need for one here.
The definition could obviously be moved, but I'd prefer not to bother at this time
as I want to move _all_ of kvm_host.h out of the "public" include directories (WIP).
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault()
2022-12-01 2:04 ` Sean Christopherson
@ 2022-12-01 2:08 ` Like Xu
0 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-12-01 2:08 UTC (permalink / raw)
To: Sean Christopherson; +Cc: Paolo Bonzini, kvm, linux-kernel
On 1/12/2022 10:04 am, Sean Christopherson wrote:
> On Mon, Nov 14, 2022, Like Xu wrote:
>> From: Like Xu <likexu@tencent.com>
>>
>> Don't export x86's kvm_inject_page_fault(), the helper isn't used by
>> KVM x86's vendor modules. Add declaration to header file out of
>> existing callers' need.
>
> ...
>
>> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
>> index 9de72586f406..69811b4f3eac 100644
>> --- a/arch/x86/kvm/x86.h
>> +++ b/arch/x86/kvm/x86.h
>> @@ -307,6 +307,7 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type,
>> int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
>> int emulation_type, void *insn, int insn_len);
>> fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu);
>> +void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
>
> arch/x86/include/asm/kvm_host.h already has a definition, no need for one here.
> The definition could obviously be moved, but I'd prefer not to bother at this time
> as I want to move _all_ of kvm_host.h out of the "public" include directories (WIP).
Great, we may need more decoupling at the code level.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 06/14] KVM: x86: Remove unnecessary export of kvm_inject_nmi()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (4 preceding siblings ...)
2022-11-14 9:55 ` [PATCH 05/14] KVM: x86: Remove unnecessary export of kvm_inject_page_fault() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-12-01 2:04 ` Sean Christopherson
2022-11-14 9:55 ` [PATCH 07/14] KVM: x86: Remove unnecessary export of kvm_require_cpl() Like Xu
` (8 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_inject_nmi(), the helper isn't used by
KVM x86's vendor modules. Add declaration to header file out of
existing callers' need.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
arch/x86/kvm/x86.h | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 818aff135261..c03e599166b8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -802,7 +802,6 @@ void kvm_inject_nmi(struct kvm_vcpu *vcpu)
atomic_inc(&vcpu->arch.nmi_queued);
kvm_make_request(KVM_REQ_NMI, vcpu);
}
-EXPORT_SYMBOL_GPL(kvm_inject_nmi);
void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
{
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 69811b4f3eac..c5ff5b05af49 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -308,6 +308,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
int emulation_type, void *insn, int insn_len);
fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu);
void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
+void kvm_inject_nmi(struct kvm_vcpu *vcpu);
extern u64 host_xcr0;
extern u64 host_xss;
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 06/14] KVM: x86: Remove unnecessary export of kvm_inject_nmi()
2022-11-14 9:55 ` [PATCH 06/14] KVM: x86: Remove unnecessary export of kvm_inject_nmi() Like Xu
@ 2022-12-01 2:04 ` Sean Christopherson
0 siblings, 0 replies; 21+ messages in thread
From: Sean Christopherson @ 2022-12-01 2:04 UTC (permalink / raw)
To: Like Xu; +Cc: Paolo Bonzini, kvm, linux-kernel
On Mon, Nov 14, 2022, Like Xu wrote:
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 69811b4f3eac..c5ff5b05af49 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -308,6 +308,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
> int emulation_type, void *insn, int insn_len);
> fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu);
> void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
> +void kvm_inject_nmi(struct kvm_vcpu *vcpu);
Same as the previous patch, kvm_inject_nmi() is declared by kvm_host.h.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 07/14] KVM: x86: Remove unnecessary export of kvm_require_cpl()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (5 preceding siblings ...)
2022-11-14 9:55 ` [PATCH 06/14] KVM: x86: Remove unnecessary export of kvm_inject_nmi() Like Xu
@ 2022-11-14 9:55 ` Like Xu
2022-11-14 9:56 ` [PATCH 08/14] KVM: x86: Remove unnecessary export of kvm_emulate_as_nop() Like Xu
` (7 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:55 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_require_cpl(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c03e599166b8..ee63b5ab507d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -826,7 +826,6 @@ bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl)
kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
return false;
}
-EXPORT_SYMBOL_GPL(kvm_require_cpl);
bool kvm_require_dr(struct kvm_vcpu *vcpu, int dr)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 08/14] KVM: x86: Remove unnecessary export of kvm_emulate_as_nop()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (6 preceding siblings ...)
2022-11-14 9:55 ` [PATCH 07/14] KVM: x86: Remove unnecessary export of kvm_require_cpl() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-11-14 9:56 ` [PATCH 09/14] KVM: x86: Remove unnecessary export of kvm_scale_tsc() Like Xu
` (6 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_emulate_as_nop(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ee63b5ab507d..41b6361dde62 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2058,7 +2058,6 @@ int kvm_emulate_as_nop(struct kvm_vcpu *vcpu)
{
return kvm_skip_emulated_instruction(vcpu);
}
-EXPORT_SYMBOL_GPL(kvm_emulate_as_nop);
int kvm_emulate_invd(struct kvm_vcpu *vcpu)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 09/14] KVM: x86: Remove unnecessary export of kvm_scale_tsc()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (7 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 08/14] KVM: x86: Remove unnecessary export of kvm_emulate_as_nop() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-11-14 9:56 ` [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp() Like Xu
` (5 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_scale_tsc(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 41b6361dde62..f325710a4f25 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2503,7 +2503,6 @@ u64 kvm_scale_tsc(u64 tsc, u64 ratio)
return _tsc;
}
-EXPORT_SYMBOL_GPL(kvm_scale_tsc);
static u64 kvm_compute_l1_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (8 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 09/14] KVM: x86: Remove unnecessary export of kvm_scale_tsc() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-12-01 2:07 ` Sean Christopherson
2022-12-02 18:31 ` Paolo Bonzini
2022-11-14 9:56 ` [PATCH 11/14] KVM: x86: Remove unnecessary export of kvm_hv_assist_page_enabled() Like Xu
` (4 subsequent siblings)
14 siblings, 2 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
KVM x86's vendor modules. Move up the code block out of existing
callers' need.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/x86.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f325710a4f25..f3cb3e02bfa6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11496,6 +11496,11 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
return static_call(kvm_x86_vcpu_precreate)(kvm);
}
+bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
+{
+ return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
+}
+
int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
{
struct page *page;
@@ -11993,12 +11998,6 @@ int kvm_arch_check_processor_compat(void *opaque)
return ops->check_processor_compatibility();
}
-bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
-{
- return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
-}
-EXPORT_SYMBOL_GPL(kvm_vcpu_is_reset_bsp);
-
bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
{
return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp()
2022-11-14 9:56 ` [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp() Like Xu
@ 2022-12-01 2:07 ` Sean Christopherson
2022-12-02 18:31 ` Paolo Bonzini
1 sibling, 0 replies; 21+ messages in thread
From: Sean Christopherson @ 2022-12-01 2:07 UTC (permalink / raw)
To: Like Xu; +Cc: Paolo Bonzini, kvm, linux-kernel
On Mon, Nov 14, 2022, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
>
> Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
> KVM x86's vendor modules. Move up the code block out of existing
> callers' need.
Again, no. kvm_vcpu_is_reset_bsp() is declared by kvm_vcpu_is_reset_bsp(). The
lack of "static" is the first clue, and the fact that KVM compiles without issue
today is the second clue. EXPORT_SYMBOL_GPL() only affects resolving module
dependencies, it doesn't provide any information to the compiler about function
prototypes.
> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
> arch/x86/kvm/x86.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index f325710a4f25..f3cb3e02bfa6 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -11496,6 +11496,11 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
> return static_call(kvm_x86_vcpu_precreate)(kvm);
> }
>
> +bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
> +{
> + return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
> +}
> +
> int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
> {
> struct page *page;
> @@ -11993,12 +11998,6 @@ int kvm_arch_check_processor_compat(void *opaque)
> return ops->check_processor_compatibility();
> }
>
> -bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
> -{
> - return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
> -}
> -EXPORT_SYMBOL_GPL(kvm_vcpu_is_reset_bsp);
> -
> bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
> {
> return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
> --
> 2.38.1
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp()
2022-11-14 9:56 ` [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp() Like Xu
2022-12-01 2:07 ` Sean Christopherson
@ 2022-12-02 18:31 ` Paolo Bonzini
1 sibling, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2022-12-02 18:31 UTC (permalink / raw)
To: Like Xu, Sean Christopherson; +Cc: kvm, linux-kernel
On 11/14/22 10:56, Like Xu wrote:
>
> Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
> KVM x86's vendor modules. Move up the code block out of existing
> callers' need.
I'm not sure why to move the code up?
Paolo
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 11/14] KVM: x86: Remove unnecessary export of kvm_hv_assist_page_enabled()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (9 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-11-14 9:56 ` [PATCH 12/14] KVM: x86: Remove unnecessary export of kvm_can_use_hv_timer() Like Xu
` (3 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_hv_assist_page_enabled(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/hyperv.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 0adf4a437e85..072303aa4e42 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -895,7 +895,6 @@ bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu)
return false;
return vcpu->arch.pv_eoi.msr_val & KVM_MSR_ENABLED;
}
-EXPORT_SYMBOL_GPL(kvm_hv_assist_page_enabled);
bool kvm_hv_get_assist_page(struct kvm_vcpu *vcpu,
struct hv_vp_assist_page *assist_page)
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 12/14] KVM: x86: Remove unnecessary export of kvm_can_use_hv_timer()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (10 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 11/14] KVM: x86: Remove unnecessary export of kvm_hv_assist_page_enabled() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-11-14 9:56 ` [PATCH 13/14] KVM: x86: Remove unnecessary export of kvm_lapic_hv_timer_in_use() Like Xu
` (2 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_can_use_hv_timer(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/lapic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 1bb63746e991..5243e619fb0d 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -160,7 +160,6 @@ bool kvm_can_use_hv_timer(struct kvm_vcpu *vcpu)
&& !(kvm_mwait_in_guest(vcpu->kvm) ||
kvm_can_post_timer_interrupt(vcpu));
}
-EXPORT_SYMBOL_GPL(kvm_can_use_hv_timer);
static bool kvm_use_posted_timer_interrupt(struct kvm_vcpu *vcpu)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 13/14] KVM: x86: Remove unnecessary export of kvm_lapic_hv_timer_in_use()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (11 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 12/14] KVM: x86: Remove unnecessary export of kvm_can_use_hv_timer() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-11-14 9:56 ` [PATCH 14/14] KVM: x86: Remove unnecessary export of kvm_apic_update_apicv() Like Xu
2022-12-02 18:37 ` [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Paolo Bonzini
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_lapic_hv_timer_in_use(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/lapic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 5243e619fb0d..f59e7db2af2f 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1913,7 +1913,6 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
return vcpu->arch.apic->lapic_timer.hv_timer_in_use;
}
-EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use);
static void cancel_hv_timer(struct kvm_lapic *apic)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 14/14] KVM: x86: Remove unnecessary export of kvm_apic_update_apicv()
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (12 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 13/14] KVM: x86: Remove unnecessary export of kvm_lapic_hv_timer_in_use() Like Xu
@ 2022-11-14 9:56 ` Like Xu
2022-12-02 18:37 ` [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Paolo Bonzini
14 siblings, 0 replies; 21+ messages in thread
From: Like Xu @ 2022-11-14 9:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel
From: Like Xu <likexu@tencent.com>
Don't export x86's kvm_apic_update_apicv(), the helper isn't used by
KVM x86's vendor modules.
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/kvm/lapic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index f59e7db2af2f..b55042462d39 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2430,7 +2430,6 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu)
apic->isr_count = count_vectors(apic->regs + APIC_ISR);
}
}
-EXPORT_SYMBOL_GPL(kvm_apic_update_apicv);
void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
{
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols
2022-11-14 9:55 [PATCH 00/14] KVM: x86: Remove unnecessary exported symbols Like Xu
` (13 preceding siblings ...)
2022-11-14 9:56 ` [PATCH 14/14] KVM: x86: Remove unnecessary export of kvm_apic_update_apicv() Like Xu
@ 2022-12-02 18:37 ` Paolo Bonzini
14 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2022-12-02 18:37 UTC (permalink / raw)
To: Like Xu, Sean Christopherson; +Cc: kvm, linux-kernel
On 11/14/22 10:55, Like Xu wrote:
> Inspired by the Sean's minor fix [1], more unnecessary (from a GPL
> developer's perspective) exported symbols could be cleaned up
> (automation to find out true positives is possible). This move helps reduce
> the attack surface of KVM modules and guides more developers to practice
> the principle of low coupling in the KVM context.
>
> [1] https://lore.kernel.org/kvm/20221110010354.1342128-1-seanjc@google.com/
I'll squash everything in a single patch and limit the change to just
removing EXPORT_SYMBOL_GPL().
Paolo
> Like Xu (13):
> KVM: x86: Remove unnecessary export of kvm_inject_pending_timer_irqs()
> KVM: x86: Remove unnecessary export of kvm_get_apic_base()
> KVM: x86: Remove unnecessary export of kvm_set_apic_base()
> KVM: x86: Remove unnecessary export of kvm_inject_page_fault()
> KVM: x86: Remove unnecessary export of kvm_inject_nmi()
> KVM: x86: Remove unnecessary export of kvm_require_cpl()
> KVM: x86: Remove unnecessary export of kvm_emulate_as_nop()
> KVM: x86: Remove unnecessary export of kvm_scale_tsc()
> KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp()
> KVM: x86: Remove unnecessary export of kvm_hv_assist_page_enabled()
> KVM: x86: Remove unnecessary export of kvm_can_use_hv_timer()
> KVM: x86: Remove unnecessary export of kvm_lapic_hv_timer_in_use()
> KVM: x86: Remove unnecessary export of kvm_apic_update_apicv()
>
> Sean Christopherson (1):
> KVM: x86: Remove unnecessary export of kvm_cpu_has_pending_timer()
>
> arch/x86/kvm/hyperv.c | 1 -
> arch/x86/kvm/irq.c | 2 --
> arch/x86/kvm/lapic.c | 3 ---
> arch/x86/kvm/x86.c | 18 +++++-------------
> arch/x86/kvm/x86.h | 2 ++
> 5 files changed, 7 insertions(+), 19 deletions(-)
>
^ permalink raw reply [flat|nested] 21+ messages in thread