From: Chandra Seetharaman <sekharan@us.ibm.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Hannes Reinecke <hare@suse.de>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, michaelc@cs.wisc.edu,
Peter Jones <pjones@redhat.com>
Subject: Re: [PATCH 1/3] scsi_dh: Add modalias support for SCSI targets
Date: Wed, 08 Apr 2009 12:13:03 -0700 [thread overview]
Message-ID: <1239217983.12451.40.camel@chandra-ubuntu> (raw)
In-Reply-To: <ac3eb2510904072215g268956f7i44bd3005be64632@mail.gmail.com>
Hi Kay,
Thanks for looking into this.
On Tue, 2009-04-07 at 22:15 -0700, Kay Sievers wrote:
> On Tue, Apr 7, 2009 at 16:50, Chandra Seetharaman <sekharan@us.ibm.com> wrote:
> > On Wed, 2009-04-08 at 01:22 +0200, Hannes Reinecke wrote:
> >> On Fri, Apr 03, 2009 at 03:43:10PM -0700, Chandra Seetharaman wrote:
>
> >> > If not, Can you accept the patches, please.
> >> >
> >> The problem here is that module autoloading doesn't work for
> >> device_handler. We have to have the callbacks in place _before_
> >> driver probing starts as we might need to intercept the I/O
> >> requests and/or errors. When using modalias the module loading
> >> will be too late and the hooks will only be established after
> >> the probing has already happened.
> >> (The module autoloading is an asynchronous call in device_add(),
> >> where we don't write for it to succeed. So probing will continue
> >> and we woulnd't have the callbacks in place when probing
> >> starts).
> >
> > Your analysis is correct.
> >
> > But, the chicken-n-egg problem you described exists only for the first
> > device that is probed, module will be in place for the other devices.
> >
> > The first device race is handled by acting on the bus notification for
> > the BUS_NOTIFY_BOUND_DRIVER event (patch 3/3 in my patch list).
>
> How do you make sure, that the module is initialized when the
> BOUND_DRIVER event is happening? The userspace process loading the
> module can take any time to load, and I don't see how that is handled.
> Care to explain that in detail?
Sure.
Currently, when a scsi_dh (like scsi_dh_rdac) module is insmodded, it
sets up a notification for BUS_NOTIFY_ADD_DEVICE, and will walk thru the
bus list and attach all the devices that _are_ already configured.
With the attached patches, there are three ways that a device
can get attached to the module.
1 scanning of the bus list by the module, if the module is inserted
after the device is configured.
2 by handling NOTIFY_ADD_DEVICE by the module, if the device comes
after the module is inserted.
3 the third case, which is the race Hannes mentioned, which is
mostly w.r.t the device that initiates this modalias chain of
events, is that the device is past the NOTIFY_ADD_DEVICE point
in the device configuration path and is still not completely
configured hence it is not in the bus_list (so 1 and 2 will
miss this). This device will be caught the BOUND_DEVICE
notification which is just before adding the device to the
bus list in the device configuration path.
Hope it is clear now.
>
> I guess, you either need to implement a "device scan" from the module
> loading routine to find all currently unhandled devices, or you need
We do that currently (without these patches) in scsi_dh. But the problem
is how do we get the module in place.
> to issue a blocking request_module() from inside the kernel and try to
> find a matching module, and then run the find again. The modalias
You mean call request_module() during device configuration ? Even if we
do that, we will not find the same devices again if we probe, so we will
have the same issue as we have in hand as of now. So not much of an
improvement.
> seems not like the right solution here.
>
> Thanks,
> Kay
next prev parent reply other threads:[~2009-04-08 19:12 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 1:36 [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Chandra Seetharaman
2009-03-18 1:36 ` [PATCH 1/3] scsi_dh: Add modalias support for SCSI targets Chandra Seetharaman
2009-03-18 13:44 ` Konrad Rzeszutek
2009-03-18 14:02 ` James Bottomley
2009-03-18 14:36 ` Konrad Rzeszutek
2009-03-18 18:30 ` Kay Sievers
2009-03-18 19:18 ` Chandra Seetharaman
2009-03-19 18:54 ` Chandra Seetharaman
2009-03-20 18:24 ` Peter Jones
2009-03-23 22:13 ` Chandra Seetharaman
2009-04-03 22:43 ` Chandra Seetharaman
2009-04-07 20:59 ` James Bottomley
2009-04-07 23:41 ` Chandra Seetharaman
2009-04-08 15:08 ` Peter Jones
2009-04-15 21:52 ` Chandra Seetharaman
2009-04-16 15:18 ` Hannes Reinecke
2009-04-07 23:22 ` Hannes Reinecke
2009-04-07 23:50 ` Chandra Seetharaman
2009-04-08 5:15 ` Kay Sievers
2009-04-08 19:13 ` Chandra Seetharaman [this message]
2009-03-18 18:47 ` James Bottomley
2009-03-18 19:12 ` Chandra Seetharaman
2009-03-18 20:09 ` James Bottomley
2009-03-18 20:24 ` Kay Sievers
2009-03-18 20:26 ` James Bottomley
2009-03-18 20:59 ` Chandra Seetharaman
2009-03-20 17:41 ` Peter Jones
2009-03-18 1:36 ` [PATCH 2/3] scsi_dh: Change scsi device handler modules to utilize modalias Chandra Seetharaman
2009-03-18 13:46 ` Konrad Rzeszutek
2009-03-18 15:43 ` Stefan Richter
2009-03-18 17:25 ` Chandra Seetharaman
2009-03-18 17:50 ` Stefan Richter
2009-03-18 18:18 ` Kay Sievers
2009-03-18 19:44 ` Stefan Richter
2009-03-18 18:50 ` Chandra Seetharaman
2009-03-18 19:46 ` Stefan Richter
2009-03-18 1:36 ` [PATCH 3/3] scsi_dh: Workaround a race condition in module insertion Chandra Seetharaman
2009-03-18 11:31 ` [PATCH 0/3] scsi_dh: Make scsi device handler modules automatically inserted Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2009-04-27 18:06 Chandra Seetharaman
2009-04-27 18:06 ` [PATCH 1/3] scsi_dh: Add modalias support for SCSI targets Chandra Seetharaman
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=1239217983.12451.40.camel@chandra-ubuntu \
--to=sekharan@us.ibm.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=hare@suse.de \
--cc=kay.sievers@vrfy.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=pjones@redhat.com \
--cc=sekharan@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox