linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Владимир Дашевский" <vladimir.dashevsky@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jeff Garzik <jgarzik@pobox.com>, linux-ide@vger.kernel.org
Subject: Re: hot plug on ICH9 with AHCI on
Date: Mon, 23 Mar 2009 14:38:20 +0300	[thread overview]
Message-ID: <49C774AC.50603@gmail.com> (raw)
In-Reply-To: <49C6EE49.9080307@kernel.org>

Tejun!
> Hello,
>
> Владимир Дашевский wrote:
>   
>>>> Well, for example, USB devices have a pull-up resistor on their D+ line.
>>>> DC bias can be used for detection of device presence without mechanical
>>>> switch.
>>>>         
>>> SATA is not USB and onlineness detection isn't that simple.  Also,
>>> have you tried to run a system on a USB device over flaky connection?
>>>   
>>>       
>> Well, I cannot argue with you here. All that I wanted to say is that I
>> would prefer more optimistic software behavior if the hardware really
>> supports device connection status.
>>     
>
> I really don't follow your train of thoughts here.  Are you saying
> that the driver should be optimistic about the reliability about
> status reported by the hardware even when it is inherently imprecise
> (please read the spec) and real world experiments prove that?
>   
No. I ment that driver should performs better if the hardware supports 
some features for that. Consider two different cases.
1. hardware derives port population status by sensing the carrier in the 
data link. In this case it is possible that some EMI noise can damage 
link integrity so strongly that not data bits but also a carrier will be 
lost for a short time. This will lead to 'port is not present' status 
however noone has actually removed the drive.
2. Hardware implements some feature like pull-up resistor in USB, or 
special shorter 'present' contact as in PCI or CPCI connectors, or it 
simply senses some dc current through power lines etc. In this case port 
status is robust over EMI noise and be used to inform driver of actual 
connection.
My thought was to improve driver behavior in case 2, either autodetected 
by PCI IDs or manually overriden by some configure script.
>>> -EIO will happen, fuser, but if you want something intelligent, hal +
>>> dbus.
>>>   
>>>       
>> Sorry, I missed the sense of this sentence.
>>     
>
> -EIO will happen to any processes trying to do IO on the removed
> device.  fuser will find out who's using the block device but if you
> want something more intelligent, look at hal + dbus.
>   
Hm, I tried to write fuser /dev/sda and got empty output. It seems that 
file system does not open sda. How it works?
>> I tried this deletion with fdisk and see that fdisk does not even
>> comply for device failure. It just starts to print empty partition
>> table and so on. So the question is how to properly close any
>> activity concerned with device being deleted if I do not know
>> exactly what is that activity? Are the most typical programs which
>> are allowed to use raw block devices aware of unexpected block
>> device loss?
>>     
> Please take a look at how desktop guys are handling the issue.  It's
> not something which can be handled in kernel proper.
>   
Ok.
>   
>>> I don't really follow what you're trying to achieve but if you want
>>> some fancy snapshotting + remapping trick, the best place would be dm.
>>>   
>>>       
>> Well, I didn't think of any tricks. I just deleted the drive as you
>> taught me and tried to get it back without moving myself in front of the
>> server. :-)
>> However, I think that some call to rescan scsi devices will be useful.
>>     
>
> Ah.. in that case, you can do
>
>  # echo - - - > /sys/class/scsi_host/hostN/scan
>   
well, it works but it takes of about 10 seconds to finish scan for 
deleted drive. is this ok?
Probably, that's because drive goes down after deletion and it starts to 
spin up during this scan.
>>> The biggest obstacle is that there aren't too many enclosure devices
>>> floating around.  What kind of device are you using?
>>>   
>>>       
>> I don't know exactly what device are you talking about. I was talking
>> about LED message types that are supported in ICH9.
>> As for my server, ICH9 provides SGPIO interface that is routed to
>> 4-drive hot-swap backplane based on AMI MG9071 chip. However, this
>> information isn't needed to program ICH9 since the LED message mechanism
>> is supported in it. Other message types are not supported. And it is
>> very strange that linux ahci still does not support this functionality
>> since it was first introduced in ICH8 (datasheet first release in June
>> of 2006).
>>     
>
> Yeah, I know it has been in the spec but without hardware to play with
> it's difficult to add driver features and lack of general availability
> also means lower demand.
>   
Well, I just cannot imagine how software raid can work without clearly 
visible state. One drive mixed up in RAID5 and the whole array can get 
damaged. And it is not so difficult to mix them up because drive names 
may differ from physical slot numbers.

>> PS: My code has about 11Kb of text and supports all useful RAID states:
>> NORMAL, LOCATE, REBUILD, FAILURE, HOTSPARE, PREDICTED FAILURE SOON. I
>> have tested in on my server and it works. I think it can be useful for
>> other implementations of soft RAID systems with hat swap support.
>>     
>
> I think it should be independent from RAID but having general
> enclosure support will be nice.  Care to post the patches?
>
>   
Well, I can provide you with a code which works on my ICH9 Supermicro 
platform. I believe it will also work with both ICH8 and ICH10.
However, since I could not install this module as traditional pci driver 
(the kernel decided not to claim my ahci device since the main driver 
present in the system) I had to rewrite it as a general linux kernel 
module. It justs scan pci devices for AHCI capable ones and remaps their 
ABAR to try enclosure management support. For now, only my ICH9 PCI IDs 
are in my try list. All AHCI EM-capable devices get their associated 
proc interface - /proc/ahci_emX/leds*. This module actually works in 
parallel with kernel ahci driver but I think it will be a conflict with 
it once the kernel driver starts to support em by itself. I guess, the 
best way would be to document some API for controlling the EM, then to 
declare some kernel ahci flag that will indicate full EM presence in the 
kernel. Then I can improve my ahci_em module to skip its installation 
when similar functions are built into the kernel.

My interface is quite simple. You just write a char to leds-controlling 
proc file to set state of leds, for example:
echo r > /proc/ahci_em0/leds0 means you asked for REBUILD state 
indicated in the bay of port 0.
I think that most of users would prefer additional module rather that 
kernel udgrade, for the first time. Also, I am not very close to linux 
kernel to provide a kernel patch.

Thanks.

Best regards, Vladimir Dashevsky




  reply	other threads:[~2009-03-23 11:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 22:12 hot plug on ICH9 with AHCI on Владимир Дашевский
2009-03-20  2:04 ` Tejun Heo
2009-03-20  9:55   ` Владимир Дашевский
     [not found]     ` <49C39933.4020501@kernel.org>
2009-03-20 15:31       ` Владимир Дашевский
2009-03-22 12:51       ` Владимир Дашевский
2009-03-22 15:08         ` Tejun Heo
2009-03-22 16:07           ` Владимир Дашевский
2009-03-22 16:41             ` Tejun Heo
2009-03-22 18:26               ` Владимир Дашевский
2009-03-23  2:04                 ` Tejun Heo
2009-03-23 11:38                   ` Владимир Дашевский [this message]
2009-03-23 12:01                     ` Tejun Heo
2009-03-24  8:26                       ` Владимир Дашевский

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=49C774AC.50603@gmail.com \
    --to=vladimir.dashevsky@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@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).