[PATCH] kvm/kvm-all: declare kvm_park_vcpu static and make it local to kvm-all.c

Ani Sinha posted 1 patch 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250815053021.31427-1-anisinha@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c  | 3 ++-
include/system/kvm.h | 8 --------
2 files changed, 2 insertions(+), 9 deletions(-)
[PATCH] kvm/kvm-all: declare kvm_park_vcpu static and make it local to kvm-all.c
Posted by Ani Sinha 3 months ago
kvm_park_vcpu() is only used in kvm-all.c. Declare it static, remove it from
common header file and make it local to kvm-all.c

Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 accel/kvm/kvm-all.c  | 3 ++-
 include/system/kvm.h | 8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 890d5ea9f8..41cf606ca8 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -141,6 +141,7 @@ static QemuMutex kml_slots_lock;
 #define kvm_slots_unlock()  qemu_mutex_unlock(&kml_slots_lock)
 
 static void kvm_slot_init_dirty_bitmap(KVMSlot *mem);
+static void kvm_park_vcpu(CPUState *cpu);
 
 static inline void kvm_resample_fd_remove(int gsi)
 {
@@ -414,7 +415,7 @@ err:
     return ret;
 }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
 {
     struct KVMParkedVcpu *vcpu;
 
diff --git a/include/system/kvm.h b/include/system/kvm.h
index 3c7d314736..c7fd7533bb 100644
--- a/include/system/kvm.h
+++ b/include/system/kvm.h
@@ -317,14 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
  */
 bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
 /**
  * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
  * @s: KVM State
-- 
2.50.1
Re: [PATCH] kvm/kvm-all: declare kvm_park_vcpu static and make it local to kvm-all.c
Posted by Richard Henderson 3 months ago
On 8/15/25 15:30, Ani Sinha wrote:
> kvm_park_vcpu() is only used in kvm-all.c. Declare it static, remove it from
> common header file and make it local to kvm-all.c
> 
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>   accel/kvm/kvm-all.c  | 3 ++-
>   include/system/kvm.h | 8 --------
>   2 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 890d5ea9f8..41cf606ca8 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -141,6 +141,7 @@ static QemuMutex kml_slots_lock;
>   #define kvm_slots_unlock()  qemu_mutex_unlock(&kml_slots_lock)
>   
>   static void kvm_slot_init_dirty_bitmap(KVMSlot *mem);
> +static void kvm_park_vcpu(CPUState *cpu);
>   

No need for this, since the definition precedes all uses.
You can also unexport kvm_unpark_vcpu.


r~