Operating System - HP-UX
1846821 Members
10545 Online
110256 Solutions
New Discussion

Significance of -k and -u options to ioscan

 
SOLVED
Go to solution
Nikhil_1
Advisor

Significance of -k and -u options to ioscan

Hi,

I am trying to understand the implications of passing -k or -u options
to ioscan.

The ioscan man page says:
-k Scan kernel I/O system data structures instead of the actual hardware and list the results.
No binding or unbinding of drivers is performed.
-u Scan and list usable I/O system devices instead of the actual hardware.
Usable I/O devices are those having a driver in the kernel and an assigned instance number.

How exactly does ioscan does its job?
How is the binding/unbinding of drivers is performed?
What are these kernel I/O system data structures?
What is the difference between scanning actual hardware and scanning usable I/O system devices?
What determines 'useability' of an I/O system device?


If I remove a certain disk (say a hotswap disk) from my machine and do ioscan -k and then
only ioscan (without -k), then would the disk info turn up in ioscan -k output? Or only
in ioscan (without -k) output?

If ioscan -k is used instead of just ioscan, then is the 'state' field value (CLAIMED,
NO_HW, ERROR etc.) is reliable? Will it be different?

Any reference detail description on ioscan would be very helpful.

With regards,
Nikhil
7 REPLIES 7
Tom Geudens
Honored Contributor

Re: Significance of -k and -u options to ioscan

Hi Nikhil,
This question has been asked before ... but usually for another reason (people asking why ioscan is so slow and seeking a faster way :-).
Take a look at the following thread for some pointers : http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x37a779bffde7d4118fef0090279cd0f9,00.html

Search the forums with "ioscan fast" or "ioscan slow" for more information.

Hope this gets you started,
Tom
A life ? Cool ! Where can I download one of those from ?
Bill McNAMARA_1
Honored Contributor

Re: Significance of -k and -u options to ioscan

The -k option will show what hw was present, or what hardware was present and now isn't, since the kernel was loaded.
It will not scan the hardware to look for newly added devices.
Thus, if you add a disk or lun or device (hotpluggable - ie fibre or disk) if you specify the -k option, the new hardware will not be shown.. however, running the ioscan without the -k option will discover the device, as it asks the drivers to do a scan.
(device files may then need to be created with insf for example).

Use the -k option when you haven't added hardware as it will show you all failed states just fine.

I've never seen a state of error, UNKNOWN is also possible - when no driver claims the hardware (ie driver not installed)

Note that running 2 ioscans simultaneously can hang scsi busses (scsi driver doing a bus resets while the other is scanning - this may lead to states of SCAN, if you're luckly enough to get a return..)

Later,
Bill
It works for me (tm)
eran maor
Honored Contributor

Re: Significance of -k and -u options to ioscan

Hi

doing ioscan -k will go to the data in the kernel about your device .
this is the fast way to get the info about your computer , we dont change a lot our hardware in the computer , so most of the time we use the ioscan -k to get fast result .

you are rigth , if you are moving a device from your computer you will not see the result if you are using ioscan -k .

and no , ioscan without no option will not update the kernel about your hardware , you will need to reboot the system to get the rigth info with ioscan -k .

remember , for quick response allways use the ioscan -fnk .

for seeing any changes that you made in the system before reboot , do ioscan -fn .
love computers
Donald Kok
Respected Contributor

Re: Significance of -k and -u options to ioscan

Hi Nikhil,

At system startup a ioscan is done, and the info is kept in the kernel. If you haven not altered your system, the ioscan -k is much faster and still reliable. If you change your system (adding disks etc) the ioscan -k is NOT reliable. In this case you should use the ioscan (without -k).

The advantage of -k and -u is that it is very fast. You do not have to wait for all the hardware

HTH
Donald

My systems are 100% Murphy Compliant. Guaranteed!!!
Dietmar Konermann
Honored Contributor
Solution

Re: Significance of -k and -u options to ioscan

Hi!

> How exactly does ioscan does its job?

To explain the full mechanism would be a lot too much for this forum... :) But in general the kernel scans the hardware and builds/updates/dumps (parts of) the IO Tree or, w/ -[uk], only dumps (parts of) the IO Tree using a human readable format. BTW, the hardware path corresponds to this tree structure.

> How is the binding/unbinding of drivers is performed?

This can be triggered with the -M option of ioscan. However the driver needs to support this facility. More important is the "claiming" which is usually performed automatically for newly discovered hardware during "real" scans.

> What are these kernel I/O system data structures?

This is the IO Tree structure as described above. The kernel holds this in memory and provides an API for ioscan to work with it.

> What is the difference between scanning actual hardware and scanning usable I/O system devices?

The latter only looks at the IO Tree, does no scan.

> What determines 'useability' of an I/O system device?

In general (with some exceptions) usable devices are those that are CLAIMED by a driver that grabbed a major number. This means that -k and -u do nearly the same... with the difference that -u filters out several "unusable" devices. (e.g. processor, memory, UNCLAIMED devices, etc.).

BTW, running a "normal" ioscan updates the IO Tree... so a following ioscan -[ku] shows the updated data.


Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Shahul
Esteemed Contributor

Re: Significance of -k and -u options to ioscan


Hi

ioscan -fnk is taking the details from kernel, So it will be fast. Mainly this command will be used whenever you want to find out a device file or H/W address of an existing and using device. Since the output comes fast, we don't need to sleep infront of console.

ioscan -fun will list the devices which are having an instance number and driver available in kernel. For clearing ur doubt U can do this
#ioscan -fnk > /tmp/iok
#ioscan -fun > /tmp/iou
#diff iok iou

Now U will be able to see the exact difference. Now, why processor and memory is not listed? Their drivers are listed as processor and memory respectively, But
#lsdev|egrep "memory|processor"

I hope now you are clear about this. One more thing U can see in man page that U can't use u and k together..see
#ioscan -fuk (It is taken the command literal than logical...am I right?)

Now the reliability of ioscan -k!! Why U need to rely on this when ioscan -fn is available. If U have added or removed any device from system and looking for the current status, use ioscan -fn. k option will not give the current status. If U have not added/removed anything to/from system, old and current status will be same, In that case U can even use option k.

For more information see man page of ioscan, lssf, lsdev ..etc.

Best of luck
Shahul
Shahul
Esteemed Contributor

Re: Significance of -k and -u options to ioscan


Hi

I forgot to mention this. Bot u and k will take the details from kernel. Both will not give current status. The only difference between this two is 2u" will not give the devices which are not having bla..bla..(Mentioned above).

Best of luck
Shahul