[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171013163503-mutt-send-email-mst@kernel.org>
Date: Fri, 13 Oct 2017 16:38:34 +0300
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Wei Wang <wei.w.wang@...el.com>
Cc: "virtio-dev@...ts.oasis-open.org" <virtio-dev@...ts.oasis-open.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"qemu-devel@...gnu.org" <qemu-devel@...gnu.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"mhocko@...nel.org" <mhocko@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"mawilcox@...rosoft.com" <mawilcox@...rosoft.com>,
"david@...hat.com" <david@...hat.com>,
"cornelia.huck@...ibm.com" <cornelia.huck@...ibm.com>,
"mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
"aarcange@...hat.com" <aarcange@...hat.com>,
"amit.shah@...hat.com" <amit.shah@...hat.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"willy@...radead.org" <willy@...radead.org>,
"liliang.opensource@...il.com" <liliang.opensource@...il.com>,
"yang.zhang.wz@...il.com" <yang.zhang.wz@...il.com>,
"quan.xu@...yun.com" <quan.xu@...yun.com>
Subject: Re: [PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
On Thu, Oct 12, 2017 at 11:54:56AM +0800, Wei Wang wrote:
> > But I think flushing is very fragile. You will easily run into races
> > if one of the actors gets out of sync and keeps adding data.
> > I think adding an ID in the free vq stream is a more robust
> > approach.
> >
>
> Adding ID to the free vq would need the device to distinguish whether it
> receives an ID or a free page hint,
Not really. It's pretty simple: a 64 bit buffer is an ID. A 4K and bigger one
is a page.
> so an extra protocol is needed for the two sides to talk. Currently, we
> directly assign the free page
> address to desc->addr. With ID support, we would need to first allocate
> buffer for the protocol header,
> and add the free page address to the header, then desc->addr = &header.
I do not think you should add ID on each page. What would be the point?
Add it each time you detect a new start command.
> How about putting the ID to the command path? This would avoid the above
> trouble.
>
> For example, using the 32-bit config registers:
> first 16-bit: Command field
> send 16-bit: ID field
>
> Then, the working flow would look like this:
>
> 1) Host writes "Start, 1" to the Host2Guest register and notify;
>
> 2) Guest reads Host2Guest register, and ACKs by writing "Start, 1" to
> Guest2Host register;
>
> 3) Guest starts report free pages;
>
> 4) Each time when the host receives a free page hint from the free_page_vq,
> it compares the ID fields of
> the Host2Guest and Guest2Host register. If matching, then filter out the
> free page from the migration dirty bitmap,
> otherwise, simply push back without doing the filtering.
>
>
> Best,
> Wei
All fine but config and vq ops are asynchronous. Host has no idea when
were entries added to vq. So the ID sent to host needs to be through vq.
And I would make it a 64 or at least 32 bit ID, not a 16 bit one,
to avoid wrap-around.
--
MST
Powered by blists - more mailing lists