LKML Archive mirror
 help / color / mirror / Atom feed
* drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966 (fwd)
@ 2024-04-03 16:47 Julia Lawall
  2024-04-03 17:06 ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2024-04-03 16:47 UTC (permalink / raw
  To: Mike Snitzer, Matthew Sakai, linux-kernel, oe-kbuild-all

Hello,

Please check whether the lock should be released before the returns.

julia

---------- Forwarded message ----------
Date: Wed, 3 Apr 2024 22:16:44 +0800
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Mike Snitzer <snitzer@kernel.org>
CC: Matthew Sakai <msakai@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3e92c1e6cd876754b64d1998ec0a01800ed954a6
commit: f36b1d3ba533d21b5b793623f05761b0297d114e dm vdo: use a proper Makefile for dm-vdo
date:   6 weeks ago
:::::: branch date: 11 hours ago
:::::: commit date: 6 weeks ago
config: s390-randconfig-r052-20240403 (https://download.01.org/0day-ci/archive/20240403/202404032212.NV7EJ2Zj-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202404032212.NV7EJ2Zj-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966
   drivers/md/dm-vdo/data-vio.c:972:2-8: preceding lock on line 966

vim +969 drivers/md/dm-vdo/data-vio.c

79535a7881c0cb Matthew Sakai 2023-11-16  952
79535a7881c0cb Matthew Sakai 2023-11-16  953  /**
79535a7881c0cb Matthew Sakai 2023-11-16  954   * vdo_launch_bio() - Acquire a data_vio from the pool, assign the bio to it, and launch it.
79535a7881c0cb Matthew Sakai 2023-11-16  955   *
79535a7881c0cb Matthew Sakai 2023-11-16  956   * This will block if data_vios or discard permits are not available.
79535a7881c0cb Matthew Sakai 2023-11-16  957   */
79535a7881c0cb Matthew Sakai 2023-11-16  958  void vdo_launch_bio(struct data_vio_pool *pool, struct bio *bio)
79535a7881c0cb Matthew Sakai 2023-11-16  959  {
79535a7881c0cb Matthew Sakai 2023-11-16  960  	struct data_vio *data_vio;
79535a7881c0cb Matthew Sakai 2023-11-16  961
79535a7881c0cb Matthew Sakai 2023-11-16  962  	ASSERT_LOG_ONLY(!vdo_is_state_quiescent(&pool->state),
79535a7881c0cb Matthew Sakai 2023-11-16  963  			"data_vio_pool not quiescent on acquire");
79535a7881c0cb Matthew Sakai 2023-11-16  964
79535a7881c0cb Matthew Sakai 2023-11-16  965  	bio->bi_private = (void *) jiffies;
79535a7881c0cb Matthew Sakai 2023-11-16 @966  	spin_lock(&pool->lock);
79535a7881c0cb Matthew Sakai 2023-11-16  967  	if ((bio_op(bio) == REQ_OP_DISCARD) &&
79535a7881c0cb Matthew Sakai 2023-11-16  968  	    !acquire_permit(&pool->discard_limiter, bio))
79535a7881c0cb Matthew Sakai 2023-11-16 @969  		return;
79535a7881c0cb Matthew Sakai 2023-11-16  970
79535a7881c0cb Matthew Sakai 2023-11-16  971  	if (!acquire_permit(&pool->limiter, bio))
79535a7881c0cb Matthew Sakai 2023-11-16  972  		return;
79535a7881c0cb Matthew Sakai 2023-11-16  973
79535a7881c0cb Matthew Sakai 2023-11-16  974  	data_vio = get_available_data_vio(pool);
79535a7881c0cb Matthew Sakai 2023-11-16  975  	spin_unlock(&pool->lock);
79535a7881c0cb Matthew Sakai 2023-11-16  976  	launch_bio(pool->completion.vdo, data_vio, bio);
79535a7881c0cb Matthew Sakai 2023-11-16  977  }
79535a7881c0cb Matthew Sakai 2023-11-16  978

:::::: The code at line 969 was first introduced by commit
:::::: 79535a7881c0cbe95063a2670d840cc950ae9282 dm vdo: add data_vio, the request object which services incoming bios

:::::: TO: Matthew Sakai <msakai@redhat.com>
:::::: CC: Mike Snitzer <snitzer@kernel.org>

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

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

* Re: drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966 (fwd)
  2024-04-03 16:47 drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966 (fwd) Julia Lawall
@ 2024-04-03 17:06 ` Mike Snitzer
  2024-04-03 17:09   ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2024-04-03 17:06 UTC (permalink / raw
  To: Julia Lawall; +Cc: Matthew Sakai, linux-kernel, oe-kbuild-all, dm-devel

On Wed, Apr 03 2024 at 12:47P -0400,
Julia Lawall <julia.lawall@inria.fr> wrote:

> Hello,
> 
> Please check whether the lock should be released before the returns.
> 
> julia
> 
> ---------- Forwarded message ----------
> Date: Wed, 3 Apr 2024 22:16:44 +0800
> From: kernel test robot <lkp@intel.com>
> To: oe-kbuild@lists.linux.dev
> Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
> Subject: drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966
> 
> BCC: lkp@intel.com
> CC: oe-kbuild-all@lists.linux.dev
> CC: linux-kernel@vger.kernel.org
> TO: Mike Snitzer <snitzer@kernel.org>
> CC: Matthew Sakai <msakai@redhat.com>
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   3e92c1e6cd876754b64d1998ec0a01800ed954a6
> commit: f36b1d3ba533d21b5b793623f05761b0297d114e dm vdo: use a proper Makefile for dm-vdo
> date:   6 weeks ago
> :::::: branch date: 11 hours ago
> :::::: commit date: 6 weeks ago
> config: s390-randconfig-r052-20240403 (https://download.01.org/0day-ci/archive/20240403/202404032212.NV7EJ2Zj-lkp@intel.com/config)
> compiler: s390-linux-gcc (GCC) 13.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Julia Lawall <julia.lawall@inria.fr>
> | Closes: https://lore.kernel.org/r/202404032212.NV7EJ2Zj-lkp@intel.com/
> 
> cocci warnings: (new ones prefixed by >>)
> >> drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966
>    drivers/md/dm-vdo/data-vio.c:972:2-8: preceding lock on line 966
> 
> vim +969 drivers/md/dm-vdo/data-vio.c
> 
> 79535a7881c0cb Matthew Sakai 2023-11-16  952
> 79535a7881c0cb Matthew Sakai 2023-11-16  953  /**
> 79535a7881c0cb Matthew Sakai 2023-11-16  954   * vdo_launch_bio() - Acquire a data_vio from the pool, assign the bio to it, and launch it.
> 79535a7881c0cb Matthew Sakai 2023-11-16  955   *
> 79535a7881c0cb Matthew Sakai 2023-11-16  956   * This will block if data_vios or discard permits are not available.
> 79535a7881c0cb Matthew Sakai 2023-11-16  957   */
> 79535a7881c0cb Matthew Sakai 2023-11-16  958  void vdo_launch_bio(struct data_vio_pool *pool, struct bio *bio)
> 79535a7881c0cb Matthew Sakai 2023-11-16  959  {
> 79535a7881c0cb Matthew Sakai 2023-11-16  960  	struct data_vio *data_vio;
> 79535a7881c0cb Matthew Sakai 2023-11-16  961
> 79535a7881c0cb Matthew Sakai 2023-11-16  962  	ASSERT_LOG_ONLY(!vdo_is_state_quiescent(&pool->state),
> 79535a7881c0cb Matthew Sakai 2023-11-16  963  			"data_vio_pool not quiescent on acquire");
> 79535a7881c0cb Matthew Sakai 2023-11-16  964
> 79535a7881c0cb Matthew Sakai 2023-11-16  965  	bio->bi_private = (void *) jiffies;
> 79535a7881c0cb Matthew Sakai 2023-11-16 @966  	spin_lock(&pool->lock);
> 79535a7881c0cb Matthew Sakai 2023-11-16  967  	if ((bio_op(bio) == REQ_OP_DISCARD) &&
> 79535a7881c0cb Matthew Sakai 2023-11-16  968  	    !acquire_permit(&pool->discard_limiter, bio))
> 79535a7881c0cb Matthew Sakai 2023-11-16 @969  		return;
> 79535a7881c0cb Matthew Sakai 2023-11-16  970
> 79535a7881c0cb Matthew Sakai 2023-11-16  971  	if (!acquire_permit(&pool->limiter, bio))
> 79535a7881c0cb Matthew Sakai 2023-11-16  972  		return;
> 79535a7881c0cb Matthew Sakai 2023-11-16  973
> 79535a7881c0cb Matthew Sakai 2023-11-16  974  	data_vio = get_available_data_vio(pool);
> 79535a7881c0cb Matthew Sakai 2023-11-16  975  	spin_unlock(&pool->lock);
> 79535a7881c0cb Matthew Sakai 2023-11-16  976  	launch_bio(pool->completion.vdo, data_vio, bio);
> 79535a7881c0cb Matthew Sakai 2023-11-16  977  }
> 79535a7881c0cb Matthew Sakai 2023-11-16  978
> 
> :::::: The code at line 969 was first introduced by commit
> :::::: 79535a7881c0cbe95063a2670d840cc950ae9282 dm vdo: add data_vio, the request object which services incoming bios
> 
> :::::: TO: Matthew Sakai <msakai@redhat.com>
> :::::: CC: Mike Snitzer <snitzer@kernel.org>
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 

Thanks for the report but this is reacting to older code. Changes were
made to address sparse's concerns about this same code, please see: 
commit 872564c501b7 ("dm vdo data-vio: silence sparse warnings about
locking context imbalance").

If wait_permit()'s sparse __releases annotation is somehow
insufficient for silencing cocci please let me know.

Thanks,
Mike

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

* Re: drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966 (fwd)
  2024-04-03 17:06 ` Mike Snitzer
@ 2024-04-03 17:09   ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2024-04-03 17:09 UTC (permalink / raw
  To: Mike Snitzer; +Cc: Matthew Sakai, linux-kernel, oe-kbuild-all, dm-devel



On Wed, 3 Apr 2024, Mike Snitzer wrote:

> On Wed, Apr 03 2024 at 12:47P -0400,
> Julia Lawall <julia.lawall@inria.fr> wrote:
>
> > Hello,
> >
> > Please check whether the lock should be released before the returns.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Wed, 3 Apr 2024 22:16:44 +0800
> > From: kernel test robot <lkp@intel.com>
> > To: oe-kbuild@lists.linux.dev
> > Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
> > Subject: drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966
> >
> > BCC: lkp@intel.com
> > CC: oe-kbuild-all@lists.linux.dev
> > CC: linux-kernel@vger.kernel.org
> > TO: Mike Snitzer <snitzer@kernel.org>
> > CC: Matthew Sakai <msakai@redhat.com>
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   3e92c1e6cd876754b64d1998ec0a01800ed954a6
> > commit: f36b1d3ba533d21b5b793623f05761b0297d114e dm vdo: use a proper Makefile for dm-vdo
> > date:   6 weeks ago
> > :::::: branch date: 11 hours ago
> > :::::: commit date: 6 weeks ago
> > config: s390-randconfig-r052-20240403 (https://download.01.org/0day-ci/archive/20240403/202404032212.NV7EJ2Zj-lkp@intel.com/config)
> > compiler: s390-linux-gcc (GCC) 13.2.0
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Julia Lawall <julia.lawall@inria.fr>
> > | Closes: https://lore.kernel.org/r/202404032212.NV7EJ2Zj-lkp@intel.com/
> >
> > cocci warnings: (new ones prefixed by >>)
> > >> drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966
> >    drivers/md/dm-vdo/data-vio.c:972:2-8: preceding lock on line 966
> >
> > vim +969 drivers/md/dm-vdo/data-vio.c
> >
> > 79535a7881c0cb Matthew Sakai 2023-11-16  952
> > 79535a7881c0cb Matthew Sakai 2023-11-16  953  /**
> > 79535a7881c0cb Matthew Sakai 2023-11-16  954   * vdo_launch_bio() - Acquire a data_vio from the pool, assign the bio to it, and launch it.
> > 79535a7881c0cb Matthew Sakai 2023-11-16  955   *
> > 79535a7881c0cb Matthew Sakai 2023-11-16  956   * This will block if data_vios or discard permits are not available.
> > 79535a7881c0cb Matthew Sakai 2023-11-16  957   */
> > 79535a7881c0cb Matthew Sakai 2023-11-16  958  void vdo_launch_bio(struct data_vio_pool *pool, struct bio *bio)
> > 79535a7881c0cb Matthew Sakai 2023-11-16  959  {
> > 79535a7881c0cb Matthew Sakai 2023-11-16  960  	struct data_vio *data_vio;
> > 79535a7881c0cb Matthew Sakai 2023-11-16  961
> > 79535a7881c0cb Matthew Sakai 2023-11-16  962  	ASSERT_LOG_ONLY(!vdo_is_state_quiescent(&pool->state),
> > 79535a7881c0cb Matthew Sakai 2023-11-16  963  			"data_vio_pool not quiescent on acquire");
> > 79535a7881c0cb Matthew Sakai 2023-11-16  964
> > 79535a7881c0cb Matthew Sakai 2023-11-16  965  	bio->bi_private = (void *) jiffies;
> > 79535a7881c0cb Matthew Sakai 2023-11-16 @966  	spin_lock(&pool->lock);
> > 79535a7881c0cb Matthew Sakai 2023-11-16  967  	if ((bio_op(bio) == REQ_OP_DISCARD) &&
> > 79535a7881c0cb Matthew Sakai 2023-11-16  968  	    !acquire_permit(&pool->discard_limiter, bio))
> > 79535a7881c0cb Matthew Sakai 2023-11-16 @969  		return;
> > 79535a7881c0cb Matthew Sakai 2023-11-16  970
> > 79535a7881c0cb Matthew Sakai 2023-11-16  971  	if (!acquire_permit(&pool->limiter, bio))
> > 79535a7881c0cb Matthew Sakai 2023-11-16  972  		return;
> > 79535a7881c0cb Matthew Sakai 2023-11-16  973
> > 79535a7881c0cb Matthew Sakai 2023-11-16  974  	data_vio = get_available_data_vio(pool);
> > 79535a7881c0cb Matthew Sakai 2023-11-16  975  	spin_unlock(&pool->lock);
> > 79535a7881c0cb Matthew Sakai 2023-11-16  976  	launch_bio(pool->completion.vdo, data_vio, bio);
> > 79535a7881c0cb Matthew Sakai 2023-11-16  977  }
> > 79535a7881c0cb Matthew Sakai 2023-11-16  978
> >
> > :::::: The code at line 969 was first introduced by commit
> > :::::: 79535a7881c0cbe95063a2670d840cc950ae9282 dm vdo: add data_vio, the request object which services incoming bios
> >
> > :::::: TO: Matthew Sakai <msakai@redhat.com>
> > :::::: CC: Mike Snitzer <snitzer@kernel.org>
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> >
>
> Thanks for the report but this is reacting to older code. Changes were
> made to address sparse's concerns about this same code, please see:
> commit 872564c501b7 ("dm vdo data-vio: silence sparse warnings about
> locking context imbalance").
>
> If wait_permit()'s sparse __releases annotation is somehow
> insufficient for silencing cocci please let me know.

I don't think the Coccinelle rule checks the annotation.  But the warning
should not be negerated again.

thanks,
julia

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

end of thread, other threads:[~2024-04-03 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 16:47 drivers/md/dm-vdo/data-vio.c:969:2-8: preceding lock on line 966 (fwd) Julia Lawall
2024-04-03 17:06 ` Mike Snitzer
2024-04-03 17:09   ` Julia Lawall

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 read-only IMAP folder(s) and NNTP newsgroup(s).