From: Yan Zhao <yan.y.zhao@intel.com>
To: Kirti Wankhede <kwankhede@nvidia.com>
Cc: "Zhengxiao.zx@Alibaba-inc.com" <Zhengxiao.zx@Alibaba-inc.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"Liu, Yi L" <yi.l.liu@intel.com>,
"cjia@nvidia.com" <cjia@nvidia.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"eskultet@redhat.com" <eskultet@redhat.com>,
"Yang, Ziye" <ziye.yang@intel.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"cohuck@redhat.com" <cohuck@redhat.com>,
"shuangtai.tst@alibaba-inc.com" <shuangtai.tst@alibaba-inc.com>,
"dgilbert@redhat.com" <dgilbert@redhat.com>,
"Wang, Zhi A" <zhi.a.wang@intel.com>,
"mlevitsk@redhat.com" <mlevitsk@redhat.com>,
"pasic@linux.ibm.com" <pasic@linux.ibm.com>,
"aik@ozlabs.ru" <aik@ozlabs.ru>,
Alex Williamson <alex.williamson@redhat.com>,
"eauger@redhat.com" <eauger@redhat.com>,
"felipe@nutanix.com" <felipe@nutanix.com>,
"jonathan.davies@nutanix.com" <jonathan.davies@nutanix.com>,
"Liu, Changpeng" <changpeng.liu@intel.com>,
"Ken.Xue@amd.com" <Ken.Xue@amd.com>
Subject: Re: [PATCH v10 Kernel 1/5] vfio: KABI for migration interface for device state
Date: Tue, 17 Dec 2019 02:12:48 -0500 [thread overview]
Message-ID: <20191217071248.GG21868@joy-OptiPlex-7040> (raw)
In-Reply-To: <f773a92a-acbd-874d-34ba-36c1e9ffe442@nvidia.com>
On Tue, Dec 17, 2019 at 02:28:44PM +0800, Kirti Wankhede wrote:
>
>
> On 12/17/2019 4:14 AM, Alex Williamson wrote:
> > On Tue, 17 Dec 2019 01:51:36 +0530
> > Kirti Wankhede <kwankhede@nvidia.com> wrote:
> >
> >> - Defined MIGRATION region type and sub-type.
> >>
> >> - Defined vfio_device_migration_info structure which will be placed at 0th
> >> offset of migration region to get/set VFIO device related information.
> >> Defined members of structure and usage on read/write access.
> >>
> >> - Defined device states and added state transition details in the comment.
> >>
> >> - Added sequence to be followed while saving and resuming VFIO device state
> >>
> >> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> >> Reviewed-by: Neo Jia <cjia@nvidia.com>
> >> ---
> >> include/uapi/linux/vfio.h | 180 ++++++++++++++++++++++++++++++++++++++++++++++
> >> 1 file changed, 180 insertions(+)
> >>
> >> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> >> index 9e843a147ead..a0817ba267c1 100644
> >> --- a/include/uapi/linux/vfio.h
> >> +++ b/include/uapi/linux/vfio.h
> >> @@ -305,6 +305,7 @@ struct vfio_region_info_cap_type {
> >> #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff)
> >> #define VFIO_REGION_TYPE_GFX (1)
> >> #define VFIO_REGION_TYPE_CCW (2)
> >> +#define VFIO_REGION_TYPE_MIGRATION (3)
> >>
> >> /* sub-types for VFIO_REGION_TYPE_PCI_* */
> >>
> >> @@ -379,6 +380,185 @@ struct vfio_region_gfx_edid {
> >> /* sub-types for VFIO_REGION_TYPE_CCW */
> >> #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1)
> >>
> >> +/* sub-types for VFIO_REGION_TYPE_MIGRATION */
> >> +#define VFIO_REGION_SUBTYPE_MIGRATION (1)
> >> +
> >> +/*
> >> + * Structure vfio_device_migration_info is placed at 0th offset of
> >> + * VFIO_REGION_SUBTYPE_MIGRATION region to get/set VFIO device related migration
> >> + * information. Field accesses from this structure are only supported at their
> >> + * native width and alignment, otherwise the result is undefined and vendor
> >> + * drivers should return an error.
> >> + *
> >> + * device_state: (read/write)
> >> + * To indicate vendor driver the state VFIO device should be transitioned
> >> + * to. If device state transition fails, write on this field return error.
> >> + * It consists of 3 bits:
> >> + * - If bit 0 set, indicates _RUNNING state. When its clear, that indicates
> >
> > s/its/it's/
> >
> >> + * _STOP state. When device is changed to _STOP, driver should stop
> >> + * device before write() returns.
> >> + * - If bit 1 set, indicates _SAVING state. When set, that indicates driver
> >> + * should start gathering device state information which will be provided
> >> + * to VFIO user space application to save device's state.
> >> + * - If bit 2 set, indicates _RESUMING state. When set, that indicates
> >> + * prepare to resume device, data provided through migration region
> >> + * should be used to resume device.
> >> + * Bits 3 - 31 are reserved for future use. User should perform
> >> + * read-modify-write operation on this field.
> >> + *
> >> + * +------- _RESUMING
> >> + * |+------ _SAVING
> >> + * ||+----- _RUNNING
> >> + * |||
> >> + * 000b => Device Stopped, not saving or resuming
> >> + * 001b => Device running state, default state
> >> + * 010b => Stop Device & save device state, stop-and-copy state
> >> + * 011b => Device running and save device state, pre-copy state
> >> + * 100b => Device stopped and device state is resuming
> >> + * 101b => Invalid state
> >
> > Eventually this would be intended for post-copy, if supported by the
> > device, right?
> >
>
> No, as per Yan mentioned in earlier version, _RESUMING + _RUNNING can't
> be used for post-copy. New flag will be required for post-copy.
>
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg658768.html
sorry, I didn't mean _RESUMING + _RUNNING can't be used for post-copy.
I just mean another POSCOPY state needs to be introduced. But I'm not
sure what _RESUMING state is for.
actually, we do nothing in response to _RESUMING state, no matter precopy
or poscopy.
If in your side_RESUMING state means it is allowed to restore device data,
then I think _RESUMING + _RUNNING is a valid state for postcopy.
Thanks
Yan
next prev parent reply other threads:[~2019-12-17 7:22 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-16 20:21 [PATCH v10 Kernel 0/5] KABIs to support migration for VFIO devices Kirti Wankhede
2019-12-16 20:21 ` [PATCH v10 Kernel 1/5] vfio: KABI for migration interface for device state Kirti Wankhede
2019-12-16 22:44 ` Alex Williamson
2019-12-17 6:28 ` Kirti Wankhede
2019-12-17 7:12 ` Yan Zhao [this message]
2019-12-17 18:43 ` Alex Williamson
2019-12-19 16:08 ` Kirti Wankhede
2019-12-19 17:27 ` Alex Williamson
2019-12-19 20:10 ` Kirti Wankhede
2019-12-19 21:09 ` Alex Williamson
2020-01-02 18:25 ` Dr. David Alan Gilbert
2020-01-06 23:18 ` Alex Williamson
2020-01-07 7:28 ` Kirti Wankhede
2020-01-07 17:09 ` Alex Williamson
2020-01-07 17:53 ` Kirti Wankhede
2020-01-07 18:56 ` Alex Williamson
2020-01-08 14:59 ` Cornelia Huck
2020-01-08 18:31 ` Alex Williamson
2020-01-08 20:41 ` Kirti Wankhede
2020-01-08 22:44 ` Alex Williamson
2020-01-10 14:21 ` Cornelia Huck
2020-01-07 9:57 ` Dr. David Alan Gilbert
2020-01-07 16:54 ` Alex Williamson
2020-01-07 17:50 ` Dr. David Alan Gilbert
2019-12-16 20:21 ` [PATCH v10 Kernel 2/5] vfio iommu: Adds flag to indicate dirty pages tracking capability support Kirti Wankhede
2019-12-16 23:16 ` Alex Williamson
2019-12-17 6:32 ` Kirti Wankhede
2019-12-16 20:21 ` [PATCH v10 Kernel 3/5] vfio iommu: Add ioctl defination for dirty pages tracking Kirti Wankhede
2019-12-16 20:21 ` [PATCH v10 Kernel 4/5] vfio iommu: Implementation of ioctl to " Kirti Wankhede
2019-12-17 5:15 ` Yan Zhao
2019-12-17 9:24 ` Kirti Wankhede
2019-12-17 9:51 ` Yan Zhao
2019-12-17 11:47 ` Kirti Wankhede
2019-12-18 1:04 ` Yan Zhao
2019-12-18 20:05 ` Dr. David Alan Gilbert
2019-12-19 0:57 ` Yan Zhao
2019-12-19 16:21 ` Kirti Wankhede
2019-12-20 0:58 ` Yan Zhao
2020-01-03 19:44 ` Dr. David Alan Gilbert
2020-01-04 3:53 ` Yan Zhao
2019-12-18 21:39 ` Alex Williamson
2019-12-19 18:42 ` Kirti Wankhede
2019-12-19 18:56 ` Alex Williamson
2019-12-16 20:21 ` [PATCH v10 Kernel 5/5] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap Kirti Wankhede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191217071248.GG21868@joy-OptiPlex-7040 \
--to=yan.y.zhao@intel.com \
--cc=Ken.Xue@amd.com \
--cc=Zhengxiao.zx@Alibaba-inc.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=changpeng.liu@intel.com \
--cc=cjia@nvidia.com \
--cc=cohuck@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eauger@redhat.com \
--cc=eskultet@redhat.com \
--cc=felipe@nutanix.com \
--cc=jonathan.davies@nutanix.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=mlevitsk@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=shuangtai.tst@alibaba-inc.com \
--cc=yi.l.liu@intel.com \
--cc=zhi.a.wang@intel.com \
--cc=ziye.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).