On Sun, 26 May 2019 23:43:42 -0400 Yan Zhao <yan.y.zhao@xxxxxxxxx> wrote: > migration_version attribute is used to check migration compatibility > between two mdev device of the same mdev type. s/device/devices/ > The key is that it's rw and its data is opaque to userspace. > > Userspace reads migration_version of mdev device at source side and > writes the value to migration_version attribute of mdev device at target > side. It judges migration compatibility according to whether the read > and write operations succeed or fail. > > As this attribute is under mdev_type node, userspace is able to know > whether two mdev devices are compatible before a mdev device is created. > > userspace needs to check whether the two mdev devices are of the same > mdev type before checking the migration_version attribute. It also needs > to check device creation parameters if aggregation is supported in > future. > > __ userspace > /\ \ > / \write > / read \ > ________/__________ ___\|/_____________ > | migration_version | | migration_version |-->check migration > --------------------- --------------------- compatibility > mdev device A mdev device B > > Cc: Alex Williamson <alex.williamson@xxxxxxxxxx> > Cc: Erik Skultety <eskultet@xxxxxxxxxx> > Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> > Cc: Cornelia Huck <cohuck@xxxxxxxxxx> > Cc: "Tian, Kevin" <kevin.tian@xxxxxxxxx> > Cc: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx> > Cc: "Wang, Zhi A" <zhi.a.wang@xxxxxxxxx> > Cc: Neo Jia <cjia@xxxxxxxxxx> > Cc: Kirti Wankhede <kwankhede@xxxxxxxxxx> > Cc: Daniel P. Berrangé <berrange@xxxxxxxxxx> > Cc: Christophe de Dinechin <dinechin@xxxxxxxxxx> > > Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx> > > --- > v3: > 1. renamed version to migration_version > (Christophe de Dinechin, Cornelia Huck, Alex Williamson) > 2. let errno to be freely defined by vendor driver > (Alex Williamson, Erik Skultety, Cornelia Huck, Dr. David Alan Gilbert) > 3. let checking mdev_type be prerequisite of migration compatibility > check. (Alex Williamson) > 4. reworded example usage section. > (most of this section came from Alex Williamson) > 5. reworded attribute intention section (Cornelia Huck) > > v2: > 1. added detailed intent and usage > 2. made definition of version string completely private to vendor driver > (Alex Williamson) > 3. abandoned changes to sample mdev drivers (Alex Williamson) > 4. mandatory --> optional (Cornelia Huck) > 5. added description for errno (Cornelia Huck) > --- > Documentation/vfio-mediated-device.txt | 113 +++++++++++++++++++++++++ > 1 file changed, 113 insertions(+) > While I probably would have written a more compact description, your version is fine with me as well. Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>