linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Tejun Heo <htejun@gmail.com>
Cc: albertl@mail.com, Jeff Garzik <jgarzik@pobox.com>,
	Doug Maxey <dwm@maxeymade.com>,
	Linux IDE <linux-ide@vger.kernel.org>
Subject: Re: [PATCH/RFC 4/5] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move()
Date: Fri, 10 Mar 2006 22:25:51 +0800	[thread overview]
Message-ID: <44118C6F.5050900@tw.ibm.com> (raw)
In-Reply-To: <20060310093537.GD20207@htj.dyndns.org>

Tejun Heo wrote:
> On Thu, Mar 09, 2006 at 04:54:52PM +0800, Albert Lee wrote:
> 
>>--- 03_support_wq/drivers/scsi/libata-core.c	2006-03-09 15:14:00.000000000 +0800
>>+++ 04_pio_task/drivers/scsi/libata-core.c	2006-03-09 15:14:41.000000000 +0800
>>@@ -725,6 +725,8 @@ static unsigned int ata_pio_modes(const 
>> static inline void
>> ata_queue_pio_task(struct ata_port *ap)
>> {
>>+	ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
>>+
>> 	if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK))
>> 		queue_work(ata_wq, &ap->pio_task);
>> }
> 
> 
> I don't think we really need pio_task_timeout.  Generic EH now handles
> polling timeouts correctly and I can't see any advantage of
> pio_task_timeout.
> 

Ok, will remove pio_task_timeout and the HSM_ST_TMOUT state in the
follow-up patch if Jeff also agree.

> 
>>@@ -3804,44 +3806,55 @@ fsm_start:
>> static void ata_pio_task(void *_data)
>> {
>> 	struct ata_port *ap = _data;
>>-	unsigned long timeout;
>>-	int has_next;
>>+	struct ata_queued_cmd *qc;
>>+	u8 status;
>>+	int poll_next;
>> 
>> fsm_start:
>>-	timeout = 0;
>>-	has_next = 1;
>>+	WARN_ON(ap->hsm_task_state == HSM_ST_IDLE);
>> 
>>-	switch (ap->hsm_task_state) {
>>-	case HSM_ST_FIRST:
>>-		has_next = ata_pio_first_block(ap);
>>-		break;
>>+	qc = ata_qc_from_tag(ap, ap->active_tag);
>>+	WARN_ON(qc == NULL);
>> 
>>-	case HSM_ST:
>>-		ata_pio_block(ap);
>>-		break;
>>+	/*
>>+	 * This is purely heuristic.  This is a fast path.
>>+	 * Sometimes when we enter, BSY will be cleared in
>>+	 * a chk-status or two.  If not, the drive is probably seeking
>>+	 * or something.  Snooze for a couple msecs, then
>>+	 * chk-status again.  If still busy, timeout or queue delayed work.
>>+	 */
>>+	status = ata_busy_wait(ap, ATA_BUSY, 5);
>>+	if (status & ATA_BUSY) {
>>+		msleep(2);
>>+		status = ata_busy_wait(ap, ATA_BUSY, 10);
>>+		if (status & ATA_BUSY) {
>>+			if (time_before(jiffies, ap->pio_task_timeout)) {
>>+				ata_queue_delayed_pio_task(ap, ATA_SHORT_PAUSE);
>>+				return;
>>+			}
>> 
>>-	case HSM_ST_LAST:
>>-		has_next = ata_pio_complete(ap);
>>-		break;
>>+			/* timeout. Let EH handle it later. 
>>+			 * FIXME: should we remove ap->pio_task_timeout?
>>+			 */
>>+			printk(KERN_ERR "ata%u: polling time out\n", ap->id);
>>+			qc->err_mask |= AC_ERR_TIMEOUT;
>>+			ap->hsm_task_state = HSM_ST_TMOUT;
>>+			return; 
>>+		}
>>+	}
>> 
>>-	case HSM_ST_POLL:
>>-	case HSM_ST_LAST_POLL:
>>-		timeout = ata_pio_poll(ap);
>>-		break;
>>+	/* FIXME: check if EH is active */
> 
> 
> No, you don't need to.  Generic EH already does the right thing.  No
> need to worry about EH in polling task.
> 

Ok, will remove the comment in the follow-up patch.

--
Albert


  reply	other threads:[~2006-03-10 14:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  8:41 [PATCH/RFC 0/5] libata-dev: integrate polling pio with irq-pio Albert Lee
2006-03-09  8:45 ` [PATCH/RFC 1/5] libata-dev: Move out the HSM code from ata_host_intr() Albert Lee
2006-03-10  9:18   ` Tejun Heo
2006-03-09  8:49 ` [PATCH/RFC 2/5] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr() Albert Lee
2006-03-10  9:22   ` Tejun Heo
2006-03-09  8:51 ` [PATCH/RFC 3/5] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pio Albert Lee
2006-03-10  9:31   ` Tejun Heo
2006-03-10 13:52     ` Albert Lee
2006-03-10 17:32       ` Tejun Heo
2006-03-09  8:54 ` [PATCH/RFC 4/5] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move() Albert Lee
2006-03-10  9:35   ` Tejun Heo
2006-03-10 14:25     ` Albert Lee [this message]
2006-03-09  8:56 ` [PATCH/RFC 5/5] libata-dev: Cleanup unused enums/functions Albert Lee
2006-03-10  9:38 ` [PATCH/RFC 0/5] libata-dev: integrate polling pio with irq-pio Tejun Heo
2006-03-12  0:37 ` Jeff Garzik
2006-03-13  7:33   ` [PATCH 0/5] libata-dev: integrate polling pio with irq-pio (respin) Albert Lee
2006-03-13  7:37     ` [PATCH 1/5] libata-dev: Move out the HSM code from ata_host_intr() Albert Lee
2006-03-13  7:41     ` [PATCH 2/5] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr() Albert Lee
2006-03-13  7:45     ` [PATCH 3/5] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pio Albert Lee
2006-03-13  7:55       ` Jeff Garzik
2006-03-13  8:42         ` [PATCH 1/1] libata-dev: Make the the in_wq check as an inline function Albert Lee
2006-03-13  8:56           ` Jeff Garzik
2006-03-13  7:47     ` [PATCH 4/5] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move() Albert Lee
2006-03-13  7:49     ` [PATCH 5/5] libata-dev: Cleanup unused enums/functions Albert Lee

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=44118C6F.5050900@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=albertl@mail.com \
    --cc=dwm@maxeymade.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).