[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: device compatibility interface for live migration with assigned devices



On Monday, September 14, 2020 10:45 PM
Alex Williamson <alex williamson redhat com> wrote:

> To: Zeng, Xin <xin zeng intel com>
> Cc: Zhao, Yan Y <yan y zhao intel com>; Sean Mooney
> <smooney redhat com>; Cornelia Huck <cohuck redhat com>; Daniel
> P.Berrangé <berrange redhat com>; kvm vger kernel org; libvir-
> list redhat com; Jason Wang <jasowang redhat com>; qemu-
> devel nongnu org; kwankhede nvidia com; eauger redhat com; Wang,
> Xin-ran <xin-ran wang intel com>; corbet lwn net; openstack-
> discuss lists openstack org; Feng, Shaohe <shaohe feng intel com>; Tian,
> Kevin <kevin tian intel com>; Parav Pandit <parav mellanox com>; Ding,
> Jian-feng <jian-feng ding intel com>; dgilbert redhat com;
> zhenyuw linux intel com; Xu, Hejie <hejie xu intel com>;
> bao yumeng zte com cn; intel-gvt-dev lists freedesktop org;
> eskultet redhat com; Jiri Pirko <jiri mellanox com>; dinechin redhat com;
> devel ovirt org
> Subject: Re: device compatibility interface for live migration with assigned
> devices
> 
> On Mon, 14 Sep 2020 13:48:43 +0000
> "Zeng, Xin" <xin zeng intel com> wrote:
> 
> > On Saturday, September 12, 2020 12:52 AM
> > Alex Williamson <alex williamson redhat com> wrote:
> > > To: Zhao, Yan Y <yan y zhao intel com>
> > > Cc: Sean Mooney <smooney redhat com>; Cornelia Huck
> > > <cohuck redhat com>; Daniel P.Berrangé <berrange redhat com>;
> > > kvm vger kernel org; libvir-list redhat com; Jason Wang
> > > <jasowang redhat com>; qemu-devel nongnu org;
> > > kwankhede nvidia com; eauger redhat com; Wang, Xin-ran <xin-
> > > ran wang intel com>; corbet lwn net; openstack-
> > > discuss lists openstack org; Feng, Shaohe <shaohe feng intel com>;
> Tian,
> > > Kevin <kevin tian intel com>; Parav Pandit <parav mellanox com>;
> Ding,
> > > Jian-feng <jian-feng ding intel com>; dgilbert redhat com;
> > > zhenyuw linux intel com; Xu, Hejie <hejie xu intel com>;
> > > bao yumeng zte com cn; intel-gvt-dev lists freedesktop org;
> > > eskultet redhat com; Jiri Pirko <jiri mellanox com>;
> dinechin redhat com;
> > > devel ovirt org
> > > Subject: Re: device compatibility interface for live migration with assigned
> > > devices
> > >
> > > On Fri, 11 Sep 2020 08:56:00 +0800
> > > Yan Zhao <yan y zhao intel com> wrote:
> > >
> > > > On Thu, Sep 10, 2020 at 12:02:44PM -0600, Alex Williamson wrote:
> > > > > On Thu, 10 Sep 2020 13:50:11 +0100
> > > > > Sean Mooney <smooney redhat com> wrote:
> > > > >
> > > > > > On Thu, 2020-09-10 at 14:38 +0200, Cornelia Huck wrote:
> > > > > > > On Wed, 9 Sep 2020 10:13:09 +0800
> > > > > > > Yan Zhao <yan y zhao intel com> wrote:
> > > > > > >
> > > > > > > > > > still, I'd like to put it more explicitly to make ensure it's not
> > > missed:
> > > > > > > > > > the reason we want to specify compatible_type as a trait and
> > > check
> > > > > > > > > > whether target compatible_type is the superset of source
> > > > > > > > > > compatible_type is for the consideration of backward
> > > compatibility.
> > > > > > > > > > e.g.
> > > > > > > > > > an old generation device may have a mdev type xxx-v4-yyy,
> > > while a newer
> > > > > > > > > > generation  device may be of mdev type xxx-v5-yyy.
> > > > > > > > > > with the compatible_type traits, the old generation device is
> still
> > > > > > > > > > able to be regarded as compatible to newer generation
> device
> > > even their
> > > > > > > > > > mdev types are not equal.
> > > > > > > > >
> > > > > > > > > If you want to support migration from v4 to v5, can't the
> > > (presumably
> > > > > > > > > newer) driver that supports v5 simply register the v4 type as
> well,
> > > so
> > > > > > > > > that the mdev can be created as v4? (Just like QEMU
> versioned
> > > machine
> > > > > > > > > types work.)
> > > > > > > >
> > > > > > > > yes, it should work in some conditions.
> > > > > > > > but it may not be that good in some cases when v5 and v4 in the
> > > name string
> > > > > > > > of mdev type identify hardware generation (e.g. v4 for gen8,
> and v5
> > > for
> > > > > > > > gen9)
> > > > > > > >
> > > > > > > > e.g.
> > > > > > > > (1). when src mdev type is v4 and target mdev type is v5 as
> > > > > > > > software does not support it initially, and v4 and v5 identify
> > > hardware
> > > > > > > > differences.
> > > > > > >
> > > > > > > My first hunch here is: Don't introduce types that may be
> compatible
> > > > > > > later. Either make them compatible, or make them distinct by
> design,
> > > > > > > and possibly add a different, compatible type later.
> > > > > > >
> > > > > > > > then after software upgrade, v5 is now compatible to v4, should
> the
> > > > > > > > software now downgrade mdev type from v5 to v4?
> > > > > > > > not sure if moving hardware generation info into a separate
> > > attribute
> > > > > > > > from mdev type name is better. e.g. remove v4, v5 in mdev type,
> > > while use
> > > > > > > > compatible_pci_ids to identify compatibility.
> > > > > > >
> > > > > > > If the generations are compatible, don't mention it in the mdev
> type.
> > > > > > > If they aren't, use distinct types, so that management software
> > > doesn't
> > > > > > > have to guess. At least that would be my naive approach here.
> > > > > > yep that is what i would prefer to see too.
> > > > > > >
> > > > > > > >
> > > > > > > > (2) name string of mdev type is composed by "driver_name +
> > > type_name".
> > > > > > > > in some devices, e.g. qat, different generations of devices are
> > > binding to
> > > > > > > > drivers of different names, e.g. "qat-v4", "qat-v5".
> > > > > > > > then though type_name is equal, mdev type is not equal. e.g.
> > > > > > > > "qat-v4-type1", "qat-v5-type1".
> > > > > > >
> > > > > > > I guess that shows a shortcoming of that "driver_name +
> type_name"
> > > > > > > approach? Or maybe I'm just confused.
> > > > > > yes i really dont like haveing the version in the mdev-type name
> > > > > > i would stongly perfger just qat-type-1 wehere qat is just there as a
> way
> > > of namespacing.
> > > > > > although symmetric-cryto, asymmetric-cryto and compression
> woudl
> > > be a better name then type-1, type-2, type-3 if
> > > > > > that is what they would end up mapping too. e.g. qat-compression
> or
> > > qat-aes is a much better name then type-1
> > > > > > higher layers of software are unlikely to parse the mdev names but
> as a
> > > human looking at them its much eaiser to
> > > > > > understand if the names are meaningful. the qat prefix i think is
> > > important however to make sure that your mdev-types
> > > > > > dont colide with other vendeors mdev types. so i woudl encurage all
> > > vendors to prefix there mdev types with etiher the
> > > > > > device name or the vendor.
> > > > >
> > > > > +1 to all this, the mdev type is meant to indicate a software
> > > > > compatible interface, if different hardware versions can be software
> > > > > compatible, then don't make the job of finding a compatible device
> > > > > harder.  The full type is a combination of the vendor driver name plus
> > > > > the vendor provided type name specifically in order to provide a type
> > > > > namespace per vendor driver.  That's done at the mdev core level.
> > > > > Thanks,
> > > >
> > > > hi Alex,
> > > > got it. so do you suggest that vendors use consistent driver name over
> > > > generations of devices?
> > > > for qat, they create different modules for each generation. This
> > > > practice is not good if they want to support migration between devices
> > > > of different generations, right?
> > > >
> > > > and can I understand that we don't want support of migration between
> > > > different mdev types even in future ?
> > >
> > > You need to balance your requirements here.  If you're creating
> > > different drivers per generation, that suggests different device APIs,
> > > which is a legitimate use case for different mdev types.  However if
> > > you're expecting migration compatibility, that must be seamless to the
> > > guest, therefore the device API must be identical.  That suggests that
> > > migration between different types doesn't make much sense.  If a new
> > > generation device wants to expose a new mdev type with new features
> or
> > > device API, yet also support migration with an older mdev type, why
> > > wouldn't it simply expose both the old and the new type?
> >
> > I think all of these make sense, and I am assuming it's also reasonable and
> > common that each generation of  device has a separate device driver
> module.
> > On the other hand, please be aware that, the mdev type is consisted of the
> > driver name of the mdev's parent device and the name of a mdev type
> which
> > the device driver specifies.
> > If a new generation device driver wants to expose an old mdev type, it has
> to
> > register  the same driver name as the old one so that the mdev type could
> > be completely same. This doesn't make sense as a) driver name usually is
> > unique for a device driver module. b) If a system has both these two
> > generation devices, once one generation device driver is loaded, the other
> > is not allowed to be loaded due to the same driver name.
> > So to allow a new generation device to simply expose the old mdev type
> for
> > compatibility like you proposed, is it possible to create the mdev type by
> > another approach, e.g. device driver creates its own namespace for the
> > mdev type instead of mdev's parent device driver name being used
> currently?
> 
> TBH, I don't think that it's reasonable or common that different
> drivers are used for each generation of hardware.  Drivers typically
> evolve to support new generations of hardware, often sharing
> significant code between generations. 
> When we deal with mdev
> migration, we have an opaque data stream managed by the driver, our
> default assumption is therefore that the driver plays a significant
> role in the composition of that data stream.  I'm not ruling out that
> we should support some form of compatibility between types, but in the
> described scenario it seems the development model of the vendor drivers
> is not conducive to the most obvious form of compatibility checking.
> Thanks,

Current in-tree QAT driver does the same thing as you said, 
i.e. Drivers evolve to support new generations of hardware, sharing
significant code between generations. We have a kernel module which
contains those significant common code and a couple of device specific
modules which contain device specific code.
                         |<--------------- qat_c62x.ko
                         |<--------------- qat_c62xvf.ko
Intel_qat.ko --|<--------------- qat_dh895xcc.ko
                         |<--------------- qat_dh895xccvf.ko
                         |<--------------- qat_c3xxx.ko
                         |<--------------- qat_c3xxxvf.ko
The benefit is we only need load the device driver modules for
those devices existing in the system, and leave those 
non-related code for non-existing devices. Besides QAT, there are still
other drivers who are using this model, e.g. Intel NIC driver.
For QAT, we will have new generations of QAT devices in future which could 
expose compatible mdev with current one, but because of the naming 
convention of the mdev type, they are not able to do this.
I am not proposing the mdev migration between different types, but looking for
how can we allow multiple device drivers from the same vendor to expose the same
mdev type. It would be great if you think it's worth supporting it.

Thanks,
Xin

> 
> Alex



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]