Linux-Block Archive on
 help / color / Atom feed
From: Bart Van Assche <>
To: "Martin K . Petersen" <>
Cc: "James E . J . Bottomley" <>,
	Jens Axboe <>, Christoph Hellwig <>,
	Hannes Reinecke <>, Ming Lei <>,,,
	Bart Van Assche <>,
	"David S . Miller" <>,
	Alan Stern <>,
	Can Guo <>,
	Stanley Chu <>,
	"Rafael J . Wysocki" <>
Subject: [PATCH v5 3/8] ide: Do not set the RQF_PREEMPT flag for sense requests
Date: Tue,  8 Dec 2020 21:29:46 -0800
Message-ID: <> (raw)
In-Reply-To: <>

RQF_PREEMPT is used for two different purposes in the legacy IDE code:
1. To mark power management requests.
2. To mark requests that should preempt another request. An (old)
   explanation of that feature is as follows:
   "The IDE driver in the Linux kernel normally uses a series of busywait
   delays during its initialization. When the driver executes these
   busywaits, the kernel does nothing for the duration of the wait. The
   time spent in these waits could be used for other initialization
   activities, if they could be run concurrently with these waits.

   More specifically, busywait-style delays such as udelay() in module
   init functions inhibit kernel preemption because the Big Kernel Lock
   is held, while yielding APIs such as schedule_timeout() allow
   preemption. This is true because the kernel handles the BKL specially
   and releases and reacquires it across reschedules allowed by the
   current thread.

   This IDE-preempt specification requires that the driver eliminate these
   busywaits and replace them with a mechanism that allows other work to
   proceed while the IDE driver is initializing."

Since I haven't found an implementation of (2), do not set the PREEMPT
flag for sense requests. This patch causes sense requests to be
postponed while a drive is suspended instead of being submitted to

If it would ever be necessary to restore the IDE PREEMPT functionality,
that can be done by introducing a new flag in struct ide_request.

Reviewed-by: Christoph Hellwig <>
Reviewed-by: Hannes Reinecke <>
Reviewed-by: Jens Axboe <>
Cc: David S. Miller <>
Cc: Alan Stern <>
Cc: Can Guo <>
Cc: Stanley Chu <>
Cc: Ming Lei <>
Cc: Rafael J. Wysocki <>
Signed-off-by: Bart Van Assche <>
 drivers/ide/ide-atapi.c | 1 -
 drivers/ide/ide-io.c    | 5 -----
 2 files changed, 6 deletions(-)

diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 2162bc80f09e..013ad33fbbc8 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -223,7 +223,6 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
 	sense_rq->rq_disk = rq->rq_disk;
 	sense_rq->cmd_flags = REQ_OP_DRV_IN;
 	ide_req(sense_rq)->type = ATA_PRIV_SENSE;
-	sense_rq->rq_flags |= RQF_PREEMPT;
 	req->cmd[0] = GPCMD_REQUEST_SENSE;
 	req->cmd[4] = cmd_len;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 1a53c7a75224..c210ea3bd02f 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -515,11 +515,6 @@ blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq,
 		 * above to return us whatever is in the queue. Since we call
 		 * ide_do_request() ourselves, we end up taking requests while
 		 * the queue is blocked...
-		 * 
-		 * We let requests forced at head of queue with ide-preempt
-		 * though. I hope that doesn't happen too much, hopefully not
-		 * unless the subdriver triggers such a thing in its own PM
-		 * state machine.
 		if ((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
 		    ata_pm_request(rq) == 0 &&

  parent reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  5:29 [PATCH v5 0/8] Rework runtime suspend and SPI domain validation Bart Van Assche
2020-12-09  5:29 ` [PATCH v5 1/8] block: Fix a race in the runtime power management code Bart Van Assche
2020-12-09  5:29 ` [PATCH v5 2/8] block: Introduce BLK_MQ_REQ_PM Bart Van Assche
2020-12-09  6:06   ` Can Guo
2020-12-09  5:29 ` Bart Van Assche [this message]
2020-12-09  5:29 ` [PATCH v5 4/8] ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT Bart Van Assche
2020-12-09  5:29 ` [PATCH v5 5/8] scsi_transport_spi: Set RQF_PM for domain validation commands Bart Van Assche
2020-12-09  7:34   ` Hannes Reinecke
2020-12-09  5:29 ` [PATCH v5 6/8] scsi: Only process PM requests if rpm_status != RPM_ACTIVE Bart Van Assche
2020-12-09  6:06   ` Can Guo
2020-12-09  5:29 ` [PATCH v5 7/8] block: Remove RQF_PREEMPT and BLK_MQ_REQ_PREEMPT Bart Van Assche
2020-12-09  6:05   ` Can Guo
2020-12-09  5:29 ` [PATCH v5 8/8] block: Do not accept any requests while suspended Bart Van Assche
2020-12-09  6:04   ` Can Guo
2020-12-09  7:36   ` Hannes Reinecke
2020-12-09 16:44 ` [PATCH v5 0/8] Rework runtime suspend and SPI domain validation Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Block Archive on

Archives are clonable:
	git clone --mirror 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/ \
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone