The patch titled Subject: device-dax: fix dax_align_valid() to work on PAGE_SHIFT>=14 has been added to the -mm tree. Its filename is device-dax-add-an-align-attribute-fixpatch.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/device-dax-add-an-align-attribute-fixpatch.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/device-dax-add-an-align-attribute-fixpatch.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Joao Martins <joao.m.martins@xxxxxxxxxx> Subject: 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) Link: http://lkml.kernel.org/r/435778c3-65c2-7e5d-578d-68cf89ae19bd@xxxxxxxxxx Link: https://lore.kernel.org/linux-mm/202008280906.WPrik7QQ%25lkp@xxxxxxxxx/ Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Vishal Verma <vishal.l.verma@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/dax/dax-private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/dax/dax-private.h~device-dax-add-an-align-attribute-fixpatch +++ a/drivers/dax/dax-private.h @@ -89,7 +89,7 @@ static inline struct dax_mapping *to_dax 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(unsig 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; } _ Patches currently in -mm which might be from joao.m.martins@xxxxxxxxxx are device-dax-add-dis-contiguous-resource-support-fix.patch device-dax-make-align-a-per-device-property.patch device-dax-add-an-align-attribute-fix.patch device-dax-add-an-align-attribute-fixpatch.patch dax-hmem-introduce-dax_hmemregion_idle-parameter.patch device-dax-add-a-range-mapping-allocation-attribute.patch