From a695904e54f2c2b99a8a1725ca7d09e009fc3d72 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Jul 2021 15:50:32 +0200 Subject: [PATCH] drop bfq patch from 5.12 and 5.13 --- ...d-request-already-in-bfq_requests_me.patch | 111 ------------------ queue-5.12/series | 1 - ...d-request-already-in-bfq_requests_me.patch | 111 ------------------ queue-5.13/series | 1 - 4 files changed, 224 deletions(-) delete mode 100644 queue-5.12/bfq-remove-merged-request-already-in-bfq_requests_me.patch delete mode 100644 queue-5.13/bfq-remove-merged-request-already-in-bfq_requests_me.patch diff --git a/queue-5.12/bfq-remove-merged-request-already-in-bfq_requests_me.patch b/queue-5.12/bfq-remove-merged-request-already-in-bfq_requests_me.patch deleted file mode 100644 index 77c9d2d3d87..00000000000 --- a/queue-5.12/bfq-remove-merged-request-already-in-bfq_requests_me.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 1ccb42d3d65a81a95c1d2d730aea9eabc180210b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 23 Jun 2021 11:36:33 +0200 -Subject: bfq: Remove merged request already in bfq_requests_merged() - -From: Jan Kara - -[ Upstream commit a921c655f2033dd1ce1379128efe881dda23ea37 ] - -Currently, bfq does very little in bfq_requests_merged() and handles all -the request cleanup in bfq_finish_requeue_request() called from -blk_mq_free_request(). That is currently safe only because -blk_mq_free_request() is called shortly after bfq_requests_merged() -while bfqd->lock is still held. However to fix a lock inversion between -bfqd->lock and ioc->lock, we need to call blk_mq_free_request() after -dropping bfqd->lock. That would mean that already merged request could -be seen by other processes inside bfq queues and possibly dispatched to -the device which is wrong. So move cleanup of the request from -bfq_finish_requeue_request() to bfq_requests_merged(). - -Acked-by: Paolo Valente -Signed-off-by: Jan Kara -Link: https://lore.kernel.org/r/20210623093634.27879-2-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Sasha Levin ---- - block/bfq-iosched.c | 41 +++++++++++++---------------------------- - 1 file changed, 13 insertions(+), 28 deletions(-) - -diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c -index bc319931d2b3..9a180c4b9605 100644 ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -2376,7 +2376,7 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, - *next_bfqq = bfq_init_rq(next); - - if (!bfqq) -- return; -+ goto remove; - - /* - * If next and rq belong to the same bfq_queue and next is older -@@ -2399,6 +2399,14 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, - bfqq->next_rq = rq; - - bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); -+remove: -+ /* Merged request may be in the IO scheduler. Remove it. */ -+ if (!RB_EMPTY_NODE(&next->rb_node)) { -+ bfq_remove_request(next->q, next); -+ if (next_bfqq) -+ bfqg_stats_update_io_remove(bfqq_group(next_bfqq), -+ next->cmd_flags); -+ } - } - - /* Must be called with bfqq != NULL */ -@@ -6015,6 +6023,7 @@ static void bfq_finish_requeue_request(struct request *rq) - { - struct bfq_queue *bfqq = RQ_BFQQ(rq); - struct bfq_data *bfqd; -+ unsigned long flags; - - /* - * rq either is not associated with any icq, or is an already -@@ -6032,39 +6041,15 @@ static void bfq_finish_requeue_request(struct request *rq) - rq->io_start_time_ns, - rq->cmd_flags); - -+ spin_lock_irqsave(&bfqd->lock, flags); - if (likely(rq->rq_flags & RQF_STARTED)) { -- unsigned long flags; -- -- spin_lock_irqsave(&bfqd->lock, flags); -- - if (rq == bfqd->waited_rq) - bfq_update_inject_limit(bfqd, bfqq); - - bfq_completed_request(bfqq, bfqd); -- bfq_finish_requeue_request_body(bfqq); -- -- spin_unlock_irqrestore(&bfqd->lock, flags); -- } else { -- /* -- * Request rq may be still/already in the scheduler, -- * in which case we need to remove it (this should -- * never happen in case of requeue). And we cannot -- * defer such a check and removal, to avoid -- * inconsistencies in the time interval from the end -- * of this function to the start of the deferred work. -- * This situation seems to occur only in process -- * context, as a consequence of a merge. In the -- * current version of the code, this implies that the -- * lock is held. -- */ -- -- if (!RB_EMPTY_NODE(&rq->rb_node)) { -- bfq_remove_request(rq->q, rq); -- bfqg_stats_update_io_remove(bfqq_group(bfqq), -- rq->cmd_flags); -- } -- bfq_finish_requeue_request_body(bfqq); - } -+ bfq_finish_requeue_request_body(bfqq); -+ spin_unlock_irqrestore(&bfqd->lock, flags); - - /* - * Reset private fields. In case of a requeue, this allows --- -2.30.2 - diff --git a/queue-5.12/series b/queue-5.12/series index 13548c5f2d9..aa89e74c535 100644 --- a/queue-5.12/series +++ b/queue-5.12/series @@ -238,7 +238,6 @@ acpi-tables-add-custom-dsdt-file-as-makefile-prerequ.patch smb3-fix-possible-access-to-uninitialized-pointer-to.patch hid-wacom-correct-base-usage-for-capacitive-expressk.patch cifs-fix-missing-spinlock-around-update-to-ses-statu.patch -bfq-remove-merged-request-already-in-bfq_requests_me.patch mailbox-qcom-use-platform_devid_auto-to-register-pla.patch block-fix-discard-request-merge.patch kthread_worker-fix-return-value-when-kthread_mod_del.patch diff --git a/queue-5.13/bfq-remove-merged-request-already-in-bfq_requests_me.patch b/queue-5.13/bfq-remove-merged-request-already-in-bfq_requests_me.patch deleted file mode 100644 index 04a1fa43d5a..00000000000 --- a/queue-5.13/bfq-remove-merged-request-already-in-bfq_requests_me.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 5847d8f0fde2022a5569a442814a05f2c5aa5233 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 23 Jun 2021 11:36:33 +0200 -Subject: bfq: Remove merged request already in bfq_requests_merged() - -From: Jan Kara - -[ Upstream commit a921c655f2033dd1ce1379128efe881dda23ea37 ] - -Currently, bfq does very little in bfq_requests_merged() and handles all -the request cleanup in bfq_finish_requeue_request() called from -blk_mq_free_request(). That is currently safe only because -blk_mq_free_request() is called shortly after bfq_requests_merged() -while bfqd->lock is still held. However to fix a lock inversion between -bfqd->lock and ioc->lock, we need to call blk_mq_free_request() after -dropping bfqd->lock. That would mean that already merged request could -be seen by other processes inside bfq queues and possibly dispatched to -the device which is wrong. So move cleanup of the request from -bfq_finish_requeue_request() to bfq_requests_merged(). - -Acked-by: Paolo Valente -Signed-off-by: Jan Kara -Link: https://lore.kernel.org/r/20210623093634.27879-2-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Sasha Levin ---- - block/bfq-iosched.c | 41 +++++++++++++---------------------------- - 1 file changed, 13 insertions(+), 28 deletions(-) - -diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c -index 2adb1e69c9d2..d00c89f6ba59 100644 ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -2405,7 +2405,7 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, - *next_bfqq = bfq_init_rq(next); - - if (!bfqq) -- return; -+ goto remove; - - /* - * If next and rq belong to the same bfq_queue and next is older -@@ -2428,6 +2428,14 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, - bfqq->next_rq = rq; - - bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); -+remove: -+ /* Merged request may be in the IO scheduler. Remove it. */ -+ if (!RB_EMPTY_NODE(&next->rb_node)) { -+ bfq_remove_request(next->q, next); -+ if (next_bfqq) -+ bfqg_stats_update_io_remove(bfqq_group(next_bfqq), -+ next->cmd_flags); -+ } - } - - /* Must be called with bfqq != NULL */ -@@ -6376,6 +6384,7 @@ static void bfq_finish_requeue_request(struct request *rq) - { - struct bfq_queue *bfqq = RQ_BFQQ(rq); - struct bfq_data *bfqd; -+ unsigned long flags; - - /* - * rq either is not associated with any icq, or is an already -@@ -6393,39 +6402,15 @@ static void bfq_finish_requeue_request(struct request *rq) - rq->io_start_time_ns, - rq->cmd_flags); - -+ spin_lock_irqsave(&bfqd->lock, flags); - if (likely(rq->rq_flags & RQF_STARTED)) { -- unsigned long flags; -- -- spin_lock_irqsave(&bfqd->lock, flags); -- - if (rq == bfqd->waited_rq) - bfq_update_inject_limit(bfqd, bfqq); - - bfq_completed_request(bfqq, bfqd); -- bfq_finish_requeue_request_body(bfqq); -- -- spin_unlock_irqrestore(&bfqd->lock, flags); -- } else { -- /* -- * Request rq may be still/already in the scheduler, -- * in which case we need to remove it (this should -- * never happen in case of requeue). And we cannot -- * defer such a check and removal, to avoid -- * inconsistencies in the time interval from the end -- * of this function to the start of the deferred work. -- * This situation seems to occur only in process -- * context, as a consequence of a merge. In the -- * current version of the code, this implies that the -- * lock is held. -- */ -- -- if (!RB_EMPTY_NODE(&rq->rb_node)) { -- bfq_remove_request(rq->q, rq); -- bfqg_stats_update_io_remove(bfqq_group(bfqq), -- rq->cmd_flags); -- } -- bfq_finish_requeue_request_body(bfqq); - } -+ bfq_finish_requeue_request_body(bfqq); -+ spin_unlock_irqrestore(&bfqd->lock, flags); - - /* - * Reset private fields. In case of a requeue, this allows --- -2.30.2 - diff --git a/queue-5.13/series b/queue-5.13/series index c204ad70014..bfacc92d58f 100644 --- a/queue-5.13/series +++ b/queue-5.13/series @@ -256,7 +256,6 @@ acpi-tables-add-custom-dsdt-file-as-makefile-prerequ.patch smb3-fix-possible-access-to-uninitialized-pointer-to.patch hid-wacom-correct-base-usage-for-capacitive-expressk.patch cifs-fix-missing-spinlock-around-update-to-ses-statu.patch -bfq-remove-merged-request-already-in-bfq_requests_me.patch mailbox-qcom-use-platform_devid_auto-to-register-pla.patch block-fix-discard-request-merge.patch kthread_worker-fix-return-value-when-kthread_mod_del.patch -- 2.47.3