linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 3165/3717] drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false
@ 2020-08-28  1:01 kernel test robot
  2020-08-28 17:32 ` Joao Martins
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-08-28  1:01 UTC (permalink / raw)
  To: Joao Martins
  Cc: kbuild-all, clang-built-linux, Dan Williams, Andrew Morton,
	Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 3590 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   88abac0b753dfdd85362a26d2da8277cb1e0842b
commit: f464f9a6a06f2f521f78a6e1ac8680bca2e929e4 [3165/3717] device-dax: add an 'align' attribute
config: arm64-randconfig-r013-20200827 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        git checkout f464f9a6a06f2f521f78a6e1ac8680bca2e929e4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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 >>):

   In file included from drivers/dax/super.c:18:
>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
           if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
               ~~~~~ ^  ~~~~~~~~
   drivers/dax/super.c:447:6: warning: no previous prototype for function 'run_dax' [-Wmissing-prototypes]
   void run_dax(struct dax_device *dax_dev)
        ^
   drivers/dax/super.c:447:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void run_dax(struct dax_device *dax_dev)
   ^
   static 
   2 warnings generated.
--
   In file included from drivers/dax/bus.c:10:
>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
           if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
               ~~~~~ ^  ~~~~~~~~
   1 warning generated.
--
   In file included from drivers/dax/device.c:14:
>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
           if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
               ~~~~~ ^  ~~~~~~~~
   drivers/dax/device.c:391:5: warning: no previous prototype for function 'dev_dax_probe' [-Wmissing-prototypes]
   int dev_dax_probe(struct dev_dax *dev_dax)
       ^
   drivers/dax/device.c:391:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int dev_dax_probe(struct dev_dax *dev_dax)
   ^
   static 
   2 warnings generated.

# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=f464f9a6a06f2f521f78a6e1ac8680bca2e929e4
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout f464f9a6a06f2f521f78a6e1ac8680bca2e929e4
vim +94 drivers/dax/dax-private.h

    90	
    91	#ifdef CONFIG_TRANSPARENT_HUGEPAGE
    92	static inline bool dax_align_valid(unsigned int align)
    93	{
  > 94		if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35417 bytes --]

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

* Re: [linux-next:master 3165/3717] drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false
  2020-08-28  1:01 [linux-next:master 3165/3717] drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false kernel test robot
@ 2020-08-28 17:32 ` Joao Martins
  0 siblings, 0 replies; 2+ messages in thread
From: Joao Martins @ 2020-08-28 17:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, kbuild-all, clang-built-linux, Dan Williams,
	Linux Memory Management List

On 8/28/20 2:01 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   88abac0b753dfdd85362a26d2da8277cb1e0842b
> commit: f464f9a6a06f2f521f78a6e1ac8680bca2e929e4 [3165/3717] device-dax: add an 'align' attribute
> config: arm64-randconfig-r013-20200827 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
> 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
>         # install arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         git checkout f464f9a6a06f2f521f78a6e1ac8680bca2e929e4
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> 
> 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 >>):
> 
>    In file included from drivers/dax/super.c:18:
>>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
>            if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
>                ~~~~~ ^  ~~~~~~~~
>    In file included from drivers/dax/bus.c:10:
>>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
>            if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
>                ~~~~~ ^  ~~~~~~~~
>    1 warning generated.
> --
>    In file included from drivers/dax/device.c:14:
>>> drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
>            if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
>                ~~~~~ ^  ~~~~~~~~

Despite HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD being x86 only,
arm64 would still need the following fixup:

device-dax-add-an-align-attribute-fix.patch:

From: Joao Martins <joao.m.martins@oracle.com>
Date: Fri, 28 Aug 2020 11:33:14 -0400
Subject: [PATCH] device-dax: Fix dax_align_valid() to work on PAGE_SHIFT>=14

With ARM64_PAGE_SHIFT=14, we get:

In file included from drivers/dax/device.c:14:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
            ~~~~~ ^  ~~~~~~~~
In file included from drivers/dax/super.c:18:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
            ~~~~~ ^  ~~~~~~~~
In file included from drivers/dax/bus.c:10:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
            ~~~~~ ^  ~~~~~~~~

Or with ARM64_PAGE_SHIFT=16 && ARM64_VA_BITS_52=y:

In file included from drivers/dax/device.c:14:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 4398046511104
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
            ~~~~~ ^  ~~~~~~~~
In file included from drivers/dax/super.c:18:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 4398046511104
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
In file included from drivers/dax/bus.c:10:
drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 4398046511104
with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]
        if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
            ~~~~~ ^  ~~~~~~~~

Change dax_align_valid() to unsigned long (dax_align_valid()
already is unsigned long). Note that in practice
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD is only set on x86,
so a dax_align_valid(PUD_SIZE) check always return false.
An alternative would be to invert the check to:

	if (IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) && align == PUD_SIZE)

Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/linux-mm/202008280906.WPrik7QQ%25lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 drivers/dax/dax-private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dax/dax-private.h b/drivers/dax/dax-private.h
index fe337436d7f5..1c974b7caae6 100644
--- a/drivers/dax/dax-private.h
+++ b/drivers/dax/dax-private.h
@@ -89,7 +89,7 @@ static inline struct dax_mapping *to_dax_mapping(struct device *dev)
 phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, unsigned long size);

 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-static inline bool dax_align_valid(unsigned int align)
+static inline bool dax_align_valid(unsigned long align)
 {
 	if (align == PUD_SIZE && IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD))
 		return true;
@@ -100,7 +100,7 @@ static inline bool dax_align_valid(unsigned int align)
 	return false;
 }
 #else
-static inline bool dax_align_valid(unsigned int align)
+static inline bool dax_align_valid(unsigned long align)
 {
 	return align == PAGE_SIZE;
 }
-- 
2.17.1



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

end of thread, other threads:[~2020-08-28 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  1:01 [linux-next:master 3165/3717] drivers/dax/dax-private.h:94:12: warning: result of comparison of constant 68719476736 with expression of type 'unsigned int' is always false kernel test robot
2020-08-28 17:32 ` Joao Martins

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).