* fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
@ 2020-08-07 12:08 kernel test robot
2020-08-07 14:48 ` Gao Xiang
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2020-08-07 12:08 UTC (permalink / raw)
To: Gao Xiang; +Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 6474 bytes --]
Hi Gao,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 86cfccb66937dd6cbf26ed619958b9e587e6a115
commit: 47e4937a4a7ca4184fd282791dfee76c6799966a erofs: move erofs out of staging
date: 12 months ago
config: s390-randconfig-s032-20200807 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-118-ge1578773-dirty
git checkout 47e4937a4a7ca4184fd282791dfee76c6799966a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
fs/erofs/zdata.c:282:22: sparse: sparse: non size-preserving integer to pointer cast
fs/erofs/zdata.c:1094:24: sparse: sparse: non size-preserving integer to pointer cast
vim +198 fs/erofs/zdata.c
3883a79abd0227 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 162
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 163 static void preload_compressed_pages(struct z_erofs_collector *clt,
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 164 struct address_space *mc,
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 165 enum z_erofs_cache_alloctype type,
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 166 struct list_head *pagepool)
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 167 {
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 168 const struct z_erofs_pcluster *pcl = clt->pcl;
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 169 const unsigned int clusterpages = BIT(pcl->clusterbits);
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 170 struct page **pages = clt->compressedpages;
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 171 pgoff_t index = pcl->obj.index + (pages - pcl->compressed_pages);
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 172 bool standalone = true;
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 173
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 174 if (clt->mode < COLLECT_PRIMARY_FOLLOWED)
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 175 return;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 176
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 177 for (; pages < pcl->compressed_pages + clusterpages; ++pages) {
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 178 struct page *page;
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 179 compressed_page_t t;
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 180
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 181 /* the compressed page was loaded before */
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 182 if (READ_ONCE(*pages))
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 183 continue;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 184
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 185 page = find_get_page(mc, index);
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 186
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 187 if (page) {
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 188 t = tag_compressed_page_justfound(page);
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 189 } else if (type == DELAYEDALLOC) {
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 190 t = tagptr_init(compressed_page_t, PAGE_UNALLOCATED);
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 191 } else { /* DONTALLOC */
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 192 if (standalone)
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 193 clt->compressedpages = pages;
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 194 standalone = false;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 195 continue;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 196 }
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 197
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 @198 if (!cmpxchg_relaxed(pages, NULL, tagptr_cast_ptr(t)))
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 199 continue;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 200
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 201 if (page)
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 202 put_page(page);
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 203 }
92e6efd566c4a1 drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-12-08 204
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 205 if (standalone) /* downgrade to PRIMARY_FOLLOWED_NOINPLACE */
97e86a858bc360 drivers/staging/erofs/zdata.c Gao Xiang 2019-07-31 206 clt->mode = COLLECT_PRIMARY_FOLLOWED_NOINPLACE;
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 207 }
105d4ad857dcbf drivers/staging/erofs/unzip_vle.c Gao Xiang 2018-07-26 208
:::::: The code at line 198 was first introduced by commit
:::::: 97e86a858bc360c9cded74ce9a06595d40f7ad81 staging: erofs: tidy up decompression frontend
:::::: TO: Gao Xiang <gaoxiang25@huawei.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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: 24253 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
2020-08-07 12:08 fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast kernel test robot
@ 2020-08-07 14:48 ` Gao Xiang
2020-08-07 15:05 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2020-08-07 14:48 UTC (permalink / raw)
To: kernel test robot; +Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman
Hi,
On Fri, Aug 07, 2020 at 08:08:10PM +0800, kernel test robot wrote:
> Hi Gao,
>
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 86cfccb66937dd6cbf26ed619958b9e587e6a115
> commit: 47e4937a4a7ca4184fd282791dfee76c6799966a erofs: move erofs out of staging
> date: 12 months ago
> config: s390-randconfig-s032-20200807 (attached as .config)
> compiler: s390-linux-gcc (GCC) 9.3.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.2-118-ge1578773-dirty
> git checkout 47e4937a4a7ca4184fd282791dfee76c6799966a
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>
> >> fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
> fs/erofs/zdata.c:282:22: sparse: sparse: non size-preserving integer to pointer cast
> fs/erofs/zdata.c:1094:24: sparse: sparse: non size-preserving integer to pointer cast
I don't think these are valid warnings.
All these three lines are using cmpxchg struct page * (which is equivalent to unsigned long
in these cmpxchg macros) and nothing special at all in my opinion (Especially the last two
lines).
+198 if (!cmpxchg_relaxed(pages, NULL, tagptr_cast_ptr(t)))
+282 if (!cmpxchg(clt->compressedpages++, NULL, page))
+1094 if (oldpage != cmpxchg(&pcl->compressed_pages[nr], oldpage, page)) {
btw, recently sparse warnings quite confuse me (p.s. they're all on alpha/s390/sparc archs and relate
to cmpxchg/xchg by accident), I have no idea what happened with sparse.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
2020-08-07 14:48 ` Gao Xiang
@ 2020-08-07 15:05 ` Luc Van Oostenryck
0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-08-07 15:05 UTC (permalink / raw)
To: Gao Xiang; +Cc: kernel test robot, kbuild-all, linux-kernel, Greg Kroah-Hartman
On Fri, Aug 07, 2020 at 10:48:12PM +0800, Gao Xiang wrote:
> On Fri, Aug 07, 2020 at 08:08:10PM +0800, kernel test robot wrote:
> > sparse warnings: (new ones prefixed by >>)
> >
> > >> fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
> > fs/erofs/zdata.c:282:22: sparse: sparse: non size-preserving integer to pointer cast
> > fs/erofs/zdata.c:1094:24: sparse: sparse: non size-preserving integer to pointer cast
>
> I don't think these are valid warnings.
Indeed, they're not.
> All these three lines are using cmpxchg struct page * (which is equivalent to unsigned long
> in these cmpxchg macros) and nothing special at all in my opinion (Especially the last two
> lines).
What is special is that s390 use __sync_val_compare_and_swap() to implement
cmpxchg(). This builtin has a return type which depends on its arguments
while sparse was always using 'int' as the return type.
A patch is on the way.
Regards,
-- Luc Van Oostenryck
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-07 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 12:08 fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast kernel test robot
2020-08-07 14:48 ` Gao Xiang
2020-08-07 15:05 ` Luc Van Oostenryck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®