ANDROID: Revert "scsi: block: Do not accept any requests while suspended"

Commit "block: Do not accept any requests while suspended" broke the UFS
driver. In the upstream kernel this has been fixed by commit b294ff3e3449
("scsi: ufs: core: Enable power management for wlun"). Backporting that
commit or backporting the entire v5.14-rc1 UFS driver is too risky.
Hence revert the block layer patch that is incompatible with the v5.10
UFS driver power management code.

This reverts commit d55d15a332.

Bug: 193181075
Change-Id: Ic50d4e1df98d7ed393bf9797787225ae22e5d7a3
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2021-07-09 11:10:28 -07:00
parent 2ad2c3a25b
commit 018332e871
3 changed files with 8 additions and 25 deletions

View File

@@ -18,7 +18,6 @@
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/blk-mq.h> #include <linux/blk-mq.h>
#include <linux/blk-pm.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
@@ -441,8 +440,7 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
* responsible for ensuring that that counter is * responsible for ensuring that that counter is
* globally visible before the queue is unfrozen. * globally visible before the queue is unfrozen.
*/ */
if ((pm && queue_rpm_status(q) != RPM_SUSPENDED) || if (pm || !blk_queue_pm_only(q)) {
!blk_queue_pm_only(q)) {
success = true; success = true;
} else { } else {
percpu_ref_put(&q->q_usage_counter); percpu_ref_put(&q->q_usage_counter);
@@ -467,7 +465,8 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
wait_event(q->mq_freeze_wq, wait_event(q->mq_freeze_wq,
(!q->mq_freeze_depth && (!q->mq_freeze_depth &&
blk_pm_resume_queue(pm, q)) || (pm || (blk_pm_request_resume(q),
!blk_queue_pm_only(q)))) ||
blk_queue_dying(q)); blk_queue_dying(q));
if (blk_queue_dying(q)) if (blk_queue_dying(q))
return -ENODEV; return -ENODEV;

View File

@@ -6,14 +6,11 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#ifdef CONFIG_PM #ifdef CONFIG_PM
static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q) static inline void blk_pm_request_resume(struct request_queue *q)
{ {
if (!q->dev || !blk_queue_pm_only(q)) if (q->dev && (q->rpm_status == RPM_SUSPENDED ||
return 1; /* Nothing to do */ q->rpm_status == RPM_SUSPENDING))
if (pm && q->rpm_status != RPM_SUSPENDED) pm_request_resume(q->dev);
return 1; /* Request allowed */
pm_request_resume(q->dev);
return 0;
} }
static inline void blk_pm_mark_last_busy(struct request *rq) static inline void blk_pm_mark_last_busy(struct request *rq)
@@ -47,9 +44,8 @@ static inline void blk_pm_put_request(struct request *rq)
--rq->q->nr_pending; --rq->q->nr_pending;
} }
#else #else
static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q) static inline void blk_pm_request_resume(struct request_queue *q)
{ {
return 1;
} }
static inline void blk_pm_mark_last_busy(struct request *rq) static inline void blk_pm_mark_last_busy(struct request *rq)

View File

@@ -694,18 +694,6 @@ static inline bool queue_is_mq(struct request_queue *q)
return q->mq_ops; return q->mq_ops;
} }
#ifdef CONFIG_PM
static inline enum rpm_status queue_rpm_status(struct request_queue *q)
{
return q->rpm_status;
}
#else
static inline enum rpm_status queue_rpm_status(struct request_queue *q)
{
return RPM_ACTIVE;
}
#endif
static inline enum blk_zoned_model static inline enum blk_zoned_model
blk_queue_zoned_model(struct request_queue *q) blk_queue_zoned_model(struct request_queue *q)
{ {