Skip to content

Commit eda809a

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "This is a load of driver fixes (12 ufs, 1 mpt3sas, 1 cxgbi). The big core two fixes are for power management ("block: Do not accept any requests while suspended" and "block: Fix a race in the runtime power management code") which finally sorts out the resume problems we've occasionally been having. To make the resume fix, there are seven necessary precursors which effectively renames REQ_PREEMPT to REQ_PM, so every "special" request in block is automatically a power management exempt one. All of the non-PM preempt cases are removed except for the one in the SCSI Parallel Interface (spi) domain validation which is a genuine case where we have to run requests at high priority to validate the bus so this becomes an autopm get/put protected request" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (22 commits) scsi: cxgb4i: Fix TLS dependency scsi: ufs: Un-inline ufshcd_vops_device_reset function scsi: ufs: Re-enable WriteBooster after device reset scsi: ufs-mediatek: Use correct path to fix compile error scsi: mpt3sas: Signedness bug in _base_get_diag_triggers() scsi: block: Do not accept any requests while suspended scsi: block: Remove RQF_PREEMPT and BLK_MQ_REQ_PREEMPT scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE scsi: scsi_transport_spi: Set RQF_PM for domain validation commands scsi: ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT scsi: ide: Do not set the RQF_PREEMPT flag for sense requests scsi: block: Introduce BLK_MQ_REQ_PM scsi: block: Fix a race in the runtime power management code scsi: ufs-pci: Enable UFSHCD_CAP_RPM_AUTOSUSPEND for Intel controllers scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel controllers scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff() scsi: ufs-pci: Fix restore from S4 for Intel controllers scsi: ufs-mediatek: Keep VCC always-on for specific devices scsi: ufs: Allow regulators being always-on scsi: ufs: Clear UAC for RPMB after ufshcd resets ...
2 parents 8b4805c + cb52531 commit eda809a

21 files changed

+208
-86
lines changed

block/blk-core.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/bio.h>
1919
#include <linux/blkdev.h>
2020
#include <linux/blk-mq.h>
21+
#include <linux/blk-pm.h>
2122
#include <linux/highmem.h>
2223
#include <linux/mm.h>
2324
#include <linux/pagemap.h>
@@ -424,11 +425,11 @@ EXPORT_SYMBOL(blk_cleanup_queue);
424425
/**
425426
* blk_queue_enter() - try to increase q->q_usage_counter
426427
* @q: request queue pointer
427-
* @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PREEMPT
428+
* @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PM
428429
*/
429430
int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
430431
{
431-
const bool pm = flags & BLK_MQ_REQ_PREEMPT;
432+
const bool pm = flags & BLK_MQ_REQ_PM;
432433

433434
while (true) {
434435
bool success = false;
@@ -440,7 +441,8 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
440441
* responsible for ensuring that that counter is
441442
* globally visible before the queue is unfrozen.
442443
*/
443-
if (pm || !blk_queue_pm_only(q)) {
444+
if ((pm && queue_rpm_status(q) != RPM_SUSPENDED) ||
445+
!blk_queue_pm_only(q)) {
444446
success = true;
445447
} else {
446448
percpu_ref_put(&q->q_usage_counter);
@@ -465,8 +467,7 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
465467

466468
wait_event(q->mq_freeze_wq,
467469
(!q->mq_freeze_depth &&
468-
(pm || (blk_pm_request_resume(q),
469-
!blk_queue_pm_only(q)))) ||
470+
blk_pm_resume_queue(pm, q)) ||
470471
blk_queue_dying(q));
471472
if (blk_queue_dying(q))
472473
return -ENODEV;
@@ -630,7 +631,7 @@ struct request *blk_get_request(struct request_queue *q, unsigned int op,
630631
struct request *req;
631632

632633
WARN_ON_ONCE(op & REQ_NOWAIT);
633-
WARN_ON_ONCE(flags & ~(BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_PREEMPT));
634+
WARN_ON_ONCE(flags & ~(BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_PM));
634635

635636
req = blk_mq_alloc_request(q, op, flags);
636637
if (!IS_ERR(req) && q->mq_ops->initialize_rq_fn)

block/blk-mq-debugfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ static const char *const rqf_name[] = {
298298
RQF_NAME(MIXED_MERGE),
299299
RQF_NAME(MQ_INFLIGHT),
300300
RQF_NAME(DONTPREP),
301-
RQF_NAME(PREEMPT),
302301
RQF_NAME(FAILED),
303302
RQF_NAME(QUIET),
304303
RQF_NAME(ELVPRIV),

block/blk-mq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
294294
rq->mq_hctx = data->hctx;
295295
rq->rq_flags = 0;
296296
rq->cmd_flags = data->cmd_flags;
297-
if (data->flags & BLK_MQ_REQ_PREEMPT)
298-
rq->rq_flags |= RQF_PREEMPT;
297+
if (data->flags & BLK_MQ_REQ_PM)
298+
rq->rq_flags |= RQF_PM;
299299
if (blk_queue_io_stat(data->q))
300300
rq->rq_flags |= RQF_IO_STAT;
301301
INIT_LIST_HEAD(&rq->queuelist);

block/blk-pm.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ int blk_pre_runtime_suspend(struct request_queue *q)
6767

6868
WARN_ON_ONCE(q->rpm_status != RPM_ACTIVE);
6969

70+
spin_lock_irq(&q->queue_lock);
71+
q->rpm_status = RPM_SUSPENDING;
72+
spin_unlock_irq(&q->queue_lock);
73+
7074
/*
7175
* Increase the pm_only counter before checking whether any
7276
* non-PM blk_queue_enter() calls are in progress to avoid that any
@@ -89,15 +93,14 @@ int blk_pre_runtime_suspend(struct request_queue *q)
8993
/* Switch q_usage_counter back to per-cpu mode. */
9094
blk_mq_unfreeze_queue(q);
9195

92-
spin_lock_irq(&q->queue_lock);
93-
if (ret < 0)
96+
if (ret < 0) {
97+
spin_lock_irq(&q->queue_lock);
98+
q->rpm_status = RPM_ACTIVE;
9499
pm_runtime_mark_last_busy(q->dev);
95-
else
96-
q->rpm_status = RPM_SUSPENDING;
97-
spin_unlock_irq(&q->queue_lock);
100+
spin_unlock_irq(&q->queue_lock);
98101

99-
if (ret)
100102
blk_clear_pm_only(q);
103+
}
101104

102105
return ret;
103106
}

block/blk-pm.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
#include <linux/pm_runtime.h>
77

88
#ifdef CONFIG_PM
9-
static inline void blk_pm_request_resume(struct request_queue *q)
9+
static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
1010
{
11-
if (q->dev && (q->rpm_status == RPM_SUSPENDED ||
12-
q->rpm_status == RPM_SUSPENDING))
13-
pm_request_resume(q->dev);
11+
if (!q->dev || !blk_queue_pm_only(q))
12+
return 1; /* Nothing to do */
13+
if (pm && q->rpm_status != RPM_SUSPENDED)
14+
return 1; /* Request allowed */
15+
pm_request_resume(q->dev);
16+
return 0;
1417
}
1518

1619
static inline void blk_pm_mark_last_busy(struct request *rq)
@@ -44,8 +47,9 @@ static inline void blk_pm_put_request(struct request *rq)
4447
--rq->q->nr_pending;
4548
}
4649
#else
47-
static inline void blk_pm_request_resume(struct request_queue *q)
50+
static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
4851
{
52+
return 1;
4953
}
5054

5155
static inline void blk_pm_mark_last_busy(struct request *rq)

drivers/ide/ide-atapi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
223223
sense_rq->rq_disk = rq->rq_disk;
224224
sense_rq->cmd_flags = REQ_OP_DRV_IN;
225225
ide_req(sense_rq)->type = ATA_PRIV_SENSE;
226-
sense_rq->rq_flags |= RQF_PREEMPT;
227226

228227
req->cmd[0] = GPCMD_REQUEST_SENSE;
229228
req->cmd[4] = cmd_len;

drivers/ide/ide-io.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,10 @@ blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq,
515515
* above to return us whatever is in the queue. Since we call
516516
* ide_do_request() ourselves, we end up taking requests while
517517
* the queue is blocked...
518-
*
519-
* We let requests forced at head of queue with ide-preempt
520-
* though. I hope that doesn't happen too much, hopefully not
521-
* unless the subdriver triggers such a thing in its own PM
522-
* state machine.
523518
*/
524519
if ((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
525520
ata_pm_request(rq) == 0 &&
526-
(rq->rq_flags & RQF_PREEMPT) == 0) {
521+
(rq->rq_flags & RQF_PM) == 0) {
527522
/* there should be no pending command at this point */
528523
ide_unlock_port(hwif);
529524
goto plug_device;

drivers/ide/ide-pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int generic_ide_resume(struct device *dev)
7777
}
7878

7979
memset(&rqpm, 0, sizeof(rqpm));
80-
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT);
80+
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PM);
8181
ide_req(rq)->type = ATA_PRIV_PM_RESUME;
8282
ide_req(rq)->special = &rqpm;
8383
rqpm.pm_step = IDE_PM_START_RESUME;

drivers/scsi/cxgbi/cxgb4i/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config SCSI_CXGB4_ISCSI
44
depends on PCI && INET && (IPV6 || IPV6=n)
55
depends on THERMAL || !THERMAL
66
depends on ETHERNET
7+
depends on TLS || TLS=n
78
select NET_VENDOR_CHELSIO
89
select CHELSIO_T4
910
select CHELSIO_LIB

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5034,7 +5034,7 @@ _base_check_for_trigger_pages_support(struct MPT3SAS_ADAPTER *ioc)
50345034
static void
50355035
_base_get_diag_triggers(struct MPT3SAS_ADAPTER *ioc)
50365036
{
5037-
u16 trigger_flags;
5037+
int trigger_flags;
50385038

50395039
/*
50405040
* Default setting of master trigger.

0 commit comments

Comments
 (0)