kvm: make local functions static
PATCH 1/2 kvm: make local functions static
Running 'make namespacecheck' found lots of functions that should be declared static, since only used in one file.
--- include/linux/kvm_host.h | 16 ---------------- virt/kvm/ioapic.c | 2 +- virt/kvm/ioapic.h | 1 - virt/kvm/kvm_main.c | 35 ++++++++++++++++++----------------- 4 files changed, 19 insertions(+), 35 deletions(-)
include/linux/kvm_host.h +0 -16
@@ -463,8 +463,6 @@ void kvm_exit(void);void kvm_get_kvm (struct kvm *kvm);void kvm_put_kvm (struct kvm *kvm); -void update_memslots (struct kvm_memslots *slots,struct kvm_memory_slot *new, -u64 last_generation);static inline struct kvm_memslots *kvm_memslots (struct kvm *kvm) {
@@ -537,7 +535,6 @@ unsigned long gfn_to_hva_prot(struct kvmunsigned long gfn_to_hva_memslot (struct kvm_memory_slot *slot,gfn_t gfn);void kvm_release_page_clean (struct page *page);void kvm_release_page_dirty (struct page *page); -void kvm_set_page_dirty (struct page *page);void kvm_set_page_accessed (struct page *page);pfn_t gfn_to_pfn_atomic (struct kvm *kvm,gfn_t gfn);
@@ -549,7 +546,6 @@ pfn_t gfn_to_pfn_prot(struct kvm *kvm, gpfn_t gfn_to_pfn_memslot (struct kvm_memory_slot *slot,gfn_t gfn);pfn_t gfn_to_pfn_memslot_atomic (struct kvm_memory_slot *slot,gfn_t gfn); -void kvm_release_pfn_dirty (pfn_t pfn);void kvm_release_pfn_clean (pfn_t pfn);void kvm_set_pfn_dirty (pfn_t pfn);void kvm_set_pfn_accessed (pfn_t pfn);
@@ -576,8 +572,6 @@ struct kvm_memory_slot *gfn_to_memslot(sint kvm_is_visible_gfn (struct kvm *kvm,gfn_t gfn);unsigned long kvm_host_page_size (struct kvm *kvm,gfn_t gfn);void mark_page_dirty (struct kvm *kvm,gfn_t gfn); -void mark_page_dirty_in_slot (struct kvm *kvm,struct kvm_memory_slot *memslot, -gfn_t gfn);void kvm_vcpu_block (struct kvm_vcpu *vcpu);void kvm_vcpu_kick (struct kvm_vcpu *vcpu);
@@ -605,8 +599,6 @@ int kvm_get_dirty_log(struct kvm *kvm,int kvm_vm_ioctl_get_dirty_log (struct kvm *kvm,struct kvm_dirty_log *log); -int kvm_vm_ioctl_set_memory_region (struct kvm *kvm, -struct kvm_userspace_memory_region *mem);int kvm_vm_ioctl_irq_line (struct kvm *kvm,struct kvm_irq_level *irq_level,bool line_status); long kvm_arch_vm_ioctl(struct file *filp,
@@ -654,8 +646,6 @@ void kvm_arch_check_processor_compat(voiint kvm_arch_vcpu_runnable (struct kvm_vcpu *vcpu);int kvm_arch_vcpu_should_kick (struct kvm_vcpu *vcpu); -void kvm_free_physmem (struct kvm *kvm); -void *kvm_kvzalloc (unsigned long size);void kvm_kvfree (const void *addr);
@@ -1097,12 +1087,6 @@ static inline void kvm_vcpu_set_in_spin_static inline void kvm_vcpu_set_dy_eligible (struct kvm_vcpu *vcpu,bool val) { } - -static inline bool kvm_vcpu_eligible_for_directed_yield (struct kvm_vcpu *vcpu) -{ -return true; -} -#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ #endif
virt/kvm/kvm_main.c +18 -17
@@ -95,6 +95,12 @@ static int hardware_enable_all(void);static void hardware_disable_all (void );static void kvm_io_bus_destroy (struct kvm_io_bus *bus); +static void update_memslots (struct kvm_memslots *slots, +struct kvm_memory_slot *new,u64 last_generation); + +static void kvm_release_pfn_dirty (pfn_t pfn); +static void mark_page_dirty_in_slot (struct kvm *kvm, +struct kvm_memory_slot *memslot,gfn_t gfn);bool kvm_rebooting;EXPORT_SYMBOL_GPL (kvm_rebooting);
@@ -553,7 +559,7 @@ static void kvm_free_physmem_slot(struct free->npages =0 ; } -void kvm_free_physmem (struct kvm *kvm) +static void kvm_free_physmem (struct kvm *kvm) {struct kvm_memslots *slots = kvm->memslots;struct kvm_memory_slot *memslot;
@@ -675,8 +681,9 @@ static void sort_memslots(struct kvm_mem slots->id_to_index[slots->memslots[i].id] = i; } -void update_memslots (struct kvm_memslots *slots,struct kvm_memory_slot *new, -u64 last_generation) +static void update_memslots (struct kvm_memslots *slots, +struct kvm_memory_slot *new, +u64 last_generation) {if (new) {int id = new->id;
@@ -924,8 +931,8 @@ int kvm_set_memory_region(struct kvm *kv }EXPORT_SYMBOL_GPL (kvm_set_memory_region); -int kvm_vm_ioctl_set_memory_region (struct kvm *kvm, -struct kvm_userspace_memory_region *mem) +static int kvm_vm_ioctl_set_memory_region (struct kvm *kvm, +struct kvm_userspace_memory_region *mem) {if (mem->slot >=KVM_USER_MEM_SLOTS )return -EINVAL ;
@@ -1047,7 +1054,7 @@ static unsigned long gfn_to_hva_many(str }unsigned long gfn_to_hva_memslot (struct kvm_memory_slot *slot, -gfn_t gfn) +gfn_t gfn) {return gfn_to_hva_many (slot, gfn,NULL ); }
@@ -1387,18 +1394,11 @@ void kvm_release_page_dirty(struct page }EXPORT_SYMBOL_GPL (kvm_release_page_dirty); -void kvm_release_pfn_dirty (pfn_t pfn) +static void kvm_release_pfn_dirty (pfn_t pfn) {kvm_set_pfn_dirty (pfn);kvm_release_pfn_clean (pfn); } -EXPORT_SYMBOL_GPL (kvm_release_pfn_dirty); - -void kvm_set_page_dirty (struct page *page) -{ -kvm_set_pfn_dirty (page_to_pfn (page)); -} -EXPORT_SYMBOL_GPL (kvm_set_page_dirty);void kvm_set_pfn_dirty (pfn_t pfn) {
@@ -1640,8 +1640,9 @@ int kvm_clear_guest(struct kvm *kvm, gpa }EXPORT_SYMBOL_GPL (kvm_clear_guest); -void mark_page_dirty_in_slot (struct kvm *kvm,struct kvm_memory_slot *memslot, -gfn_t gfn) +static void mark_page_dirty_in_slot (struct kvm *kvm, +struct kvm_memory_slot *memslot, +gfn_t gfn) {if (memslot && memslot->dirty_bitmap) {unsigned long rel_gfn = gfn - memslot->base_gfn;
@@ -1765,7 +1766,7 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_yield_to);* locking does not harm. It may result in trying to yield to same VCPU, fail * and continue with next VCPU and so on. */ -bool kvm_vcpu_eligible_for_directed_yield (struct kvm_vcpu *vcpu) +static bool kvm_vcpu_eligible_for_directed_yield (struct kvm_vcpu *vcpu) {bool eligible;
virt/kvm/ioapic.c +1 -1
@@ -520,7 +520,7 @@ static int ioapic_mmio_write(struct kvm_return 0 ; } -void kvm_ioapic_reset (struct kvm_ioapic *ioapic) +static void kvm_ioapic_reset (struct kvm_ioapic *ioapic) {int i;
virt/kvm/ioapic.h +0 -1
@@ -91,7 +91,6 @@ void kvm_ioapic_destroy(struct kvm *kvm)int kvm_ioapic_set_irq (struct kvm_ioapic *ioapic,int irq,int irq_source_id,int level,bool line_status);void kvm_ioapic_clear_all (struct kvm_ioapic *ioapic,int irq_source_id); -void kvm_ioapic_reset (struct kvm_ioapic *ioapic);int kvm_irq_delivery_to_apic (struct kvm *kvm,struct kvm_lapic *src,struct kvm_lapic_irq *irq,unsigned long *dest_map);int kvm_get_ioapic (struct kvm *kvm,struct kvm_ioapic_state *state);
PATCH 2/2 kvm: remove dead code
The function kvm_io_bus_read_cookie is defined but never used in current in-tree code.
include/linux/kvm_host.h +0 -2
@@ -172,8 +172,6 @@ int kvm_io_bus_write_cookie(struct kvm * int len, const void *val, long cookie);int kvm_io_bus_read (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,void *val); -int kvm_io_bus_read_cookie (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr, -int len,void *val,long cookie);int kvm_io_bus_register_dev (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,struct kvm_io_device *dev); int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
virt/kvm/kvm_main.c +0 -27
@@ -2937,33 +2937,6 @@ int kvm_io_bus_read(struct kvm *kvm, enureturn r <0 ? r :0 ; } -/* kvm_io_bus_read_cookie - called under kvm->slots_lock */ -int kvm_io_bus_read_cookie (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr, -int len,void *val,long cookie) -{ -struct kvm_io_bus *bus; -struct kvm_io_range range; - - range = (struct kvm_io_range ) { - .addr = addr, - .len = len, - }; - - bus =srcu_dereference (kvm->buses[bus_idx], &kvm->srcu); - -/* First try the device referenced by cookie. */ -if ((cookie >=0 ) && (cookie < bus->dev_count) && - (kvm_io_bus_cmp (&range, &bus->range[cookie]) ==0 )) -if (!kvm_iodevice_read (bus->range[cookie].dev, addr, len, - val)) -return cookie; - -/* -* cookie contained garbage; fall back to search and return the -* correct cookie value. -*/ -return __kvm_io_bus_read (bus, &range, val); -}/* Caller must hold slots_lock. */ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
Re: [PATCH kvm-next 2/2] kvm: remove dead code
Quoted 3 lines · Stephen Hemminger
The function
kvm_io_bus_read_cookieis defined but never used in current in-tree code.
It was added recently by Cornelia (copied) with intention to be used in s390 code. I assume the intention is still there.
Quoted 40 lines
Signed-off-by Stephen Hemminger <[email protected]>include/linux/kvm_host.h +0
-2@@ -172,8 +172,6 @@ int kvm_io_bus_write_cookie(struct kvm * int len, const void *val, long cookie);int kvm_io_bus_read (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,void *val); -int kvm_io_bus_read_cookie (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr, -int len,void *val,long cookie);int kvm_io_bus_register_dev (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,struct kvm_io_device *dev); int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,virt/kvm/kvm_main.c +0
-20@@ -2937,33 +2937,6 @@ int kvm_io_bus_read(struct kvm *kvm, enureturn r <0 ? r :0 ; } -/* kvm_io_bus_read_cookie - called under kvm->slots_lock */ -int kvm_io_bus_read_cookie (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr, -int len,void *val,long cookie) -{ -struct kvm_io_bus *bus; -struct kvm_io_range range; - - range = (struct kvm_io_range ) { - .addr = addr, - .len = len, - }; - - bus =srcu_dereference (kvm->buses[bus_idx], &kvm->srcu); - -/* First try the device referenced by cookie. */ -if ((cookie >=0 ) && (cookie < bus->dev_count) && - (kvm_io_bus_cmp (&range, &bus->range[cookie]) ==0 )) -if (!kvm_iodevice_read (bus->range[cookie].dev, addr, len, - val)) -return cookie;
virt/kvm/kvm_main.c int kvm_io_bus_read(struct kvm *kvm, enu · line 2942
Quoted 10 lines
virt/kvm/kvm_main.c +0
-7- -/* -* cookie contained garbage; fall back to search and return the -* correct cookie value. -*/ -return __kvm_io_bus_read (bus, &range, val); -}/* Caller must hold slots_lock. */ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
--
Gleb.
Re: [PATCH kvm-next 2/2] kvm: remove dead code
Quoted 6 lines · On Mon, 30 Dec 2013 09:37:15 +0200 Gleb Natapov <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
The function
kvm_io_bus_read_cookieis defined but never used in current in-tree code.It was added recently by Cornelia (copied) with intention to be used in s390 code. I assume the intention is still there.
The normal process is that the code is added in one patch just before the code that uses it. Rather than the "if we build it they will come" philosophy.
Paolo Bonzini
maintainerRe: [PATCH kvm-next 2/2] kvm: remove dead code
Il 30/12/2013 23:27, Stephen Hemminger ha scritto:
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
It was added recently by Cornelia (copied) with intention to be used in s390 code. I assume the intention is still there.
The normal process is that the code is added in one patch just before the code that uses it. Rather than the "if we build it they will come" philosophy.
I'm fairly sure that was not the intention; rather, "we built it but we haven't sent a pull request for whatever reason".
Paolo
Re: [PATCH kvm-next 2/2] kvm: remove dead code
Quoted 9 lines · On Tue, 31 Dec 2013 16:18:40 +0100 Paolo Bonzini <[email protected]> wrote:
Il 30/12/2013 23:27, Stephen Hemminger ha scritto:
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
It was added recently by Cornelia (copied) with intention to be used in s390 code. I assume the intention is still there.
The normal process is that the code is added in one patch just before the code that uses it. Rather than the "if we build it they will come" philosophy.
I'm fairly sure that was not the intention; rather, "we built it but we haven't sent a pull request for whatever reason".
Actually, the intention was "let read offer the same interfaces as write". I currently don't see any usage of the read interface from my side; if you prefer to remove it, I won't object.
Marcelo Tosatti
AppliedQuoted 4 lines · Stephen Hemminger
Running 'make namespacecheck' found lots of functions that should be declared static, since only used in one file.
Signed-off-by Stephen Hemminger <[email protected]>
Applied both, thanks.
Hi,
I hope you have a good day! I have a question regarding Guest TLB flush IPIs. <quote>
If the hardware does not support APIC virtualization: kvm_vcpu_kick sends an host-IPI to the remote vcpu if that vcpu is in guest mode, a VM-exit (exit reason: external interrupt) will be triggered due to the host-IPI. Then on VM-entry (inject_pending_event) the guest-IPI is injected. </quote>
If that IPI is a TLB flush IPI, what will happen if the remote vcpu
access the stale tlb entry before
the host-IPI arrives? I really appreciate it if someone could shed some lights on this problem.
Thanks for your time!
Best Wishes,
Yaohui Hu
Quoted 12 lines · Marcelo Tosatti
Quoted 4 lines · Stephen Hemminger
Running 'make namespacecheck' found lots of functions that should be declared static, since only used in one file.
Signed-off-by Stephen Hemminger <[email protected]>Applied both, thanks.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html