All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Tejun Heo <htejun@gmail.com>
Cc: mlord@pobox.com, albertcc@tw.ibm.com, alan@lxorguk.ukuu.org.uk,
	axboe@suse.de, forrest.zhao@intel.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH 03/13] libata-hp: implement SCSI part of hotplug
Date: Fri, 19 May 2006 12:05:33 -0400	[thread overview]
Message-ID: <446DECCD.1020100@pobox.com> (raw)
In-Reply-To: <1148053707416-git-send-email-htejun@gmail.com>

Tejun Heo wrote:
> Implement SCSI part of hotplug.
> 
> This must be done in a separate context as SCSI makes use of EH during
> probing.  Unfortunately, SCSI probing fails silently if EH is active.
> ata_eh_scsi_hotplug() does its best to avoid such conditions but,
> theoretically, it may fail to associate SCSI device to newly found ATA
> device; however, the chance is very slim and I haven't experienced any
> such event during testing.
> 
> Device removal synchronization is somewhat complex but I think I've
> got it right and haven't seen it malfunction.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> 
> ---
> 
>  drivers/scsi/libata-core.c |    1 +
>  drivers/scsi/libata-eh.c   |   70 +++++++++++++++++++++++++++++++++++++++++++-
>  drivers/scsi/libata-scsi.c |   59 +++++++++++++++++++++++++++++++++++++
>  drivers/scsi/libata.h      |    2 +
>  include/linux/libata.h     |    2 +
>  5 files changed, 132 insertions(+), 2 deletions(-)
> 
> 6a1cd6180ac9e13e29446378bd15245c4c7efd5d
> diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
> index 1809f98..7600b5f 100644
> --- a/drivers/scsi/libata-core.c
> +++ b/drivers/scsi/libata-core.c
> @@ -5347,6 +5347,7 @@ static void ata_host_init(struct ata_por
>  	ap->last_ctl = 0xFF;
>  
>  	INIT_WORK(&ap->port_task, NULL, NULL);
> +	INIT_WORK(&ap->hotplug_task, ata_eh_scsi_hotplug, ap);
>  	INIT_LIST_HEAD(&ap->eh_done_q);
>  
>  	/* set cable type */
> diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c
> index fff93d9..0ab7d52 100644
> --- a/drivers/scsi/libata-eh.c
> +++ b/drivers/scsi/libata-eh.c
> @@ -286,9 +286,13 @@ void ata_scsi_error(struct Scsi_Host *ho
>  	/* clean up */
>  	spin_lock_irqsave(hs_lock, flags);
>  
> +	if (ap->flags & ATA_FLAG_SCSI_HOTPLUG)
> +		queue_work(ata_hotplug_wq, &ap->hotplug_task);
> +
>  	if (ap->flags & ATA_FLAG_RECOVERED)
>  		ata_port_printk(ap, KERN_INFO, "EH complete\n");
> -	ap->flags &= ~ATA_FLAG_RECOVERED;
> +
> +	ap->flags &= ~(ATA_FLAG_SCSI_HOTPLUG | ATA_FLAG_RECOVERED);
>  
>  	spin_unlock_irqrestore(hs_lock, flags);
>  
> @@ -1736,6 +1740,70 @@ static void ata_eh_finish(struct ata_por
>  }
>  
>  /**
> + *	ata_eh_scsi_hotplug - SCSI part of hotplug
> + *	@data: Pointer to ATA port to perform SCSI hotplug on
> + *
> + *	Perform SCSI part of hotplug.  It's executed from a separate
> + *	workqueue after EH completes.  This is necessary because SCSI
> + *	hot plugging requires working EH and hot unplugging is
> + *	synchronized with hot plugging with a mutex.
> + *
> + *	LOCKING:
> + *	Kernel thread context (may sleep).
> + */
> +void ata_eh_scsi_hotplug(void *data)

Would prefer ata_eh_scsi_hotplug() to be in libata-scsi.  Otherwise ACK.

	Jeff




  reply	other threads:[~2006-05-19 16:05 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-19 15:48 [PATCHSET 03/03] add hotplug support, take 3 Tejun Heo
2006-05-19 15:48 ` [PATCH 04/13] libata-hp: implement warmplug Tejun Heo
2006-05-19 15:48 ` [PATCH 09/13] sata_sil: convert to new probing mechanism and add hotplug support Tejun Heo
2006-05-19 15:48 ` [PATCH 07/13] libata-hp: implement unload-unplug Tejun Heo
2006-05-19 16:10   ` Jeff Garzik
2006-05-23 14:53     ` Tejun Heo
2006-05-19 15:48 ` [PATCH 03/13] libata-hp: implement SCSI part of hotplug Tejun Heo
2006-05-19 16:05   ` Jeff Garzik [this message]
2006-05-23 14:52     ` Tejun Heo
2006-05-19 15:48 ` [PATCH 05/13] libata-hp: hook warmplug Tejun Heo
2006-05-19 15:48 ` [PATCH 08/13] ata_piix: convert ata_piix to new probing mechanism Tejun Heo
2006-05-19 15:48 ` [PATCH 02/13] libata-hp: implement hotplug Tejun Heo
2006-05-19 16:04   ` Jeff Garzik
2006-05-19 15:48 ` [PATCH 01/13] libata-hp: implement ata_eh_detach_dev() Tejun Heo
2006-05-19 15:48 ` [PATCH 06/13] libata-hp: implement bootplug Tejun Heo
2006-05-19 16:09   ` Jeff Garzik
2006-05-19 15:48 ` [PATCH 11/13] sata_sil24: convert to new probing mechanism and add hotplug support Tejun Heo
2006-05-19 15:48 ` [PATCH 10/13] ahci: " Tejun Heo
2006-05-19 15:48 ` [PATCH 12/13] libata-hp: killl ops->probe_reset Tejun Heo
2006-05-19 15:48 ` [PATCH 13/13] libata-hp: move ata_do_reset() to libata-eh.c Tejun Heo
2006-05-19 16:13   ` Jeff Garzik
2006-05-19 20:13     ` [PATCH 0/7] sata_mv: assorted fixes Mark Lord
2006-05-19 20:21       ` [PATCH 1/7] sata_mv: prevent unnecessary double-resets Mark Lord
2006-05-19 20:24       ` [PATCH 2/7] sata_mv: deal with interrupt coalescing interrupts Mark Lord
2006-05-20  4:32         ` Jeff Garzik
2006-05-20 13:13           ` Mark Lord
2006-05-20 13:24             ` Jeff Garzik
2006-05-20 14:01               ` Mark Lord
2006-05-22  6:35                 ` Jeff Garzik
2006-05-19 20:29       ` [PATCH 3/7] sata_mv: chip initialization fixes Mark Lord
2006-05-19 20:33       ` [PATCH 4/7] sata_mv: spurious interrupt workaround Mark Lord
2006-05-19 20:36       ` [PATCH 5/7] sata_mv: remove local copy of queue indexes Mark Lord
2006-05-19 20:40       ` [PATCH 6/7] sata_mv: endian fix Mark Lord
2006-05-19 20:41       ` [PATCH 7/7] sata_mv: version bump Mark Lord
  -- strict thread matches above, loose matches on Subject: below --
2006-05-31 11:25 [PATCHSET 03/03] add hotplug support, take 5 Tejun Heo
2006-05-31 11:25 ` [PATCH 03/13] libata-hp: implement SCSI part of hotplug Tejun Heo
2006-06-08 20:56   ` Jeff Garzik
2006-06-09  2:58     ` Tejun Heo
2006-05-29  6:38 [PATCHSET 03/03] add hotplug support, take 4 Tejun Heo
2006-05-29  6:38 ` [PATCH 03/13] libata-hp: implement SCSI part of hotplug Tejun Heo
2006-05-11 15:32 [PATCHSET 08/11] add hotplug support, take 2 Tejun Heo
2006-05-11 15:32 ` [PATCH 03/13] libata-hp: implement SCSI part of hotplug Tejun Heo

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=446DECCD.1020100@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=forrest.zhao@intel.com \
    --cc=htejun@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mlord@pobox.com \
    /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.