CC: kbuild-...@lists.01.org
BCC: l...@intel.com
In-Reply-To: <20220228200552.150406-13-dw...@infradead.org>
References: <20220228200552.150406-13-dw...@infradead.org>
TO: David Woodhouse <dw...@infradead.org>

Hi David,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kvm/master]
[also build test WARNING on mst-vhost/linux-next v5.17-rc7 next-20220308]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/David-Woodhouse/KVM-Add-Xen-event-channel-acceleration/20220301-040936
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git master
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: i386-randconfig-m031-20220307 
(https://download.01.org/0day-ci/archive/20220309/202203090947.j4l7pjfp-...@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

smatch warnings:
arch/x86/kvm/xen.c:1029 kvm_xen_hcall_set_timer_op() warn: right shifting more 
than type allows 32 vs 50

vim +1029 arch/x86/kvm/xen.c

9e28d0cae6d7075 Joao Martins 2022-02-28  1009  
9e28d0cae6d7075 Joao Martins 2022-02-28  1010  static bool 
kvm_xen_hcall_set_timer_op(struct kvm_vcpu *vcpu, uint64_t timeout,
9e28d0cae6d7075 Joao Martins 2022-02-28  1011                                  
u64 *r)
9e28d0cae6d7075 Joao Martins 2022-02-28  1012  {
9e28d0cae6d7075 Joao Martins 2022-02-28  1013   if 
(!kvm_xen_timer_enabled(vcpu))
9e28d0cae6d7075 Joao Martins 2022-02-28  1014           return false;
9e28d0cae6d7075 Joao Martins 2022-02-28  1015  
9e28d0cae6d7075 Joao Martins 2022-02-28  1016   if (timeout) {
9e28d0cae6d7075 Joao Martins 2022-02-28  1017           uint64_t guest_now = 
get_kvmclock_ns(vcpu->kvm);
9e28d0cae6d7075 Joao Martins 2022-02-28  1018           long delta = timeout - 
guest_now;
9e28d0cae6d7075 Joao Martins 2022-02-28  1019  
9e28d0cae6d7075 Joao Martins 2022-02-28  1020           /* Xen has a 'Linux 
workaround' in do_set_timer_op() which
9e28d0cae6d7075 Joao Martins 2022-02-28  1021            * checks for negative 
absolute timeout values (caused by
9e28d0cae6d7075 Joao Martins 2022-02-28  1022            * integer overflow), 
and for values about 13 days in the
9e28d0cae6d7075 Joao Martins 2022-02-28  1023            * future (2^50ns) 
which would be caused by jiffies
9e28d0cae6d7075 Joao Martins 2022-02-28  1024            * overflow. For those 
cases, it sets the timeout 100ms in
9e28d0cae6d7075 Joao Martins 2022-02-28  1025            * the future (not 
*too* soon, since if a guest really did
9e28d0cae6d7075 Joao Martins 2022-02-28  1026            * set a long timeout 
on purpose we don't want to keep
9e28d0cae6d7075 Joao Martins 2022-02-28  1027            * churning CPU time by 
waking it up).
9e28d0cae6d7075 Joao Martins 2022-02-28  1028            */
9e28d0cae6d7075 Joao Martins 2022-02-28 @1029           if 
(unlikely((int64_t)timeout < 0 ||
9e28d0cae6d7075 Joao Martins 2022-02-28  1030                        (delta > 0 
&& (uint32_t) (delta >> 50) != 0))) {
9e28d0cae6d7075 Joao Martins 2022-02-28  1031                   delta = 100 * 
NSEC_PER_MSEC;
9e28d0cae6d7075 Joao Martins 2022-02-28  1032                   timeout = 
guest_now + delta;
9e28d0cae6d7075 Joao Martins 2022-02-28  1033           }
9e28d0cae6d7075 Joao Martins 2022-02-28  1034  
9e28d0cae6d7075 Joao Martins 2022-02-28  1035           
kvm_xen_start_timer(vcpu, timeout, delta);
9e28d0cae6d7075 Joao Martins 2022-02-28  1036   } else {
9e28d0cae6d7075 Joao Martins 2022-02-28  1037           
kvm_xen_stop_timer(vcpu);
9e28d0cae6d7075 Joao Martins 2022-02-28  1038   }
9e28d0cae6d7075 Joao Martins 2022-02-28  1039  
9e28d0cae6d7075 Joao Martins 2022-02-28  1040   *r = 0;
9e28d0cae6d7075 Joao Martins 2022-02-28  1041   return true;
9e28d0cae6d7075 Joao Martins 2022-02-28  1042  }
9e28d0cae6d7075 Joao Martins 2022-02-28  1043  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to