All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: andrew.vasquez@qlogic.com
Cc: Kernel-Janitors <kernel-janitors@lists.osdl.org>,
	linux-scsi@vger.kernel.org
Subject: [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{,
Date: Sat, 09 Jul 2005 00:16:20 +0000	[thread overview]
Message-ID: <20050709001620.GS2596@us.ibm.com> (raw)
In-Reply-To: <20050709000324.GD2596@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>

Description: Replace schedule_timeout() with
msleep()/msleep_interruptible() as appropriate, to guarantee the task
delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 qla_os.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c
--- 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c	2005-07-08 13:01:12.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c	2005-07-06 19:27:01.000000000 -0700
@@ -347,14 +347,13 @@ qc_fail_command:
 static int
 qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
 {
-#define ABORT_POLLING_PERIOD	HZ
-#define ABORT_WAIT_ITER		((10 * HZ) / (ABORT_POLLING_PERIOD))
+#define ABORT_POLLING_PERIOD	1000
+#define ABORT_WAIT_ITER		((10 * 1000) / (ABORT_POLLING_PERIOD))
 	unsigned long wait_iter = ABORT_WAIT_ITER;
 	int ret = QLA_SUCCESS;
 
 	while (CMD_SP(cmd)) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(ABORT_POLLING_PERIOD);
+		msleep(ABORT_POLLING_PERIOD);
 
 		if (--wait_iter)
 			break;
@@ -1693,7 +1692,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 {
 	struct list_head	*fcpl, *fcptemp;
 	fc_port_t	*fcport;
-	unsigned long	wtime;/* max wait time if mbx cmd is busy. */
+	unsigned int	wtime;/* max wait time if mbx cmd is busy. */
 
 	if (ha == NULL) {
 		/* error */
@@ -1702,11 +1701,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 	}
 
 	/* Make sure all other threads are stopped. */
-	wtime = 60 * HZ;
-	while (ha->dpc_wait && wtime) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		wtime = schedule_timeout(wtime);
-	}
+	wtime = 60 * 1000;
+	while (ha->dpc_wait && wtime)
+		wtime = msleep_interruptible(wtime);
 
 	/* free ioctl memory */
 	qla2x00_free_ioctl_mem(ha);
@@ -2250,15 +2247,15 @@ qla2x00_timer(scsi_qla_host_t *ha)
 int
 qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
 {
-	const unsigned int step = HZ/10;
+	const unsigned int step = 100; /* msecs */
+	unsigned int iterations = jiffies_to_msecs(timeout)/100;
 
 	do {
 		if (!down_trylock(sema))
 			return 0;
-		set_current_state(TASK_INTERRUPTIBLE);
-		if (schedule_timeout(step))
+		if (msleep_interruptible(step))
 			break;
-	} while ((timeout -= step) > 0);
+	} while (--iterations >= 0);
 
 	return -ETIMEDOUT;
 }

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: andrew.vasquez@qlogic.com
Cc: Kernel-Janitors <kernel-janitors@lists.osdl.org>,
	linux-scsi@vger.kernel.org
Subject: [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() instead of schedule_timeout()
Date: Fri, 8 Jul 2005 17:16:20 -0700	[thread overview]
Message-ID: <20050709001620.GS2596@us.ibm.com> (raw)
In-Reply-To: <20050709000324.GD2596@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>

Description: Replace schedule_timeout() with
msleep()/msleep_interruptible() as appropriate, to guarantee the task
delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 qla_os.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c
--- 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c	2005-07-08 13:01:12.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c	2005-07-06 19:27:01.000000000 -0700
@@ -347,14 +347,13 @@ qc_fail_command:
 static int
 qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
 {
-#define ABORT_POLLING_PERIOD	HZ
-#define ABORT_WAIT_ITER		((10 * HZ) / (ABORT_POLLING_PERIOD))
+#define ABORT_POLLING_PERIOD	1000
+#define ABORT_WAIT_ITER		((10 * 1000) / (ABORT_POLLING_PERIOD))
 	unsigned long wait_iter = ABORT_WAIT_ITER;
 	int ret = QLA_SUCCESS;
 
 	while (CMD_SP(cmd)) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(ABORT_POLLING_PERIOD);
+		msleep(ABORT_POLLING_PERIOD);
 
 		if (--wait_iter)
 			break;
@@ -1693,7 +1692,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 {
 	struct list_head	*fcpl, *fcptemp;
 	fc_port_t	*fcport;
-	unsigned long	wtime;/* max wait time if mbx cmd is busy. */
+	unsigned int	wtime;/* max wait time if mbx cmd is busy. */
 
 	if (ha == NULL) {
 		/* error */
@@ -1702,11 +1701,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 	}
 
 	/* Make sure all other threads are stopped. */
-	wtime = 60 * HZ;
-	while (ha->dpc_wait && wtime) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		wtime = schedule_timeout(wtime);
-	}
+	wtime = 60 * 1000;
+	while (ha->dpc_wait && wtime)
+		wtime = msleep_interruptible(wtime);
 
 	/* free ioctl memory */
 	qla2x00_free_ioctl_mem(ha);
@@ -2250,15 +2247,15 @@ qla2x00_timer(scsi_qla_host_t *ha)
 int
 qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
 {
-	const unsigned int step = HZ/10;
+	const unsigned int step = 100; /* msecs */
+	unsigned int iterations = jiffies_to_msecs(timeout)/100;
 
 	do {
 		if (!down_trylock(sema))
 			return 0;
-		set_current_state(TASK_INTERRUPTIBLE);
-		if (schedule_timeout(step))
+		if (msleep_interruptible(step))
 			break;
-	} while ((timeout -= step) > 0);
+	} while (--iterations >= 0);
 
 	return -ETIMEDOUT;
 }

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2005-07-09  0:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-09  0:03 [PATCH 1/14] sound/pci: fix-up sleeping paths Nishanth Aravamudan
2005-07-09  0:03 ` Nishanth Aravamudan
2005-07-09  0:04 ` [PATCH 2/14] sound/ppc: " Nishanth Aravamudan
2005-07-09  0:04   ` Nishanth Aravamudan
2005-07-09  0:07   ` Nishanth Aravamudan
2005-07-09  0:04 ` [PATCH 3/14] sound/usb: " Nishanth Aravamudan
2005-07-09  0:04   ` Nishanth Aravamudan
2005-07-09  0:08   ` Nishanth Aravamudan
2005-07-09  0:06 ` [PATCH 1/14] sound/pci: " Nishanth Aravamudan
2005-07-09  0:11 ` [KJ] [PATCH 7/14] mips: replace timespectojiffies() with Nishanth Aravamudan
2005-07-09  0:11   ` [PATCH 7/14] mips: replace timespectojiffies() with timespec_to_jiffies() Nishanth Aravamudan
2005-07-11 14:12   ` [KJ] Re: [PATCH 7/14] mips: replace timespectojiffies() with Ralf Baechle
2005-07-11 14:12     ` [PATCH 7/14] mips: replace timespectojiffies() with timespec_to_jiffies() Ralf Baechle
2005-07-09  0:14 ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of Nishanth Aravamudan
2005-07-09  0:14   ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
2005-07-10 16:20   ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of Domen Puncer
2005-07-10 16:20     ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Domen Puncer
2005-07-11  5:38     ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of Nishanth Aravamudan
2005-07-11  5:38       ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
2005-07-09  0:15 ` [KJ] [PATCH 12/14] scsi/osst: use msleep() instead of Nishanth Aravamudan
2005-07-09  0:15   ` [KJ] [PATCH 12/14] scsi/osst: use msleep() instead of schedule_timeout() Nishanth Aravamudan
2005-07-09  0:16 ` Nishanth Aravamudan [this message]
2005-07-09  0:16   ` [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() " Nishanth Aravamudan
  -- strict thread matches above, loose matches on Subject: below --
2005-07-09  0:06 [KJ] Re: [PATCH 1/14] sound/pci: fix-up sleeping paths Nishanth Aravamudan
2005-07-09  0:06 ` Nishanth Aravamudan
2005-07-09  0:07 [KJ] Re: [PATCH 2/14] sound/ppc: " Nishanth Aravamudan
2005-07-09  0:07 ` Nishanth Aravamudan
2005-07-09  0:08 [KJ] Re: [PATCH 3/14] sound/usb: " Nishanth Aravamudan
2005-07-09  0:08 ` Nishanth Aravamudan

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20050709001620.GS2596@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.