Hi Everyone,

We want to add extra options to device xml to skip reattach of pci passthrough devices. Following is xml format for pci passthrough devices added to domain as of now.

<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
      <address domain='0x0000' bus='0x00' slot='0x1a' function='0x7'/>
  </source>
</hostdev>
 

When we pass managed=’yes’ flag through xml, libvirt takes responsibility of detaching device on domain(guest VM) start and reattaching on domain shutdown. We observed some issues where guest VM shutdown may take long time, blocked for reattach operation on pci passthrough device. As domain lock is held during this time it also makes libvirt mostly inactive as it blocks even basic operations like (virsh list). Reattaching of device to host can block due to reasons like buggy driver or initialization of device itself can take long time in some cases.

We want to pass following extra options to resolve this:

  1. skipReAttach (optional flag)

In some cases we do not need to reattach device to host as it may be reserved only for guests, with this flag we can skip reattach operation on host.  We do not want to modify managed flag to avoid regression, so thinking of adding new optional flag.

  1. reAttachDriverName (optional flag)

Name of driver to which we want to attach instead of default, to avoid reattaching to buggy driver. Currently libvirt asks host to auto selects driver for device.

 

Yes we can use managed=’no’ but in that case user has to take responsibility of detaching device before starting domain which we do not want. Please let us know your views on this.

 

Thanks

Manish Mishra