Content-Type: multipart/mixed; boundary="===============1872194583653398899==" MIME-Version: 1.0 From: Henry Willard To: kbuild-all@lists.01.org Subject: Re: [PATCH] scsi: target: tcmu: Call flush_dcache_page() with proper page struct Date: Tue, 23 Jun 2020 10:49:24 -0700 Message-ID: In-Reply-To: <202006200926.OYiV11oq%lkp@intel.com> List-Id: --===============1872194583653398899== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 6/19/20 6:31 PM, kernel test robot wrote: > Hi Henry, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on mkp-scsi/for-next] > [also build test WARNING on scsi/for-next v5.8-rc1 next-20200618] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Henry-Willard/scsi-targe= t-tcmu-Call-flush_dcache_page-with-proper-page-struct/20200620-024740 > base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-= next > config: xtensa-allyesconfig (attached as .config) > compiler: xtensa-linux-gcc (GCC) 9.3.0 > reproduce (this is a W=3D1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sb= in/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-9.3.0 make.cro= ss ARCH=3Dxtensa > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > All warnings (new ones prefixed by >>, old ones prefixed by <<): > > In file included from include/linux/kernel.h:11, > from include/linux/list.h:9, > from include/linux/preempt.h:11, > from include/linux/spinlock.h:51, > from drivers/target/target_core_user.c:9: > include/linux/scatterlist.h: In function 'sg_set_buf': > arch/xtensa/include/asm/page.h:193:9: warning: comparison of unsigned exp= ression >=3D 0 is always true [-Wtype-limits] > 193 | ((pfn) >=3D ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_map= nr) > | ^~ > include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' > 78 | # define unlikely(x) __builtin_expect(!!(x), 0) > | ^ > include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' > 143 | BUG_ON(!virt_addr_valid(buf)); > | ^~~~~~ > arch/xtensa/include/asm/page.h:201:32: note: in expansion of macro 'pfn_v= alid' > 201 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) > | ^~~~~~~~~ > include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_add= r_valid' > 143 | BUG_ON(!virt_addr_valid(buf)); > | ^~~~~~~~~~~~~~~ > In file included from ./arch/xtensa/include/generated/asm/bug.h:1, > from include/linux/bug.h:5, > from include/linux/thread_info.h:12, > from include/asm-generic/preempt.h:5, > from ./arch/xtensa/include/generated/asm/preempt.h:1, > from include/linux/preempt.h:78, > from include/linux/spinlock.h:51, > from drivers/target/target_core_user.c:9: > include/linux/dma-mapping.h: In function 'dma_map_resource': > arch/xtensa/include/asm/page.h:193:9: warning: comparison of unsigned exp= ression >=3D 0 is always true [-Wtype-limits] > 193 | ((pfn) >=3D ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_map= nr) > | ^~ > include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_O= NCE' > 144 | int __ret_warn_once =3D !!(condition); | = ^~~~~~~~~ > include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_vali= d' > 352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr)))) > | ^~~~~~~~~ > In file included from include/linux/mm_types_task.h:16, > from include/linux/mm_types.h:5, > from include/linux/mmzone.h:21, > from include/linux/gfp.h:6, > from include/linux/umh.h:4, > from include/linux/kmod.h:9, > from include/linux/module.h:16, > from drivers/target/target_core_user.c:10: > drivers/target/target_core_user.c: In function 'tcmu_flush_dcache_range': > arch/xtensa/include/asm/page.h:193:9: warning: comparison of unsigned exp= ression >=3D 0 is always true [-Wtype-limits] > 193 | ((pfn) >=3D ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_map= nr) > | ^~ > arch/xtensa/include/asm/page.h:201:32: note: in expansion of macro 'pfn_v= alid' > 201 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) > | ^~~~~~~~~ > drivers/target/target_core_user.c:605:7: note: in expansion of macro 'vir= t_addr_valid' > 605 | if (virt_addr_valid(start)) > | ^~~~~~~~~~~~~~~ >>> drivers/target/target_core_user.c:600:15: warning: variable 'pg' set bu= t not used [-Wunused-but-set-variable] > 600 | struct page *pg; > | ^~ > > vim +/pg +600 drivers/target/target_core_user.c > > 595 = > 596 static inline void tcmu_flush_dcache_range(void *vaddr, size_t si= ze) > 597 { > 598 unsigned long offset =3D offset_in_page(vaddr); > 599 void *start =3D vaddr - offset; > > 600 struct page *pg; > 601 = > 602 size =3D round_up(size+offset, PAGE_SIZE); > 603 = > 604 while (size) { > 605 if (virt_addr_valid(start)) > 606 pg =3D virt_to_page(start); > 607 else if (is_vmalloc_addr(start)) > 608 pg =3D vmalloc_to_page(start); > 609 else > 610 break; > 611 = > 612 flush_dcache_page(pg); > 613 start +=3D PAGE_SIZE; > 614 size -=3D PAGE_SIZE; > 615 } > 616 } > 617 = > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org It doesn't really matter in this case because this patch has been = superseded by a different fix, but the warning appears to be caused by = an incorrect implementation of flush_dcache_page() in = arch/xtensa/include/asm/cacheflush.h. Depending on the variant and = options, flush_dcache_page can be defined as "do { } while (0)", which = covers the default null implementation of flush_dcache_page(). Thanks, Henry --===============1872194583653398899==--