Working with newly available devices

6.10 LPAR mode z/VM guest KVM guest

Errors can occur if you try to work with a device before its sysfs representation is completely initialized.

About this task

When new devices become available to a running Linux® instance, some time elapses until the corresponding device directories and their attributes are created in sysfs. Errors can occur if you attempt to work with a device for which the sysfs structures are not present or are not complete. These errors are most likely to occur and most difficult to handle when you are configuring devices with scripts.

Procedure

Use the following steps before you work with a newly available device to avoid such errors:

  1. Attach the device, for example, with a z/VM® CP ATTACH command or by dynamically attaching a device to a KVM virtual server.
  2. Assure that the sysfs structures for the new device are complete:
    # echo 1 > /proc/cio_settle
    This command returns control after all pending updates to sysfs are complete.
    Tip: For CCW devices, you can omit this step if you then use chzdev to work with the devices. chzdev (and alternatively chccwdev) triggers cio_settle for you and waits for cio_settle to complete.

Results

You can now work with the new device. For example, you can set the device online or set attributes for the device.