Re: [PATCH v7 1/5] vfio/migration: Add debugfs to live migration driver

From: Alex Williamson
Date: Wed Feb 01 2023 - 11:38:50 EST


On Wed, 1 Feb 2023 11:20:08 +0800
liulongfang <liulongfang@xxxxxxxxxx> wrote:

> On 2023/1/27 3:27, Alex Williamson wrote:
> > On Fri, 20 Jan 2023 11:29:26 +0800
> > Longfang Liu <liulongfang@xxxxxxxxxx> wrote:
> >
> >> There are multiple devices, software and operational steps involved
> >> in the process of live migration. An error occurred on any node may
> >> cause the live migration operation to fail.
> >> This complex process makes it very difficult to locate and analyze
> >> the cause when the function fails.
> >>
> >> In order to quickly locate the cause of the problem when the
> >> live migration fails, I added a set of debugfs to the vfio
> >> live migration driver.
> >>
> >> +------------------------------------------+
> >> | |
> >> | |
> >> | QEMU |
> >> | |
> >> | |
> >> +-----+-------------------------+----------+
> >> | ^ | ^
> >> v | v |
> >> +-----+--+ +-----+--+
> >> | src VF | | dst VF |
> >> +-+------+ +-+------+
> >> | ^ | ^
> >> v | v |
> >> +-------+-+------+ +-------+-+------+
> >> |Debugfs|state | |Debugfs|state |
> >> +-------+--------+ +-------+--------+
> >> | debug_root | | debug_root |
> >> +-------+--------+ +-------+--------+
> >>
> >> The entire debugfs directory will be based on the definition of
> >> the CONFIG_DEBUG_FS macro. If this macro is not enabled, the
> >> interfaces in vfio_pci_debugfs.h will be empty definitions,
> >> and the creation and initialization of the debugfs directory
> >> will not be executed.
> >>
> >> debugfs will create a public root directory "vfio_mig" file.
> >> then create a "debug_root" file for each live migration VF device.
> >
> > s/VF // In practice it may be VFs, but I don't think we want to
> > artificially imply that the device must be a VF. In fact, I'm not sure
>
> Yes, the description should be modified here, and it should not be limited
> to only support VF.
>
> > why any of this code lives in vfio/pci/ vs vfio/, there's nothing PCI
> > specific here. Why isn't all of this done in vfio_main to be shared
> > with both pci and non-pci vfio drivers and devices?
> >
>
> Combined with your observations below, I think it is more appropriate to
> create a "vfio-pci" directory here, because the current live migration
> function is still used on pci devices.
>
> For non-pci devices, if there is a device that needs to add debugfs,
> then it can create a similar directory.

But live migration itself is not specific to vfio-pci, it's device
agnostic. We'd certainly expect to see mdev devices supporting
migration in the near term. Thanks,

Alex