Skip to contentSkip to conversation

device compatibility interface for live migration with assigned devices

DISCUSSION Yan Zhao 14 participants 118 messages Jul 13, 2020 – Sep 15, 2020 3 messages not in the archive KVM Page 2 of 2

lore
Share & tools
lore
#119 lore raw
In reply to Jason Wang
Quoted 114 lines

From: Jason Wang <[email protected]>
Sent: Wednesday, August 19, 2020 12:19 PM

Quoted 35 lines · Parav Pandit
Quoted 35 lines

From: Jason Wang <[email protected]>
Sent: Wednesday, August 19, 2020 8:16 AM

Quoted 18 lines · Parav Pandit

Hi Jason,

From: Jason Wang <[email protected]>
Sent: Tuesday, August 18, 2020 2:32 PM

On 2020/8/18 下午4:55, Daniel P. Berrangé wrote:
On Tue, Aug 18, 2020 at 11:24:30AM +0800, Jason Wang wrote:
On 2020/8/14 下午1:16, Yan Zhao wrote:
On Thu, Aug 13, 2020 at 12:24:50PM +0800, Jason Wang wrote:
On 2020/8/10 下午3:46, Yan Zhao wrote:
driver is it handled by?
It looks that the devlink is for network device specific, and in devlink.h, it says include/uapi/linux/devlink.h - Network physical device Netlink interface, Actually not, I think there used to have some discussion last year and the conclusion is to remove this comment.

Quoted 4 lines

[...]

Quoted 2 lines

Yes, but it could be hard. E.g vDPA will chose to use devlink (there's a long

debate on sysfs vs devlink). So if we go with sysfs, at least two APIs needs to be supported ...

Quoted 3 lines

We had internal discussion and proposal on this topic. I wanted Eli Cohen to be back from vacation on Wed 8/19, but since this is

active discussion right now, I will share the thoughts anyway.

Quoted 2 lines

Here are the initial round of thoughts and proposal.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

User requirements:
---------------------------
1. User might want to create one or more vdpa devices per PCI PF/VF/SF.
2. User might want to create one or more vdpa devices of type net/blk or

other type.

Quoted 1 line

3. User needs to look and dump at the health of the queues for debug

purpose.

Quoted 28 lines
Quoted 11 lines
Quoted 2 lines

4. During vdpa net device creation time, user may have to provide a MAC

address and/or VLAN.

Quoted 3 lines

5. User should be able to set/query some of the attributes for debug/compatibility check 6. When user wants to create vdpa device, it needs

to know which device supports creation.

Quoted 2 lines

7. User should be able to see the queue statistics of doorbells, wqes etc regardless of class type

Note that wqes is probably not something common in all of the vendors.

Yes. I virtq descriptors stats is better to monitor the virtqueues.

Quoted 15 lines
Quoted 3 lines

To address above requirements, there is a need of vendor agnostic tool, so

that user can create/config/delete vdpa device(s) regardless of the vendor.

Quoted 11 lines

Hence,
We should have a tool that lets user do it.

Examples:
-------------
(a) List parent devices which supports creating vdpa devices. It also shows which class types supported by this parent device. In below command two parent devices support vdpa device creation. First is PCI VF whose bdf is 03.00:5.
Second is PCI SF whose name is mlx5_sf.1

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
$ vdpa list pd

What did "pd" mean?

Parent device which support creation of one or more vdpa devices. In a system there can be multiple parent devices which may be support vdpa

creation.

Quoted 1 line

User should be able to know which devices support it, and when user creates a

vdpa device, it tells which parent device to use for creation as done in below vdpa dev add example.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

pci/0000:03.00:5
class_supports
net vdpa
virtbus/mlx5_sf.1

So creating mlx5_sf.1 is the charge of devlink?

Yes.
But here vdpa tool is working at the parent device identifier {bus+name}

instead of devlink identifier.

Quoted 11 lines
Quoted 10 lines
Quoted 7 lines

class_supports
net

(b) Now add a vdpa device and show the device.

$ vdpa dev add pci/0000:03.00:5 type net

So if you want to create devices types other than vdpa on pci/0000:03.00:5 it needs some synchronization with devlink?

Please refer to FAQ-1, a new tool is not linked to devlink because vdpa will

evolve with time and devlink will fall short.

Quoted 4 lines

So no, it doesn't need any synchronization with devlink.
As long as parent device exist, user can create it.
All synchronization will be within drivers/vdpa/vdpa.c This user interface is exposed via new netlink family by doing genl_register_family() with

Quoted 8 lines

new name "vdpa" in drivers/vdpa/vdpa.c.

Just to make sure I understand here.

Consider we had virtbus/mlx5_sf.1. Process A want to create a vDPA instance on top of it but Process B want to create a IB instance. Then I think some synchronization is needed at at least parent device level?

Likely but rdma device will be created either through

$ rdma link add command.
Or auto created by driver because there is only one without much configuration.

While vdpa device(s) for virtbus/mlx5_sf.1 will be created through vdpa subsystem. And vdpa's synchronization will be contained within drivers/vdpa/vdpa.c

Quoted 60 lines
Quoted 41 lines
Quoted 41 lines
Quoted 17 lines



$ vdpa dev show
vdpa0@pci/0000:03.00:5 type net state inactive maxqueues 8 curqueues
4

(c) vdpa dev show features vdpa0
iommu platform
version 1

(d) dump vdpa statistics

$ vdpa dev stats show vdpa0
kickdoorbells 10
wqes 100
Quoted 8 lines

(e) Now delete a vdpa device previously created.

$ vdpa dev del vdpa0

Design overview:
-----------------------
1. Above example tool runs over netlink socket interface.
2. This enables users to return meaningful error strings in addition to code so

that user can be more informed.

Quoted 3 lines

Often this is missing in ioctl()/configfs/sysfs interfaces.
3. This tool over netlink enables syscaller tests to be more usable like other

subsystems to keep kernel robust

Quoted 2 lines

4. This provides vendor agnostic view of all vdpa capable parent and vdpa

devices.

Quoted 2 lines

5. Each driver which supports vdpa device creation, registers the parent device

along with supported classes.

Quoted 5 lines

FAQs:
--------
1. Why not using devlink?
Ans: Because as vdpa echo system grows, devlink will fall short of extending

Quoted 8 lines
Quoted 6 lines

vdpa specific params, attributes, stats.

This should be fine but it's still not clear to me the difference between a vdpa netlink and a vdpa object in devlink.

The difference is a vdpa specific tool work at the parent device level. It is likely more appropriate to because it can self-contain everything needed

to create/delete devices, view/set features, stats.

Quoted 1 line

Trying to put that in devlink will fall short as devlink doesn’t have vdpa

definitions.

Quoted 1 line

Typically when a class/device subsystem grows, its own tool is wiser like

iproute2/ip, iproute2/tc, iproute2/rdma.

Ok, I see.

Thanks

#120 lore raw
In reply to Alex Williamson
Quoted 22 lines · * Alex Williamson ([email protected]) wrote:
Quoted 12 lines · On Mon, 27 Jul 2020 15:24:40 +0800 Yan Zhao <[email protected]> wrote:
Quoted 12 lines
Quoted 3 lines

As you indicate, the vendor driver is responsible for checking version information embedded within the migration stream. Therefore a migration should fail early if the devices are incompatible. Is it

but as I know, currently in VFIO migration protocol, we have no way to get vendor specific compatibility checking string in migration setup stage (i.e. .save_setup stage) before the device is set to _SAVING state. In this way, for devices who does not save device data in precopy stage, the migration compatibility checking is as late as in stop-and-copy stage, which is too late.
do you think we need to add the getting/checking of vendor specific compatibility string early in save_setup stage?

Quoted 6 lines

hi Alex,
after an offline discussion with Kevin, I realized that it may not be a problem if migration compatibility check in vendor driver occurs late in stop-and-copy phase for some devices, because if we report device compatibility attributes clearly in an interface, the chances for libvirt/openstack to make a wrong decision is little.

Quoted 9 lines

I think it would be wise for a vendor driver to implement a pre-copy phase, even if only to send version information and verify it at the target. Deciding you have no device state to send during pre-copy does not mean your vendor driver needs to opt-out of the pre-copy phase entirely. Please also note that pre-copy is at the user's discretion, we've defined that we can enter stop-and-copy at any point, including without a pre-copy phase, so I would recommend that vendor drivers validate compatibility at the start of both the pre-copy and the stop-and-copy phases.

That's quite curious; from a migration point of view I'd expect if you did want to skip pre-copy, that you'd go through the motions of entering it and then not saving any data and then going to stop-and-copy, rather than having two flows.

Note that failing at a late stage of stop-and-copy is a pain; if you've just spent an hour migrating your huge busy VM over, you're going to be pretty annoyed when it goes pop near the end.

Dave

Quoted 30 lines
Quoted 4 lines

so, do you think we are now arriving at an agreement that we'll give up the read-and-test scheme and start to defining one interface (perhaps in json format), from which libvirt/openstack is able to parse and find out compatibility list of a source mdev/physical device?

Based on the feedback we've received, the previously proposed interface is not viable. I think there's agreement that the user needs to be able to parse and interpret the version information. Using json seems viable, but I don't know if it's the best option. Is there any precedent of markup strings returned via sysfs we could follow?

Your idea of having both a "self" object and an array of "compatible" objects is perhaps something we can build on, but we must not assume PCI devices at the root level of the object. Providing both the mdev-type and the driver is a bit redundant, since the former includes the latter. We can't have vendor specific versioning schemes though, ie. gvt-version. We need to agree on a common scheme and decide which fields the version is relative to, ex. just the mdev type?

I had also proposed fields that provide information to create a compatible type, for example to create a type_x2 device from a type_x1 mdev type, they need to know to apply an aggregation attribute. If we need to explicitly list every aggregation value and the resulting type, I think we run aground of what aggregation was trying to avoid anyway, so we might need to pick a language that defines variable substitution or some kind of tagging. For example if we could define ${aggr} as an integer within a specified range, then we might be able to define a type relative to that value (type_x${aggr}) which requires an aggregation attribute using the same value. I dunno, just spit balling. Thanks,

Quoted 1 line

Alex

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK