From: Yuval Shaia <yuval.shaia@oracle.com>
To: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Sukrit Bhatnagar <skrtbhtngr@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 2/2] hw/pvrdma: add live migration support
Date: Sun, 1 Sep 2019 12:35:09 +0300 [thread overview]
Message-ID: <20190901093509.GC16041@lap1> (raw)
In-Reply-To: <710966e9-d1ac-3c55-0a12-02ff19005531@gmail.com>
On Sat, Aug 31, 2019 at 10:45:44PM +0300, Marcel Apfelbaum wrote:
>
>
> On 8/28/19 5:23 PM, Sukrit Bhatnagar wrote:
> > vmstate_pvrdma describes the PCI and MSIX states as well as the dma
> > address for dsr and the gid table of device.
> > vmstate_pvrdma_gids describes each gid in the gid table.
> >
> > pvrdma_post_save() does the job of unregistering gid entries from the
> > backend device in the source host.
> >
> > pvrdma_post_load() maps to dsr using the loaded dma address, registers
> > each loaded gid into the backend device, and finally calls load_dsr()
> > to perform other mappings and ring init operations.
> >
> > Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > Cc: Yuval Shaia <yuval.shaia@oracle.com>
> > Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
> > ---
> > hw/rdma/vmw/pvrdma_main.c | 77 +++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 77 insertions(+)
> >
> > diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
> > index 6c90db96f9..6f8b56dea3 100644
> > --- a/hw/rdma/vmw/pvrdma_main.c
> > +++ b/hw/rdma/vmw/pvrdma_main.c
> > @@ -28,6 +28,7 @@
> > #include "sysemu/sysemu.h"
> > #include "monitor/monitor.h"
> > #include "hw/rdma/rdma.h"
> > +#include "migration/register.h"
> > #include "../rdma_rm.h"
> > #include "../rdma_backend.h"
> > @@ -593,6 +594,81 @@ static void pvrdma_shutdown_notifier(Notifier *n, void *opaque)
> > pvrdma_fini(pci_dev);
> > }
> > +static int pvrdma_post_save(void *opaque)
> > +{
> > + int i, rc;
> > + PVRDMADev *dev = opaque;
> > +
> > + for (i = 0; i < MAX_GIDS; i++) {
> > +
>
> No need for the extra line
> > + if (!dev->rdma_dev_res.port.gid_tbl[i].gid.global.interface_id) {
> > + continue;
> > + }
> > + rc = rdma_backend_del_gid(&dev->backend_dev,
> > + dev->backend_eth_device_name,
> > + &dev->rdma_dev_res.port.gid_tbl[i].gid);
> > + if (rc) {
> > + return -EINVAL;
> > + }
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int pvrdma_post_load(void *opaque, int version_id)
> > +{
> > + int i, rc;
> > + PVRDMADev *dev = opaque;
> > + PCIDevice *pci_dev = PCI_DEVICE(dev);
> > + DSRInfo *dsr_info = &dev->dsr_info;
> > +
> > + dsr_info->dsr = rdma_pci_dma_map(pci_dev, dsr_info->dma,
> > + sizeof(struct pvrdma_device_shared_region));
> > + if (!dsr_info->dsr) {
> > + rdma_error_report("Failed to map to DSR");
> > + return -ENOMEM;
> > + }
> > +
> > + for (i = 0; i < MAX_GIDS; i++) {
> > +
>
> The same here
>
> > + if (!dev->rdma_dev_res.port.gid_tbl[i].gid.global.interface_id) {
> > + continue;
> > + }
> > +
> > + rc = rdma_backend_add_gid(&dev->backend_dev,
> > + dev->backend_eth_device_name,
> > + &dev->rdma_dev_res.port.gid_tbl[i].gid);
> > + if (rc) {
> > + return -EINVAL;
> > + }
> > + }
> > +
> > + return load_dsr(dev);
> > +}
> > +
> > +static const VMStateDescription vmstate_pvrdma_gids = {
> > + .name = "pvrdma-gids",
> > + .fields = (VMStateField[]) {
> > + VMSTATE_UINT8_ARRAY_V(gid.raw, RdmaRmGid, 16, 0),
>
> Is 16 the array length? If yes, do we have same macro definition?
>
> > + VMSTATE_END_OF_LIST()
> > + }
> > +};
> > +
> > +static const VMStateDescription vmstate_pvrdma = {
> > + .name = PVRDMA_HW_NAME,
> > + .post_save = pvrdma_post_save,
> > + .post_load = pvrdma_post_load,
> > + .fields = (VMStateField[]) {
> > + VMSTATE_PCI_DEVICE(parent_obj, PVRDMADev),
> > + VMSTATE_MSIX(parent_obj, PVRDMADev),
> > + VMSTATE_UINT64(dsr_info.dma, PVRDMADev),
> > + VMSTATE_STRUCT_ARRAY(rdma_dev_res.port.gid_tbl, PVRDMADev,
> > + MAX_PORT_GIDS, 0, vmstate_pvrdma_gids,
> > + RdmaRmGid),
> > + VMSTATE_END_OF_LIST()
> > + }
> > +};
> > +
> > static void pvrdma_realize(PCIDevice *pdev, Error **errp)
> > {
> > int rc = 0;
> > @@ -688,6 +764,7 @@ static void pvrdma_class_init(ObjectClass *klass, void *data)
> > dc->desc = "RDMA Device";
> > dc->props = pvrdma_dev_properties;
> > + dc->vmsd = &vmstate_pvrdma;
> > set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
> > ir->print_statistics = pvrdma_print_statistics;
>
> Very simple an elegant.
> If I understand correctly the live migration of a pvrdma device with no
> active workloads works with this patch, right?
And no QPs also.
> If yes, I think we should consider merging this code already.
> Yuval, do you agree?
Sure i do!
Even with the limitation, this is huge enhancement that can be used right
away.
But first suggested some fixes, let's see v2.
>
> Thanks,
> Marcel
>
>
next prev parent reply other threads:[~2019-09-01 9:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 14:23 [Qemu-devel] [PATCH v1 0/2] Add live migration support in the PVRDMA device Sukrit Bhatnagar
2019-08-28 14:23 ` [Qemu-devel] [PATCH v1 1/2] hw/pvrdma: make DSR mapping idempotent in load_dsr() Sukrit Bhatnagar
2019-08-29 12:57 ` Yuval Shaia
2019-08-31 19:39 ` Marcel Apfelbaum
2019-08-28 14:23 ` [Qemu-devel] [PATCH v1 2/2] hw/pvrdma: add live migration support Sukrit Bhatnagar
2019-08-29 12:53 ` Yuval Shaia
2019-09-03 21:33 ` Sukrit Bhatnagar
2019-09-04 5:04 ` Yuval Shaia
2019-08-29 12:56 ` Yuval Shaia
2019-08-31 19:45 ` Marcel Apfelbaum
2019-09-01 9:35 ` Yuval Shaia [this message]
2019-09-03 11:05 ` Sukrit Bhatnagar
2019-08-29 12:00 ` [Qemu-devel] [PATCH v1 0/2] Add live migration support in the PVRDMA device Yuval Shaia
2019-08-31 19:37 ` Marcel Apfelbaum
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=20190901093509.GC16041@lap1 \
--to=yuval.shaia@oracle.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=skrtbhtngr@gmail.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).