nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
166 stars 51 forks source link

adapt to new (v2) VFIO migration interface #654

Open jlevon opened 2 years ago

jlevon commented 2 years ago

Alex Williamson says:

+ +The only device-specific region type and subtype supported by vfio-user is +VFIO_REGION_TYPE_MIGRATION (3) and VFIO_REGION_SUBTYPE_MIGRATION (1).

These should be considered deprecated from the kernel interface. I hope there are plans for vfio-user to adopt the new interface that's currently available in linux-next and intended for v5.18.

Which is this:

commit b042b27868c00142da1a7e31f4740a5fbd5628ed
Merge: cfb92440ee71 88faa5e8ead6
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Thu Mar 3 09:51:03 2022 -0700

    Merge tag 'mlx5-vfio-v10' of https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux into v5.18/vfio/next/mlx5-migration-v10

    Add mlx5 live migration driver and v2 migration protocol

Need to investigate and possibly adopt these changes.

tmakatos commented 2 years ago

Main email thread: https://lore.kernel.org/all/20220224142024.147653-12-yishaih@nvidia.com/ email where v2 is added: https://lore.kernel.org/all/20220130160826.32449-9-yishaih@nvidia.com/ Support for v2 in QEMU: https://github.com/jgunthorpe/qemu/commits/vfio_migration_v2 spec in the kernel: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=115dcec65f61d53e25e1bed5e380468b30f98b14 (currently in linux-next but soon in v5.18)

changpe1 commented 2 years ago

Looks like the mmaped migration region isn't supported with the new interface.

tmakatos commented 2 years ago

I've started adopting the new API here: https://github.com/tmakatos/muser/tree/migration-v2

Next, I'll start implementing Python tests.

likebreath commented 2 years ago

@tmakatos @jlevon I wonder do you have an estimated timeline for adding the v2 migration support to upstream libvfio-user?

jlevon commented 2 years ago

@likebreath sorry, we don't right now, but we'd be very happy if somebody wanted to make some proposals :)

likebreath commented 2 years ago

@jlevon Thank you for the quick response. I would love to help and contribute.

I know @tmakatos had a WIP branch for this work: https://github.com/tmakatos/muser/tree/migration-v2. Is this the right place to pick-up the work? Also, can you please provide me a summary about what are the missing bits? Thank you.

tmakatos commented 2 years ago

I know @tmakatos had a WIP branch for this work: https://github.com/tmakatos/muser/tree/migration-v2. Is this the right place to pick-up the work?

Yes, this is the right branch, specifically this commit: https://github.com/tmakatos/muser/commit/059aa82ff813221e4f42624dcb2b32c001a726af

Also, can you please provide me a summary about what are the missing bits?

Unfortunately it's been so long that I forgot the details, I would have to start from the beginning (re-read the kernel API, re-read my patch etc.). Could you try to see whether the commit makes sense and if not I can see how I could help?

likebreath commented 2 years ago

Yes, this is the right branch, specifically this commit: tmakatos@059aa82

Could you try to see whether the commit makes sense and if not I can see how I could help?

Sure. I will let you know when I need your inputs. I will also keep you posted when I have a timeline for this work.