• Cornelia Huck's avatar
    virtio: hint if callbacks surprisingly might sleep · ab7a2375
    Cornelia Huck authored
    A virtio transport is free to implement some of the callbacks in
    virtio_config_ops in a matter that they cannot be called from
    atomic context (e.g. virtio-ccw, which maps a lot of the callbacks
    to channel I/O, which is an inherently asynchronous mechanism).
    This can be very surprising for developers using the much more
    common virtio-pci transport, just to find out that things break
    when used on s390.
    
    The documentation for virtio_config_ops now contains a comment
    explaining this, but it makes sense to add a might_sleep() annotation
    to various wrapper functions in the virtio core to avoid surprises
    later.
    
    Note that annotations are NOT added to two classes of calls:
    - direct calls from device drivers (all current callers should be
      fine, however)
    - calls which clearly won't be made from atomic context (such as
      those ultimately coming in via the driver core)
    Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    ab7a2375
virtio.c 11 KB