Re: [PATCH] blk-mq: add missing call to srcu_barrier() in blk_mq_free_tag_set()

"Zqiang" <[email protected]>
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
> 
> Commit 05c3e88488ed ("srcu: Queue sdp->work when the delay timer is
> successfully deleted") added a check in cleanup_srcu_struct() if the
> call to srcu_barrier() has been made before calling it, which
> revealed a missing call to srcu_barrier() before calling
> cleanup_srcu_struct(set->srcu). Fix this.


This warnings should be fix in cleanup_srcu_struct().
https://lore.kernel.org/oe-lkp/[email protected]/

and the set->srcu only be used by synchronize_srcu(), there are no
call_srcu(), so the srcu_barrier() should not be invoke before cleanup

Thanks
Zqiang



> 
> Signed-off-by: Marek Szyprowski <[email protected]>
> ---
> This fixes the following issue observed recently in linux-next:
> ------------[ cut here ]------------
>  WARNING: kernel/rcu/srcutree.c:706 at cleanup_srcu_struct+0x194/0x3d4, CPU#1: kworker/1:2/156
>  Modules linked in: s5p_mfc exynos_gsc s5p_jpeg videobuf2_dma_contig v4l2_mem2mem videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc
>  CPU: 1 UID: 0 PID: 156 Comm: kworker/1:2 Not tainted 7.2.0-rc3-00006-g05c3e88488ed-dirty #13430 PREEMPT
>  Hardware name: Samsung Exynos (Flattened Device Tree)
>  Workqueue: usb_hub_wq hub_event
>  Call trace:
>  unwind_backtrace from show_stack+0x10/0x14
>  show_stack from dump_stack_lvl+0x6c/0x8c
>  dump_stack_lvl from __warn+0x90/0x204
>  __warn from warn_slowpath_fmt+0x1b4/0x1bc
>  warn_slowpath_fmt from cleanup_srcu_struct+0x194/0x3d4
>  cleanup_srcu_struct from blk_mq_free_tag_set+0x138/0x158
>  blk_mq_free_tag_set from scsi_mq_free_tags+0x10/0x1c
>  scsi_mq_free_tags from scsi_remove_host+0x14c/0x170
>  scsi_remove_host from uas_disconnect+0x70/0x84
>  uas_disconnect from usb_unbind_interface+0x78/0x2b4
>  usb_unbind_interface from device_release_driver_internal+0x194/0x208
>  device_release_driver_internal from bus_remove_device+0xf8/0x1c8
>  bus_remove_device from device_del+0x138/0x3b0
>  device_del from usb_disable_device+0xec/0x22c
>  usb_disable_device from usb_disconnect+0xf8/0x2bc
>  usb_disconnect from hub_event+0x9a8/0x1c3c
>  hub_event from process_one_work+0x258/0x798
>  process_one_work from worker_thread+0x1bc/0x3cc
>  worker_thread from kthread+0x138/0x16c
>  kthread from ret_from_fork+0x14/0x28
>  Exception stack(0xf0dfdfb0 to 0xf0dfdff8)
>  dfa0: 00000000 00000000 00000000 00000000
>  dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>  dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
>  irq event stamp: 23097
>  hardirqs last enabled at (23109): [<c0100bf8>] __irq_svc+0xb8/0xd0
>  hardirqs last disabled at (23118): [<c0100b94>] __irq_svc+0x54/0xd0
>  softirqs last enabled at (23094): [<c013ef54>] handle_softirqs+0x32c/0x58c
>  softirqs last disabled at (23065): [<c013f360>] __irq_exit_rcu+0x144/0x1f0
>  ---[ end trace 0000000000000000 ]---
> ---
>  block/blk-mq.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 2c850330a32b..a26a11c73ee3 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -4975,6 +4975,7 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set)
>  srcu_barrier(&set->tags_srcu);
>  cleanup_srcu_struct(&set->tags_srcu);
>  if (set->flags & BLK_MQ_F_BLOCKING) {
> + srcu_barrier(set->srcu);
>  cleanup_srcu_struct(set->srcu);
>  kfree(set->srcu);
>  }
> -- 
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.