linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Wei Liu <wei.liu@kernel.org>, kernel test robot <lkp@intel.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Long Li <longli@microsoft.com>,
	Michael Kelley <mikelley@microsoft.com>
Subject: Re: [hyperv:hyperv-next 4/5] drivers/hv/vmbus_drv.c:2082:29: warning: shift count >= width of type
Date: Mon, 20 Dec 2021 17:44:35 +0000	[thread overview]
Message-ID: <20211220174435.2mv4gna5eu7awzt5@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <YcC1CobR/n0tJhdV@archlinux-ax161>

On Mon, Dec 20, 2021 at 09:53:30AM -0700, Nathan Chancellor wrote:
> Hi Wei,
> 
> On Sun, Dec 19, 2021 at 12:29:37PM +0000, Wei Liu wrote:
> > On Sat, Dec 18, 2021 at 06:20:43PM +0800, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git hyperv-next
> > > head:   19fd7ca00201c0525452dcf5a490e4b01674ef4c
> > > commit: 6327882f7b4a476ea902de4bee5657f1028d6859 [4/5] scsi: storvsc: Add Isolation VM support for storvsc driver
> > > config: x86_64-randconfig-a013-20211216 (https://download.01.org/0day-ci/archive/20211218/202112181827.o3X7GmHz-lkp@intel.com/config)
> > > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4c9e31a4814592bbda7153833e46728dc7b21100)
> > > reproduce (this is a W=1 build):
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit/?id=6327882f7b4a476ea902de4bee5657f1028d6859
> > >         git remote add hyperv https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
> > >         git fetch --no-tags hyperv hyperv-next
> > >         git checkout 6327882f7b4a476ea902de4bee5657f1028d6859
> > >         # save the config file to linux build tree
> > >         mkdir build_dir
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/hv/
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > 
> > > All warnings (new ones prefixed by >>):
> > > 
> > > >> drivers/hv/vmbus_drv.c:2082:29: warning: shift count >= width of type [-Wshift-count-overflow]
> > >    static u64 vmbus_dma_mask = DMA_BIT_MASK(64);
> > >                                ^~~~~~~~~~~~~~~~
> > >    include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
> > >    #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> > >                                                         ^ ~~~
> > 
> > I don't think there is anything wrong with the code. When n is 64 the
> > problematic expression is not evaluated.
> 
> Yes, unfortunately, this is an outstanding bug in clang where it does
> not properly build a control flow graph for expressions at a global
> scope:
> 
> https://github.com/ClangBuiltLinux/linux/issues/92
> 
> We should absolutely fix that but it has not come up too often so other
> fires have been prioritized. Now that -Werror is a thing, that issue's
> priority should probably be upgraded, as this warning will break
> allmodconfig for clang.

Thanks for the explanation.

> 
> If you were feeling generous, just changing that to ~0ULL directly would
> solve the warning but I get that it is less documentation that way.

I would actually like to keep the code as-is because it gives a clear
idea what it is doing.

Wei.

> 
> Cheers,
> Nathan

      reply	other threads:[~2021-12-20 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18 10:20 [hyperv:hyperv-next 4/5] drivers/hv/vmbus_drv.c:2082:29: warning: shift count >= width of type kernel test robot
2021-12-19 12:29 ` Wei Liu
2021-12-20 16:53   ` Nathan Chancellor
2021-12-20 17:44     ` Wei Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211220174435.2mv4gna5eu7awzt5@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=longli@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=nathan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).