All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces)
@ 2015-01-19 14:33 kbuild test robot
  2015-01-19 14:33 ` [PATCH kvm] KVM: kvm_read_nested_guest_page() can be static kbuild test robot
  2015-01-19 19:35 ` [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) Christian Borntraeger
  0 siblings, 2 replies; 3+ messages in thread
From: kbuild test robot @ 2015-01-19 14:33 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: kbuild-all, Paolo Bonzini, Gleb Natapov, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, kvm, linux-kernel

tree:   git://git.kernel.org/pub/scm/virt/kvm/kvm.git master
head:   cdef511985374dd042a40bb32c1c346c2662c9dc
commit: cdef511985374dd042a40bb32c1c346c2662c9dc [1/1] KVM: fix sparse warning in include/trace/events/kvm.h
reproduce:
  # apt-get install sparse
  git checkout cdef511985374dd042a40bb32c1c346c2662c9dc
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25:    expected struct pid *volatile <noident>
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25:    got struct pid [noderef] <asn:4>*<noident>
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9: sparse: incorrect type in assignment (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9:    expected struct kvm_memslots *volatile <noident>
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9:    got struct kvm_memslots [noderef] <asn:4>*<noident>
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:1790:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:2957:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:2974:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/../../../virt/kvm/kvm_main.c:3024:15: sparse: incompatible types in comparison expression (different address spaces)
--
>> arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18: sparse: incorrect type in argument 1 (different address spaces)
   arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18:    expected void const *<noident>
   arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18:    got struct kvm_irq_routing_table [noderef] <asn:4>*irq_routing
>> arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13: sparse: incorrect type in assignment (different address spaces)
   arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13:    expected struct kvm_irq_routing_table *old
   arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13:    got struct kvm_irq_routing_table [noderef] <asn:4>*irq_routing
--
>> arch/x86/kvm/x86.c:495:5: sparse: symbol 'kvm_read_nested_guest_page' was not declared. Should it be static?
>> arch/x86/kvm/x86.c:646:5: sparse: symbol '__kvm_set_xcr' was not declared. Should it be static?
>> arch/x86/kvm/x86.c:1183:15: sparse: symbol 'max_tsc_khz' was not declared. Should it be static?
>> arch/x86/kvm/x86.c:1237:6: sparse: symbol 'kvm_track_tsc_matching' was not declared. Should it be static?
>> arch/x86/kvm/x86.c:1898:38: sparse: incorrect type in argument 1 (different address spaces)
   arch/x86/kvm/x86.c:1898:38:    expected void const [noderef] <asn:1>*<noident>
   arch/x86/kvm/x86.c:1898:38:    got unsigned char [usertype] *
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/x86.c:7431:15: sparse: incompatible types in comparison expression (different address spaces)

Please review and possibly fold the followup patch.

vim +2062 arch/x86/kvm/../../../virt/kvm/kvm_main.c

2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2046  		return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2047  #endif
2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2048  
2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2049  
9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2050  	r = vcpu_load(vcpu);
9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2051  	if (r)
9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2052  		return r;
6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2053  	switch (ioctl) {
9a2bb7f4 drivers/kvm/kvm_main.c Avi Kivity            2007-02-22  2054  	case KVM_RUN:
f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2055  		r = -EINVAL;
f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2056  		if (arg)
f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2057  			goto out;
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2058  		if (unlikely(vcpu->pid != current->pids[PIDTYPE_PID].pid)) {
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2059  			/* The thread running this VCPU changed. */
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2060  			struct pid *oldpid = vcpu->pid;
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2061  			struct pid *newpid = get_task_pid(current, PIDTYPE_PID);
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05 @2062  			rcu_assign_pointer(vcpu->pid, newpid);
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2063  			if (oldpid)
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2064  				synchronize_rcu();
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2065  			put_pid(oldpid);
7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2066  		}
b6c7a5dc drivers/kvm/kvm_main.c Hollis Blanchard      2007-11-01  2067  		r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);
64be5007 virt/kvm/kvm_main.c    Gleb Natapov          2010-10-24  2068  		trace_kvm_userspace_exit(vcpu->run->exit_reason, r);
6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2069  		break;
6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2070  	case KVM_GET_REGS: {

:::::: The code at line 2062 was first introduced by commit
:::::: 7a72f7a140bfd3a5dae73088947010bfdbcf6a40 KVM: track pid for VCPU only on KVM_RUN ioctl

:::::: TO: Christian Borntraeger <borntraeger@de.ibm.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH kvm] KVM: kvm_read_nested_guest_page() can be static
  2015-01-19 14:33 [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) kbuild test robot
@ 2015-01-19 14:33 ` kbuild test robot
  2015-01-19 19:35 ` [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) Christian Borntraeger
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2015-01-19 14:33 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: kbuild-all, Paolo Bonzini, Gleb Natapov, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, kvm, linux-kernel

arch/x86/kvm/x86.c:495:5: sparse: symbol 'kvm_read_nested_guest_page' was not declared. Should it be static?
arch/x86/kvm/x86.c:646:5: sparse: symbol '__kvm_set_xcr' was not declared. Should it be static?
arch/x86/kvm/x86.c:1183:15: sparse: symbol 'max_tsc_khz' was not declared. Should it be static?
arch/x86/kvm/x86.c:1237:6: sparse: symbol 'kvm_track_tsc_matching' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 x86.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c259814..f149b7c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -492,7 +492,7 @@ int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
 }
 EXPORT_SYMBOL_GPL(kvm_read_guest_page_mmu);
 
-int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
+static int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
 			       void *data, int offset, int len, u32 access)
 {
 	return kvm_read_guest_page_mmu(vcpu, vcpu->arch.walk_mmu, gfn,
@@ -643,7 +643,7 @@ static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu)
 	}
 }
 
-int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
+static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 {
 	u64 xcr0 = xcr;
 	u64 old_xcr0 = vcpu->arch.xcr0;
@@ -1180,7 +1180,7 @@ static atomic_t kvm_guest_has_master_clock = ATOMIC_INIT(0);
 #endif
 
 static DEFINE_PER_CPU(unsigned long, cpu_tsc_khz);
-unsigned long max_tsc_khz;
+static unsigned long max_tsc_khz;
 
 static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec)
 {
@@ -1234,7 +1234,7 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
 	return tsc;
 }
 
-void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
+static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_X86_64
 	bool vcpus_matched;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces)
  2015-01-19 14:33 [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) kbuild test robot
  2015-01-19 14:33 ` [PATCH kvm] KVM: kvm_read_nested_guest_page() can be static kbuild test robot
@ 2015-01-19 19:35 ` Christian Borntraeger
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2015-01-19 19:35 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Paolo Bonzini, Gleb Natapov, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, kvm, linux-kernel

Am 19.01.2015 um 15:33 schrieb kbuild test robot:
> tree:   git://git.kernel.org/pub/scm/virt/kvm/kvm.git master
> head:   cdef511985374dd042a40bb32c1c346c2662c9dc
> commit: cdef511985374dd042a40bb32c1c346c2662c9dc [1/1] KVM: fix sparse warning in include/trace/events/kvm.h
> reproduce:
>   # apt-get install sparse
>   git checkout cdef511985374dd042a40bb32c1c346c2662c9dc
>   make ARCH=x86_64 allmodconfig
>   make C=1 CF=-D__CHECK_ENDIAN__
> 
> 
> sparse warnings: (new ones prefixed by >>)

FWIW,

looks like my previous fix re-enabled sparse for that code. It bailed out previously due to the 
".include/trace/events/kvm.h:163:1: error: directive in argument list
include/trace/events/kvm.h:167:1: error: directive in argument list
include/trace/events/kvm.h:169:1: error: directive in argument list"
errors.

Since that was fixed with commit: cdef511985374dd042a40bb32c1c346c2662c9dc [1/1] KVM: fix sparse warning in include/trace/events/kvm.h, we now we have more sparse errors than before and still its an improvement :-)

Christian

> 
>>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25:    expected struct pid *volatile <noident>
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25:    got struct pid [noderef] <asn:4>*<noident>
>>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9: sparse: incorrect type in assignment (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9:    expected struct kvm_memslots *volatile <noident>
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:741:9:    got struct kvm_memslots [noderef] <asn:4>*<noident>
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:1790:15: sparse: incompatible types in comparison expression (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:2957:15: sparse: incompatible types in comparison expression (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:2974:15: sparse: incompatible types in comparison expression (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/kvm_main.c:3024:15: sparse: incompatible types in comparison expression (different address spaces)
> --
>>> arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18: sparse: incorrect type in argument 1 (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18:    expected void const *<noident>
>    arch/x86/kvm/../../../virt/kvm/irqchip.c:125:18:    got struct kvm_irq_routing_table [noderef] <asn:4>*irq_routing
>>> arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13: sparse: incorrect type in assignment (different address spaces)
>    arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13:    expected struct kvm_irq_routing_table *old
>    arch/x86/kvm/../../../virt/kvm/irqchip.c:201:13:    got struct kvm_irq_routing_table [noderef] <asn:4>*irq_routing
> --
>>> arch/x86/kvm/x86.c:495:5: sparse: symbol 'kvm_read_nested_guest_page' was not declared. Should it be static?
>>> arch/x86/kvm/x86.c:646:5: sparse: symbol '__kvm_set_xcr' was not declared. Should it be static?
>>> arch/x86/kvm/x86.c:1183:15: sparse: symbol 'max_tsc_khz' was not declared. Should it be static?
>>> arch/x86/kvm/x86.c:1237:6: sparse: symbol 'kvm_track_tsc_matching' was not declared. Should it be static?
>>> arch/x86/kvm/x86.c:1898:38: sparse: incorrect type in argument 1 (different address spaces)
>    arch/x86/kvm/x86.c:1898:38:    expected void const [noderef] <asn:1>*<noident>
>    arch/x86/kvm/x86.c:1898:38:    got unsigned char [usertype] *
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    include/linux/kvm_host.h:482:16: sparse: incompatible types in comparison expression (different address spaces)
>    arch/x86/kvm/x86.c:7431:15: sparse: incompatible types in comparison expression (different address spaces)
> 
> Please review and possibly fold the followup patch.
> 
> vim +2062 arch/x86/kvm/../../../virt/kvm/kvm_main.c
> 
> 2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2046  		return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
> 2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2047  #endif
> 2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2048  
> 2122ff5e virt/kvm/kvm_main.c    Avi Kivity            2010-05-13  2049  
> 9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2050  	r = vcpu_load(vcpu);
> 9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2051  	if (r)
> 9fc77441 virt/kvm/kvm_main.c    Michael S. Tsirkin    2012-09-16  2052  		return r;
> 6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2053  	switch (ioctl) {
> 9a2bb7f4 drivers/kvm/kvm_main.c Avi Kivity            2007-02-22  2054  	case KVM_RUN:
> f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2055  		r = -EINVAL;
> f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2056  		if (arg)
> f0fe5108 drivers/kvm/kvm_main.c Avi Kivity            2007-03-07  2057  			goto out;
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2058  		if (unlikely(vcpu->pid != current->pids[PIDTYPE_PID].pid)) {
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2059  			/* The thread running this VCPU changed. */
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2060  			struct pid *oldpid = vcpu->pid;
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2061  			struct pid *newpid = get_task_pid(current, PIDTYPE_PID);
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05 @2062  			rcu_assign_pointer(vcpu->pid, newpid);
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2063  			if (oldpid)
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2064  				synchronize_rcu();
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2065  			put_pid(oldpid);
> 7a72f7a1 virt/kvm/kvm_main.c    Christian Borntraeger 2014-08-05  2066  		}
> b6c7a5dc drivers/kvm/kvm_main.c Hollis Blanchard      2007-11-01  2067  		r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);
> 64be5007 virt/kvm/kvm_main.c    Gleb Natapov          2010-10-24  2068  		trace_kvm_userspace_exit(vcpu->run->exit_reason, r);
> 6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2069  		break;
> 6aa8b732 drivers/kvm/kvm_main.c Avi Kivity            2006-12-10  2070  	case KVM_GET_REGS: {
> 
> :::::: The code at line 2062 was first introduced by commit
> :::::: 7a72f7a140bfd3a5dae73088947010bfdbcf6a40 KVM: track pid for VCPU only on KVM_RUN ioctl
> 
> :::::: TO: Christian Borntraeger <borntraeger@de.ibm.com>
> :::::: CC: Paolo Bonzini <pbonzini@redhat.com>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-19 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-19 14:33 [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) kbuild test robot
2015-01-19 14:33 ` [PATCH kvm] KVM: kvm_read_nested_guest_page() can be static kbuild test robot
2015-01-19 19:35 ` [kvm:master 1/1] arch/x86/kvm/../../../virt/kvm/kvm_main.c:2062:25: sparse: incorrect type in assignment (different address spaces) Christian Borntraeger

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.