[drm-misc:drm-misc-next 1/1] drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
From: kernel test robot
Date: Tue Jun 07 2022 - 15:08:39 EST
tree: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head: dfa687bffc8a4a21ed929c7dececf01b8f1f52ee
commit: 14374e3eee1b02dbf162e1dd75b789373f07ef43 [1/1] dma-buf: cleanup dma_fence_chain_walk
config: ia64-randconfig-s032-20220605 (https://download.01.org/0day-ci/archive/20220608/202206080105.4Bm4v1ri-lkp@xxxxxxxxx/config)
compiler: ia64-linux-gcc (GCC) 11.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.4-26-gb3cf30ba-dirty
git remote add drm-misc git://anongit.freedesktop.org/drm/drm-misc
git fetch --no-tags drm-misc drm-misc-next
git checkout 14374e3eee1b02dbf162e1dd75b789373f07ef43
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/dma-buf/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/dma-buf/dma-fence-chain.c:65:23: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +65 drivers/dma-buf/dma-fence-chain.c
30
31 /**
32 * dma_fence_chain_walk - chain walking function
33 * @fence: current chain node
34 *
35 * Walk the chain to the next node. Returns the next fence or NULL if we are at
36 * the end of the chain. Garbage collects chain nodes which are already
37 * signaled.
38 */
39 struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence)
40 {
41 struct dma_fence_chain *chain, *prev_chain;
42 struct dma_fence *prev, *replacement, *tmp;
43
44 chain = to_dma_fence_chain(fence);
45 if (!chain) {
46 dma_fence_put(fence);
47 return NULL;
48 }
49
50 while ((prev = dma_fence_chain_get_prev(chain))) {
51
52 prev_chain = to_dma_fence_chain(prev);
53 if (prev_chain) {
54 if (!dma_fence_is_signaled(prev_chain->fence))
55 break;
56
57 replacement = dma_fence_chain_get_prev(prev_chain);
58 } else {
59 if (!dma_fence_is_signaled(prev))
60 break;
61
62 replacement = NULL;
63 }
64
> 65 tmp = unrcu_pointer(cmpxchg(&chain->prev, RCU_INITIALIZER(prev),
66 RCU_INITIALIZER(replacement)));
67 if (tmp == prev)
68 dma_fence_put(tmp);
69 else
70 dma_fence_put(replacement);
71 dma_fence_put(prev);
72 }
73
74 dma_fence_put(fence);
75 return prev;
76 }
77 EXPORT_SYMBOL(dma_fence_chain_walk);
78
--
0-DAY CI Kernel Test Service
https://01.org/lkp