Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] block: Use non _rcu version of list functions for tag_set_list
@ 2020-07-28 13:29 Daniel Wagner
  2020-07-28 14:13 ` Hannes Reinecke
  2020-07-28 15:37 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Wagner @ 2020-07-28 13:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Daniel Wagner, Ming Lei

tag_set_list is only accessed under the tag_set_lock lock. There is
no need for using the _rcu list functions.

The _rcu list function were introduced to allow read access to the
tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it
safe to use RCU to iterate over blk_mq_tag_set.tag_list") and
05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart"").
Those changes got reverted later but the cleanup commit missed a
couple of places to undo the changes.

Fixes: 97889f9ac24f ("blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set()"
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 block/blk-mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index e32cb0217135..14ee7506f32f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2792,7 +2792,7 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
 	struct blk_mq_tag_set *set = q->tag_set;
 
 	mutex_lock(&set->tag_list_lock);
-	list_del_rcu(&q->tag_set_list);
+	list_del(&q->tag_set_list);
 	if (list_is_singular(&set->tag_list)) {
 		/* just transitioned to unshared */
 		set->flags &= ~BLK_MQ_F_TAG_SHARED;
@@ -2819,7 +2819,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
 	}
 	if (set->flags & BLK_MQ_F_TAG_SHARED)
 		queue_set_hctx_shared(q, true);
-	list_add_tail_rcu(&q->tag_set_list, &set->tag_list);
+	list_add_tail(&q->tag_set_list, &set->tag_list);
 
 	mutex_unlock(&set->tag_list_lock);
 }
-- 
2.16.4


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

* Re: [PATCH] block: Use non _rcu version of list functions for tag_set_list
  2020-07-28 13:29 [PATCH] block: Use non _rcu version of list functions for tag_set_list Daniel Wagner
@ 2020-07-28 14:13 ` Hannes Reinecke
  2020-07-28 15:37 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2020-07-28 14:13 UTC (permalink / raw)
  To: Daniel Wagner, Jens Axboe; +Cc: linux-block, linux-kernel, Ming Lei

On 7/28/20 3:29 PM, Daniel Wagner wrote:
> tag_set_list is only accessed under the tag_set_lock lock. There is
> no need for using the _rcu list functions.
> 
> The _rcu list function were introduced to allow read access to the
> tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it
> safe to use RCU to iterate over blk_mq_tag_set.tag_list") and
> 05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart"").
> Those changes got reverted later but the cleanup commit missed a
> couple of places to undo the changes.
> 
> Fixes: 97889f9ac24f ("blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set()"
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   block/blk-mq.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index e32cb0217135..14ee7506f32f 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -2792,7 +2792,7 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
>   	struct blk_mq_tag_set *set = q->tag_set;
>   
>   	mutex_lock(&set->tag_list_lock);
> -	list_del_rcu(&q->tag_set_list);
> +	list_del(&q->tag_set_list);
>   	if (list_is_singular(&set->tag_list)) {
>   		/* just transitioned to unshared */
>   		set->flags &= ~BLK_MQ_F_TAG_SHARED;
> @@ -2819,7 +2819,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
>   	}
>   	if (set->flags & BLK_MQ_F_TAG_SHARED)
>   		queue_set_hctx_shared(q, true);
> -	list_add_tail_rcu(&q->tag_set_list, &set->tag_list);
> +	list_add_tail(&q->tag_set_list, &set->tag_list);
>   
>   	mutex_unlock(&set->tag_list_lock);
>   }
> 
Indeed.

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH] block: Use non _rcu version of list functions for tag_set_list
  2020-07-28 13:29 [PATCH] block: Use non _rcu version of list functions for tag_set_list Daniel Wagner
  2020-07-28 14:13 ` Hannes Reinecke
@ 2020-07-28 15:37 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-07-28 15:37 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-block, linux-kernel, Ming Lei

On 7/28/20 7:29 AM, Daniel Wagner wrote:
> tag_set_list is only accessed under the tag_set_lock lock. There is
> no need for using the _rcu list functions.
> 
> The _rcu list function were introduced to allow read access to the
> tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it
> safe to use RCU to iterate over blk_mq_tag_set.tag_list") and
> 05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart"").
> Those changes got reverted later but the cleanup commit missed a
> couple of places to undo the changes.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 13:29 [PATCH] block: Use non _rcu version of list functions for tag_set_list Daniel Wagner
2020-07-28 14:13 ` Hannes Reinecke
2020-07-28 15:37 ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git