linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Tejun Heo <htejun@gmail.com>
Cc: alan@lxorguk.ukuu.org.uk, axboe@suse.de, albertcc@tw.ibm.com,
	forrest.zhao@intel.com, efalk@google.com,
	linux-ide@vger.kernel.org,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 02/22] SCSI: implement host_eh_scheduled hack for libata
Date: Sat, 13 May 2006 17:34:54 -0400	[thread overview]
Message-ID: <446650FE.8050308@pobox.com> (raw)
In-Reply-To: <11473487904197-git-send-email-htejun@gmail.com>

Tejun Heo wrote:
> libata needs to invoke EH without scmd.  This patch adds
> shost->host_eh_scheduled to implement such behavior.
> 
> As this is a temporary hack for libata, no general interface is
> defined.  This patch simply adds handling for host_eh_scheduled where
> needed and exports scsi_eh_wakeup() to modules.  The rest is upto
> libata.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>

I ACK the change (the important part), but not the description or comments.

Rationale for ACK (if it matters):  Back when the first version of this 
was posted, after our initial discussion I reviewed the uses of 
->host_failed and ->host_busy, and had considered twiddling those rather 
than adding another state variable.  Being in EH when host_failed==0 
made me nervous.  However, after reviewing the uses, I now feel that 
your approach presented probably creates less complex code.



> b3095135fd8d02d5b31591d87243afb3aeb217da
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 1c75646..442ae59 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -56,6 +56,7 @@ void scsi_eh_wakeup(struct Scsi_Host *sh
>  				printk("Waking error handler thread\n"));
>  	}
>  }
> +EXPORT_SYMBOL_GPL(scsi_eh_wakeup);	/* exported only for libata */
>  
>  /**
>   * scsi_eh_scmd_add - add scsi cmd to error handling.
> @@ -1517,7 +1518,7 @@ int scsi_error_handler(void *data)
>  	 */
>  	set_current_state(TASK_INTERRUPTIBLE);
>  	while (!kthread_should_stop()) {
> -		if (shost->host_failed == 0 ||
> +		if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) ||
>  		    shost->host_failed != shost->host_busy) {
>  			SCSI_LOG_ERROR_RECOVERY(1,
>  				printk("Error handler scsi_eh_%d sleeping\n",
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 7b0f9a3..c55d195 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -566,7 +566,7 @@ void scsi_device_unbusy(struct scsi_devi
>  	spin_lock_irqsave(shost->host_lock, flags);
>  	shost->host_busy--;
>  	if (unlikely(scsi_host_in_recovery(shost) &&
> -		     shost->host_failed))
> +		     (shost->host_failed || shost->host_eh_scheduled)))
>  		scsi_eh_wakeup(shost);
>  	spin_unlock(shost->host_lock);
>  	spin_lock(sdev->request_queue->queue_lock);
> diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
> index d160880..e31ada2 100644
> --- a/include/scsi/scsi_eh.h
> +++ b/include/scsi/scsi_eh.h
> @@ -35,6 +35,7 @@ static inline int scsi_sense_valid(struc
>  }
>  
>  
> +extern void scsi_eh_wakeup(struct Scsi_Host *shost);	/* libata only */
>  extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
>  			       struct list_head *done_q);
>  extern void scsi_eh_flush_done_q(struct list_head *done_q);
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index de6ce54..3b454c2 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -472,6 +472,7 @@ struct Scsi_Host {
>  	 */
>  	unsigned int host_busy;		   /* commands actually active on low-level */
>  	unsigned int host_failed;	   /* commands that failed. */
> +	unsigned int host_eh_scheduled;	   /* XXX - libata hack, do NOT use */

However, the nitpicks I have with the comments and patch description:

* Although your comments about "libata only" are true, it is more 
correct to say that these are exclusive to ->eh_strategy_handler() 
users.  It just so happens that libata is the only in-tree user... 
however when making changes to the SCSI driver API, you should be in a 
"I'm updating the SCSI EH API" frame of mine as well.

* In your patch description you mention this change (or a subset 
thereof) is temporary, but do not explain why it is temporary, and what 
will be the eventual replacement.

* In general this change should be described as an addition to the SCSI 
LLDD EH API...  I even disagree to some extent of calling it a hack. 
One must Do What Needs To Be Done, And No More.  There is no shame in 
that :)

The ->eh_strategy_handler API is guaranteed to be rough, because there 
weren't really any in-tree users until libata came along.  Now we're 
exposing the rough edges, and fixing them.

	Jeff



  reply	other threads:[~2006-05-13 21:35 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-11 11:59 [PATCHSET 01/11] prep for new EH Tejun Heo
2006-05-11 11:59 ` [PATCH 10/22] libata: use preallocated buffers Tejun Heo
2006-05-17  5:34   ` Albert Lee
2006-05-17 12:47     ` Jeff Garzik
2006-05-18  2:52       ` Albert Lee
2006-05-11 11:59 ` [PATCH 01/22] SCSI: Introduce scsi_req_abort_cmd (REPOST) Tejun Heo
2006-05-13 21:21   ` Jeff Garzik
2006-05-14  2:00     ` Luben Tuikov
2006-05-14  2:01   ` Luben Tuikov
2006-05-14  2:04     ` Jeff Garzik
2006-05-14  2:08       ` Luben Tuikov
2006-05-14  2:12         ` Jeff Garzik
2006-05-11 11:59 ` [PATCH 05/22] libata: unexport ata_scsi_error() Tejun Heo
2006-05-11 11:59 ` [PATCH 03/22] libata: silly fix in ata_scsi_start_stop_xlat() Tejun Heo
2006-05-11 11:59 ` [PATCH 08/22] libata: clear ap->active_tag atomically w.r.t. command completion Tejun Heo
2006-05-11 11:59 ` [PATCH 04/22] ahci: hardreset classification fix Tejun Heo
2006-05-11 11:59 ` [PATCH 06/22] libata: kill duplicate prototypes Tejun Heo
2006-05-11 11:59 ` [PATCH 09/22] libata: hold host_set lock while finishing internal qc Tejun Heo
2006-05-11 11:59 ` [PATCH 02/22] SCSI: implement host_eh_scheduled hack for libata Tejun Heo
2006-05-13 21:34   ` Jeff Garzik [this message]
2006-05-11 11:59 ` [PATCH 07/22] libata: fix ->phy_reset class code handling in ata_bus_probe() Tejun Heo
2006-05-11 11:59 ` [PATCH 17/22] libata: use new SCR and on/offline functions Tejun Heo
2006-05-11 11:59 ` [PATCH 15/22] libata: init ap->cbl to ATA_CBL_SATA early Tejun Heo
2006-05-13 21:42   ` Jeff Garzik
2006-05-11 11:59 ` [PATCH 12/22] libata: remove postreset handling from ata_do_reset() Tejun Heo
2006-05-11 11:59 ` [PATCH 20/22] libata: use dev->ap Tejun Heo
2006-05-11 11:59 ` [PATCH 18/22] libata: kill old SCR functions and sata_dev_present() Tejun Heo
2006-05-11 11:59 ` [PATCH 14/22] sata_sil24: update TF image only when necessary Tejun Heo
2006-05-13 21:42   ` Jeff Garzik
2006-05-11 11:59 ` [PATCH 13/22] libata: implement qc->result_tf Tejun Heo
2006-05-18  7:10   ` Albert Lee
2006-05-18  7:22     ` Tejun Heo
2006-05-18  7:22   ` Albert Lee
2006-05-18  7:27     ` Tejun Heo
2006-05-18  7:53       ` Albert Lee
2006-05-18  8:10         ` Tejun Heo
2006-05-18  9:51           ` [PATCH 1/1] libata: use qc->result_tf for temp taskfile storage Albert Lee
2006-05-11 11:59 ` [PATCH 21/22] libata: implement ATA printk helpers Tejun Heo
2006-05-14  2:00   ` Jeff Garzik
2006-05-16 10:23   ` Albert Lee
2006-05-16 10:29     ` Tejun Heo
2006-05-11 11:59 ` [PATCH 19/22] libata: add dev->ap Tejun Heo
2006-05-13 21:47   ` Jeff Garzik
2006-05-11 11:59 ` [PATCH 11/22] libata: move ->set_mode() handling into ata_set_mode() Tejun Heo
2006-05-11 11:59 ` [PATCH 16/22] libata: implement new SCR handling and port on/offline functions Tejun Heo
2006-05-13 21:43   ` Jeff Garzik
2006-05-13 23:18     ` Tejun Heo
2006-05-14  1:10       ` Jeff Garzik
2006-05-14  1:29         ` Tejun Heo
2006-05-14  1:35           ` Jeff Garzik
2006-05-11 11:59 ` [PATCH 22/22] libata: use ATA printk helpers Tejun Heo
2006-05-13 21:49   ` Jeff Garzik
2006-05-13 21:52 ` [PATCHSET 01/11] prep for new EH Jeff Garzik

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=446650FE.8050308@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=efalk@google.com \
    --cc=forrest.zhao@intel.com \
    --cc=htejun@gmail.com \
    --cc=linux-ide@vger.kernel.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 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).