* Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b)
[not found] <202311302231.sinLrAig-lkp@intel.com>
@ 2023-11-30 16:37 ` Vitaly Kuznetsov
2023-11-30 17:49 ` Sean Christopherson
0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Kuznetsov @ 2023-11-30 16:37 UTC (permalink / raw)
To: kernel test robot
Cc: oe-kbuild-all, linux-kernel, Paolo Bonzini, Sean Christopherson,
kvm
kernel test robot <lkp@intel.com> writes:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
> commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}"
> date: 1 year ago
> config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config)
> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a)
This is what ROL16() macro does but the thing is: we actually want to
truncate bits by doing an explicit (u16) cast. We can probably replace
this with '& 0xffff':
#define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff)
but honestly I don't see much point...
--
Vitaly
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b)
2023-11-30 16:37 ` arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b) Vitaly Kuznetsov
@ 2023-11-30 17:49 ` Sean Christopherson
2023-12-01 6:10 ` Yujie Liu
0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2023-11-30 17:49 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kernel test robot, oe-kbuild-all, linux-kernel, Paolo Bonzini,
kvm
On Thu, Nov 30, 2023, Vitaly Kuznetsov wrote:
> kernel test robot <lkp@intel.com> writes:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
> > commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}"
> > date: 1 year ago
> > config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config)
> > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/
> >
> > sparse warnings: (new ones prefixed by >>)
> > arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a)
>
> This is what ROL16() macro does but the thing is: we actually want to
> truncate bits by doing an explicit (u16) cast. We can probably replace
> this with '& 0xffff':
>
> #define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff)
>
> but honestly I don't see much point...
Yeah, just ignore 'em, we get the exact same sparse complaints in vmcs12.c and
have had great success ignoring those too :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b)
2023-11-30 17:49 ` Sean Christopherson
@ 2023-12-01 6:10 ` Yujie Liu
2023-12-01 15:56 ` Sean Christopherson
0 siblings, 1 reply; 5+ messages in thread
From: Yujie Liu @ 2023-12-01 6:10 UTC (permalink / raw)
To: Sean Christopherson
Cc: Vitaly Kuznetsov, kernel test robot, oe-kbuild-all, linux-kernel,
Paolo Bonzini, kvm
On Thu, Nov 30, 2023 at 09:49:43AM -0800, Sean Christopherson wrote:
> On Thu, Nov 30, 2023, Vitaly Kuznetsov wrote:
> > kernel test robot <lkp@intel.com> writes:
> >
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
> > > commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}"
> > > date: 1 year ago
> > > config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config)
> > > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/
> > >
> > > sparse warnings: (new ones prefixed by >>)
> > > arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a)
> >
> > This is what ROL16() macro does but the thing is: we actually want to
> > truncate bits by doing an explicit (u16) cast. We can probably replace
> > this with '& 0xffff':
> >
> > #define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff)
> >
> > but honestly I don't see much point...
>
> Yeah, just ignore 'em, we get the exact same sparse complaints in vmcs12.c and
> have had great success ignoring those too :-)
Thanks for the information. We've disabled this warning in the bot to
avoid sending reports against other files with similar code.
Best Regards,
Yujie
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b)
2023-12-01 6:10 ` Yujie Liu
@ 2023-12-01 15:56 ` Sean Christopherson
2024-01-10 3:10 ` Yujie Liu
0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2023-12-01 15:56 UTC (permalink / raw)
To: Yujie Liu
Cc: Vitaly Kuznetsov, kernel test robot, oe-kbuild-all, linux-kernel,
Paolo Bonzini, kvm
On Fri, Dec 01, 2023, Yujie Liu wrote:
> On Thu, Nov 30, 2023 at 09:49:43AM -0800, Sean Christopherson wrote:
> > On Thu, Nov 30, 2023, Vitaly Kuznetsov wrote:
> > > kernel test robot <lkp@intel.com> writes:
> > >
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
> > > > commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}"
> > > > date: 1 year ago
> > > > config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config)
> > > > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce)
> > > >
> > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > the same patch/commit), kindly add following tags
> > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/
> > > >
> > > > sparse warnings: (new ones prefixed by >>)
> > > > arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a)
> > >
> > > This is what ROL16() macro does but the thing is: we actually want to
> > > truncate bits by doing an explicit (u16) cast. We can probably replace
> > > this with '& 0xffff':
> > >
> > > #define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff)
> > >
> > > but honestly I don't see much point...
> >
> > Yeah, just ignore 'em, we get the exact same sparse complaints in vmcs12.c and
> > have had great success ignoring those too :-)
>
> Thanks for the information. We've disabled this warning in the bot to
> avoid sending reports against other files with similar code.
I would probably recommend keeping the sparse warning enabled, IIRC it does find
legitimate bugs from time to time.
Or are you able to disable just the ROL16() warning? If so, super cool!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b)
2023-12-01 15:56 ` Sean Christopherson
@ 2024-01-10 3:10 ` Yujie Liu
0 siblings, 0 replies; 5+ messages in thread
From: Yujie Liu @ 2024-01-10 3:10 UTC (permalink / raw)
To: Sean Christopherson
Cc: Vitaly Kuznetsov, kernel test robot, oe-kbuild-all, linux-kernel,
Paolo Bonzini, kvm
Hi Sean,
On Fri, Dec 01, 2023 at 07:56:01AM -0800, Sean Christopherson wrote:
> On Fri, Dec 01, 2023, Yujie Liu wrote:
> > On Thu, Nov 30, 2023 at 09:49:43AM -0800, Sean Christopherson wrote:
> > > On Thu, Nov 30, 2023, Vitaly Kuznetsov wrote:
> > > > kernel test robot <lkp@intel.com> writes:
> > > >
> > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > > head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
> > > > > commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}"
> > > > > date: 1 year ago
> > > > > config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config)
> > > > > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> > > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce)
> > > > >
> > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > > the same patch/commit), kindly add following tags
> > > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/
> > > > >
> > > > > sparse warnings: (new ones prefixed by >>)
> > > > > arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a)
> > > >
> > > > This is what ROL16() macro does but the thing is: we actually want to
> > > > truncate bits by doing an explicit (u16) cast. We can probably replace
> > > > this with '& 0xffff':
> > > >
> > > > #define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff)
> > > >
> > > > but honestly I don't see much point...
> > >
> > > Yeah, just ignore 'em, we get the exact same sparse complaints in vmcs12.c and
> > > have had great success ignoring those too :-)
> >
> > Thanks for the information. We've disabled this warning in the bot to
> > avoid sending reports against other files with similar code.
>
> I would probably recommend keeping the sparse warning enabled, IIRC it does find
> legitimate bugs from time to time.
>
> Or are you able to disable just the ROL16() warning? If so, super cool!
FYI, we've added new logic in kernel test robot to ignore this sparse warning
for ROL16 macro.
Best Regards,
Yujie
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-10 3:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <202311302231.sinLrAig-lkp@intel.com>
2023-11-30 16:37 ` arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b) Vitaly Kuznetsov
2023-11-30 17:49 ` Sean Christopherson
2023-12-01 6:10 ` Yujie Liu
2023-12-01 15:56 ` Sean Christopherson
2024-01-10 3:10 ` Yujie Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).