linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>,
	kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	Dan Williams <dan.j.williams@intel.com>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: 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
Date: Fri, 28 Aug 2020 18:32:12 +0100	[thread overview]
Message-ID: <435778c3-65c2-7e5d-578d-68cf89ae19bd@oracle.com> (raw)
In-Reply-To: <202008280906.WPrik7QQ%lkp@intel.com>

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



      reply	other threads:[~2020-08-28 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28  1:01 kernel test robot
2020-08-28 17:32 ` Joao Martins [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=435778c3-65c2-7e5d-578d-68cf89ae19bd@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dan.j.williams@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    /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