All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Lukasz Kosewski <lkosewsk@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/3] Add disk hotswap support to libata RESEND #5
Date: Mon, 03 Oct 2005 11:47:01 -0400	[thread overview]
Message-ID: <43415275.4020407@pobox.com> (raw)
In-Reply-To: <355e5e5e0510030730q2b3e295creaec6ebd129999f9@mail.gmail.com>

Lukasz Kosewski wrote:
> On 9/28/05, Jeff Garzik <jgarzik@pobox.com> wrote:
> 
>>>+     dev->flags &= ~ATA_DFLAG_LBA48;
>>>+
>>
>>probably should just clear out all the flags...
> 
> 
> I'll look into making this cleaner :)  During testing this was the
> only one that was necessary, but I'll do some clean-up foo on this.
> 
> 
>>is ata_chk_err() call in ata_to_sense_error() the only place that needs
>>to talk to the hardware?  If so, maybe we could work around that by
>>making sure it is passed register values, avoiding the need to poke the h/w.
> 
> 
> Yep, it is the only place as far as I can see.  As for passing
> register values, the reason I decided not to do that is because, say,
> a user unplugged his drive because there WAS some kind of error which
> set ATA_ERR.  This would attempt to perform some kind of error check
> which would compound the problem.  However, I agree this is dirty :)
> Should I just check the register values, & ~ATA_ERR, and then pass that in?
> 
> 
>>>+     spin_lock(&ap->host_set->lock);
>>>+     hotplug_todo = ap->plug; // Make sure we don't modify while reading!
>>>+     spin_unlock(&ap->host_set->lock);
>>
>>this lock should always be acquired using spin_lock_irqsave()
> 
> 
> Oops.
> 
> 
>>>+             ata_scsi_handle_unplug(ap);
>>>+
>>>+             // The following flag is necessary on some Seagate drives.
>>>+             ap->flags |= ATA_FLAG_SATA_RESET;
>>
>>we can't unconditionally set this for all controllers
>>
>>For PATA hotplug, which this code will eventually handle, the SATA
>>SControl register doesn't even exist :)
> 
> 
> if (ap & ATA_FLAG_SATA) ap->flags |= ATA_FLAG_SATA_RESET
> ? :)
> 
> 
>>>+             ap->udma_mask = ap->orig_udma_mask;
>>
>>dumb question -- what is this for?
>>
>>for hotplug we'll want to go through the entire probe sequence,
>>configuring pio/dma masks all over again.
> 
> 
> OK I'll admit I may not have looked through the code enough on that
> one, but here's a situation I remember about this:
> Had a drive which supported UDMA 5 max.  Unplugged it, plugged in a
> drive which supported UDMA 6, but libata reported UDMA 5 max.  Since
> the flags aren't reset, and ata_mode_string() works from slowest to
> fastest, this will always happen unless we reset the flags to some
> default value.  So... voila.  Do you have a suggestion for making this
> cleaner?

Well, overall what needs to happen for newly-plugged-in devices is the a 
re-run of the probe sequence.  The flags should certainly be reset to a 
default value, the same value that the device would see had it been 
plugged in when the driver loaded:  ata_bus_probe() call sequence, after 
initialization from ata_host_init().  This may require saving a few 
pieces of data, as you have done, agreed.

	Jeff

      reply	other threads:[~2005-10-03 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27  1:01 [PATCH 2/3] Add disk hotswap support to libata RESEND #5 Lukasz Kosewski
2005-09-27 19:42 ` Bernhard C. Schrenk
2005-09-27 21:47   ` Lukasz Kosewski
2005-09-28 19:10 ` Jeff Garzik
2005-09-28 23:20   ` Alan Cox
2005-10-03 15:19     ` Lukasz Kosewski
2005-10-03 15:53       ` Jeff Garzik
2005-10-03 16:09       ` Alan Cox
2005-10-03 14:30   ` Lukasz Kosewski
2005-10-03 15:47     ` Jeff Garzik [this message]

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=43415275.4020407@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lkosewsk@gmail.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.