Re: [PATCH v3 3/3] md: protect md_thread with rcu

From: kernel test robot
Date: Thu Mar 30 2023 - 14:43:00 EST


Hi Yu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on song-md/md-next]
[also build test WARNING on device-mapper-dm/for-next linus/master v6.3-rc4 next-20230330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Yu-Kuai/md-pass-a-md_thread-pointer-to-md_register_thread/20230330-202251
base: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
patch link: https://lore.kernel.org/r/20230330202046.795213-4-yukuai1%40huaweicloud.com
patch subject: [PATCH v3 3/3] md: protect md_thread with rcu
config: x86_64-randconfig-s023 (https://download.01.org/0day-ci/archive/20230331/202303310252.5OJzxk7h-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/b6edd339e54dc14576816f285b99e0e1815ed1e0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Kuai/md-pass-a-md_thread-pointer-to-md_register_thread/20230330-202251
git checkout b6edd339e54dc14576816f285b99e0e1815ed1e0
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 olddefconfig
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/md/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303310252.5OJzxk7h-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/md/md.c:7905:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> drivers/md/md.c:7905:18: sparse: struct md_thread [noderef] __rcu *
>> drivers/md/md.c:7905:18: sparse: struct md_thread *
drivers/md/md.c:7939:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/md.c:7939:9: sparse: struct md_thread [noderef] __rcu *
drivers/md/md.c:7939:9: sparse: struct md_thread *
drivers/md/md.c:7952:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/md.c:7952:9: sparse: struct md_thread [noderef] __rcu *
drivers/md/md.c:7952:9: sparse: struct md_thread *

vim +7905 drivers/md/md.c

7899
7900 void md_wakeup_thread(struct md_thread **threadp)
7901 {
7902 struct md_thread *thread;
7903
7904 rcu_read_lock();
> 7905 thread = rcu_dereference(*threadp);
7906 if (thread) {
7907 pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm);
7908 set_bit(THREAD_WAKEUP, &thread->flags);
7909 wake_up(&thread->wqueue);
7910 }
7911 rcu_read_unlock();
7912 }
7913 EXPORT_SYMBOL(md_wakeup_thread);
7914

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests