On Fri, 27 Jul 2012, David Boyes wrote:
> > On which distro do you have problems with chccwdev?
> > [snip]
> > ..which appears to work fine.
>
> It's not a distribution issue; it's a timing-dependent issue that has to do 
> with how quickly your hardware responds. Your script will work *most* of the 
> time -- except when it doesn't.
> Easy way to reproduce the problem is to try your script on a zPDT or a 
> heavily loaded system where the response to requests may not be immediate. 
> The udev settle command isn't a reliable indicator that the device is 
> available.
>
> I'm looking for a reliable method that works all the time.

OK. We have 3 userspace triggered actions here:

1) make the device available to linux, e.g. via vmcp define
2) set the device online via chccwdev
3) actually use the device via its device node

After 1) and before we could do 2) we have to make sure that Linux
would receive a machine check and that the device recognition steps
done by the Common IO Layer (triggered by the machine check) are
finished. Both is achieved by cio_settle which is invoked by chccwdev
(on current distros) before the online setting starts.

The process of setting the device online involves generic path
verification work done by the Common IO Layer and device specific
online processing done by the device driver (DASD in this case). Once
the DASD driver finished its work and created a block device, userspace
is informed about this via uevents. After that chccwdev returns. The
only thing that's missing now is udev creating a device node and that's
covered via udev settle.

I'm certainly no expert of the DASD driver but I can't see a race window
or timing issue here. So unless I'm missing something the described
method should work reliable on current distros. (In a real world scenario
you have to check return codes of the previous steps before executing
the next one.)

Regards,
Sebstian
>
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> ----------------------------------------------------------------------
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
>
>

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to