linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rt-devel:linux-5.15.y-rt-rebase 85/155] drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2021-10-09 14:20 kernel test robot
  2021-10-11 10:42 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-10-09 14:20 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: kbuild-all, linux-kernel, Sebastian Andrzej Siewior

[-- Attachment #1: Type: text/plain, Size: 11802 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.15.y-rt-rebase
head:   d2f311fe375d0cf3b1f03bae1251036c93741332
commit: d227bdbf286b7591de778ab979d1e2343f41135b [85/155] md: raid5: Make raid5_percpu handling RT aware
config: alpha-randconfig-s032-20211009 (attached as .config)
compiler: alpha-linux-gcc (GCC) 11.2.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-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?id=d227bdbf286b7591de778ab979d1e2343f41135b
        git remote add rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
        git fetch --no-tags rt-devel linux-5.15.y-rt-rebase
        git checkout d227bdbf286b7591de778ab979d1e2343f41135b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha 

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 >>)
   drivers/md/raid5.c: note: in included file:
   drivers/md/raid5.h:270:14: sparse: sparse: array of flexible structures
   drivers/md/raid5.c:641:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:641:40: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:641:40: sparse:    struct md_rdev *
   drivers/md/raid5.c:643:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:643:32: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:643:32: sparse:    struct md_rdev *
   drivers/md/raid5.c:667:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:667:40: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:667:40: sparse:    struct md_rdev *
   drivers/md/raid5.c:669:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:669:32: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:669:32: sparse:    struct md_rdev *
   drivers/md/raid5.c:1101:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:1101:25: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:1101:25: sparse:    struct md_rdev *
   drivers/md/raid5.c:1103:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:1103:24: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:1103:24: sparse:    struct md_rdev *
>> drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
   drivers/md/raid5.c:2222:20: sparse:     expected struct spinlock [usertype] *lock
   drivers/md/raid5.c:2222:20: sparse:     got struct spinlock [noderef] __percpu *
   drivers/md/raid5.c:2281:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
   drivers/md/raid5.c:2281:22: sparse:     expected struct spinlock [usertype] *lock
   drivers/md/raid5.c:2281:22: sparse:     got struct spinlock [noderef] __percpu *
   drivers/md/raid5.c:3565:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:3565:32: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:3565:32: sparse:    struct md_rdev *
   drivers/md/raid5.c:3691:48: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:3691:48: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:3691:48: sparse:    struct md_rdev *
   drivers/md/raid5.c:3698:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:3698:32: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:3698:32: sparse:    struct md_rdev *
   drivers/md/raid5.c:3720:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:3720:16: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:3720:16: sparse:    struct md_rdev *
   drivers/md/raid5.c:4648:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4648:24: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4648:24: sparse:    struct md_rdev *
   drivers/md/raid5.c:4659:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4659:32: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4659:32: sparse:    struct md_rdev *
   drivers/md/raid5.c:4706:49: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4706:49: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4706:49: sparse:    struct md_rdev *
   drivers/md/raid5.c:4719:49: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4719:49: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4719:49: sparse:    struct md_rdev *
   drivers/md/raid5.c:4728:49: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4728:49: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4728:49: sparse:    struct md_rdev *
   drivers/md/raid5.c:4750:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:4750:40: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:4750:40: sparse:    struct md_rdev *
   drivers/md/raid5.c:5421:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:5421:16: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:5421:16: sparse:    struct md_rdev *
   drivers/md/raid5.c:5424:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:5424:24: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:5424:24: sparse:    struct md_rdev *
   drivers/md/raid5.c:7107:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
   drivers/md/raid5.c:7107:9: sparse:     expected struct spinlock [usertype] *lock
   drivers/md/raid5.c:7107:9: sparse:     got struct spinlock [noderef] __percpu *
   drivers/md/raid5.c:7813:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:7813:40: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:7813:40: sparse:    struct md_rdev *
   drivers/md/raid5.c:8026:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:8026:25: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:8026:25: sparse:    struct md_rdev *
   drivers/md/raid5.c:8042:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/raid5.c:8042:25: sparse:    struct md_rdev [noderef] __rcu *
   drivers/md/raid5.c:8042:25: sparse:    struct md_rdev *
   drivers/md/raid5.c:1476:16: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:1476:39: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:2208:54: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:2421:16: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:2423:9: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:2424:9: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7033:23: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7033:23: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7034:9: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7035:16: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7036:9: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7041:34: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7042:17: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7043:22: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:7107:9: sparse: sparse: dereference of noderef expression
   drivers/md/raid5.c:97:9: sparse: sparse: context imbalance in 'raid5_quiesce' - different lock contexts for basic block

vim +2222 drivers/md/raid5.c

  2210	
  2211	static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
  2212	{
  2213		int overlap_clear = 0, i, disks = sh->disks;
  2214		struct dma_async_tx_descriptor *tx = NULL;
  2215		struct r5conf *conf = sh->raid_conf;
  2216		int level = conf->level;
  2217		struct raid5_percpu *percpu;
  2218		unsigned long cpu;
  2219	
  2220		cpu = get_cpu_light();
  2221		percpu = per_cpu_ptr(conf->percpu, cpu);
> 2222		spin_lock(&percpu->lock);
  2223		if (test_bit(STRIPE_OP_BIOFILL, &ops_request)) {
  2224			ops_run_biofill(sh);
  2225			overlap_clear++;
  2226		}
  2227	
  2228		if (test_bit(STRIPE_OP_COMPUTE_BLK, &ops_request)) {
  2229			if (level < 6)
  2230				tx = ops_run_compute5(sh, percpu);
  2231			else {
  2232				if (sh->ops.target2 < 0 || sh->ops.target < 0)
  2233					tx = ops_run_compute6_1(sh, percpu);
  2234				else
  2235					tx = ops_run_compute6_2(sh, percpu);
  2236			}
  2237			/* terminate the chain if reconstruct is not set to be run */
  2238			if (tx && !test_bit(STRIPE_OP_RECONSTRUCT, &ops_request))
  2239				async_tx_ack(tx);
  2240		}
  2241	
  2242		if (test_bit(STRIPE_OP_PREXOR, &ops_request)) {
  2243			if (level < 6)
  2244				tx = ops_run_prexor5(sh, percpu, tx);
  2245			else
  2246				tx = ops_run_prexor6(sh, percpu, tx);
  2247		}
  2248	
  2249		if (test_bit(STRIPE_OP_PARTIAL_PARITY, &ops_request))
  2250			tx = ops_run_partial_parity(sh, percpu, tx);
  2251	
  2252		if (test_bit(STRIPE_OP_BIODRAIN, &ops_request)) {
  2253			tx = ops_run_biodrain(sh, tx);
  2254			overlap_clear++;
  2255		}
  2256	
  2257		if (test_bit(STRIPE_OP_RECONSTRUCT, &ops_request)) {
  2258			if (level < 6)
  2259				ops_run_reconstruct5(sh, percpu, tx);
  2260			else
  2261				ops_run_reconstruct6(sh, percpu, tx);
  2262		}
  2263	
  2264		if (test_bit(STRIPE_OP_CHECK, &ops_request)) {
  2265			if (sh->check_state == check_state_run)
  2266				ops_run_check_p(sh, percpu);
  2267			else if (sh->check_state == check_state_run_q)
  2268				ops_run_check_pq(sh, percpu, 0);
  2269			else if (sh->check_state == check_state_run_pq)
  2270				ops_run_check_pq(sh, percpu, 1);
  2271			else
  2272				BUG();
  2273		}
  2274	
  2275		if (overlap_clear && !sh->batch_head)
  2276			for (i = disks; i--; ) {
  2277				struct r5dev *dev = &sh->dev[i];
  2278				if (test_and_clear_bit(R5_Overlap, &dev->flags))
  2279					wake_up(&sh->raid_conf->wait_for_overlap);
  2280			}
  2281		spin_unlock(&percpu->lock);
  2282		put_cpu_light();
  2283	}
  2284	

---
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: 32727 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [rt-devel:linux-5.15.y-rt-rebase 85/155] drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces)
  2021-10-09 14:20 [rt-devel:linux-5.15.y-rt-rebase 85/155] drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
@ 2021-10-11 10:42 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-11 10:42 UTC (permalink / raw)
  To: kernel test robot; +Cc: Thomas Gleixner, kbuild-all, linux-kernel

On 2021-10-09 22:20:57 [+0800], kernel test robot wrote:
> sparse warnings: (new ones prefixed by >>)
> >> drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
>    drivers/md/raid5.c:2222:20: sparse:     expected struct spinlock [usertype] *lock
>    drivers/md/raid5.c:2222:20: sparse:     got struct spinlock [noderef] __percpu *
>    drivers/md/raid5.c:2281:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
>    drivers/md/raid5.c:2281:22: sparse:     expected struct spinlock [usertype] *lock
>    drivers/md/raid5.c:2281:22: sparse:     got struct spinlock [noderef] __percpu *

I think the code itself is correct but sparse got confused by the
definition of the struct. Defining raid5_percpu on its own makes the
warning go away:

diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -559,6 +559,17 @@ struct r5pending_data {
 	struct bio_list bios;
 };
 
+/* per cpu variables */
+struct raid5_percpu {
+	spinlock_t	lock;		/* Protection for -RT */
+	struct page	*spare_page; /* Used when checking P/Q in raid6 */
+	void		*scribble;  /* space for constructing buffer
+				     * lists and performing address
+				     * conversions
+				     */
+	int scribble_obj_size;
+};
+
 struct r5conf {
 	struct hlist_head	*stripe_hashtbl;
 	/* only protect corresponding hash list and inactive_list */
@@ -634,15 +645,7 @@ struct r5conf {
 					    */
 	int			recovery_disabled;
 	/* per cpu variables */
-	struct raid5_percpu {
-		spinlock_t	lock;		/* Protection for -RT */
-		struct page	*spare_page; /* Used when checking P/Q in raid6 */
-		void		*scribble;  /* space for constructing buffer
-					     * lists and performing address
-					     * conversions
-					     */
-		int scribble_obj_size;
-	} __percpu *percpu;
+	struct raid5_percpu	__percpu *percpu;
 	int scribble_disks;
 	int scribble_sectors;
 	struct hlist_node node;

The RCU warnings look valid since there are __rcu annotations.

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-11 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 14:20 [rt-devel:linux-5.15.y-rt-rebase 85/155] drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2021-10-11 10:42 ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).