From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Kagan Subject: Re: [kvm:queue 27/38] arch/x86/kvm/hyperv.c:186:41: sparse: incorrect type in argument 2 (different modifiers) Date: Fri, 18 Sep 2015 17:40:27 +0300 Message-ID: <20150918144026.GJ3317@rkaganb.sw.ru> References: <201509182109.6ccgXDVp%fengguang.wu@intel.com> <55FC16F4.7060407@openvz.org> <55FC17B4.9060702@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: "Denis V. Lunev" , kbuild test robot , Andrey Smetanin , , To: Paolo Bonzini Return-path: Received: from relay.parallels.com ([195.214.232.42]:32933 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752167AbbIROko (ORCPT ); Fri, 18 Sep 2015 10:40:44 -0400 Content-Disposition: inline In-Reply-To: <55FC17B4.9060702@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Sep 18, 2015 at 03:55:00PM +0200, Paolo Bonzini wrote: > > > On 18/09/2015 15:51, Denis V. Lunev wrote: > >> 185 > >> > 186 task_cputime_adjusted(current, &utime, &stime); > >> 187 return div_u64(cputime_to_nsecs(utime + stime), 100); > >> 188 } > >> 189 > >> 190 static int kvm_hv_set_msr(struct kvm_vcpu *vcpu, u32 msr, > >> u64 data, bool host) > >> 191 { > >> 192 struct kvm_vcpu_hv *hv = &vcpu->arch.hyperv; > >> 193 > >> 194 switch (msr) { > >> > >> --- > >> 0-DAY kernel test infrastructure Open Source Technology > >> Center > >> https://lists.01.org/pipermail/kbuild-all Intel > >> Corporation > > can not get an idea what is this warning about... > > For me it looks pretty lame. > > I think it wants you to do > > - return div_u64(cputime_to_nsecs(utime + stime), 100); > + return div_u64(cputime_to_nsecs(utime) + > + cputime_to_nsecs(stime), 100); The warning is pretty specific about the point where it triggered. I have reduced it to the following standalone reproducer: %%% cat x.c #ifdef __CHECKER__ # define __nocast __attribute__((nocast)) #else # define __nocast #endif typedef unsigned long __nocast cputime_t; extern void task_cputime_adjusted(cputime_t *); extern void current_task_runtime_100ns(void); void current_task_runtime_100ns(void) { cputime_t utime; task_cputime_adjusted(&utime); } %%% gcc -c x.c -Wall -Werror -O2; echo $? 0 %%% sparse x.c x.c:16:32: warning: incorrect type in argument 1 (different modifiers) x.c:16:32: expected unsigned long [nocast] [usertype] * x.c:16:32: got unsigned long * x.c:16:32: warning: implicit cast to nocast type Looks like a sparse bug to me. Roman.