virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Wei Wang <wei.w.wang@intel.com>
Cc: "aarcange@redhat.com" <aarcange@redhat.com>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"amit.shah@redhat.com" <amit.shah@redhat.com>,
	"liliang.opensource@gmail.com" <liliang.opensource@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"willy@infradead.org" <willy@infradead.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"yang.zhang.wz@gmail.com" <yang.zhang.wz@gmail.com>,
	"quan.xu@aliyun.com" <quan.xu@aliyun.com>,
	"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	mhocko@kernel.or
Subject: Re: [PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ
Date: Fri, 13 Oct 2017 16:38:34 +0300	[thread overview]
Message-ID: <20171013163503-mutt-send-email-mst__12419.51643392$1507901948$gmane$org@kernel.org> (raw)
In-Reply-To: <59DEE790.5040809@intel.com>

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

  parent reply	other threads:[~2017-10-13 13:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1506744354-20979-1-git-send-email-wei.w.wang@intel.com>
2017-09-30  4:05 ` [PATCH v16 1/5] lib/xbitmap: Introduce xbitmap Wei Wang
2017-09-30  4:05 ` [PATCH v16 2/5] radix tree test suite: add tests for xbitmap Wei Wang
2017-09-30  4:05 ` [PATCH v16 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG Wei Wang
2017-09-30  4:05 ` [PATCH v16 4/5] mm: support reporting free page blocks Wei Wang
2017-09-30  4:05 ` [PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ Wei Wang
     [not found] ` <1506744354-20979-6-git-send-email-wei.w.wang@intel.com>
2017-10-01  3:18   ` Michael S. Tsirkin
     [not found]   ` <20171001060305-mutt-send-email-mst@kernel.org>
2017-10-02 16:38     ` Wang, Wei W
     [not found]     ` <286AC319A985734F985F78AFA26841F73932025A@shsmsx102.ccr.corp.intel.com>
2017-10-10 15:15       ` Michael S. Tsirkin
     [not found]       ` <20171010180636-mutt-send-email-mst@kernel.org>
2017-10-11  6:03         ` Wei Wang
     [not found]         ` <59DDB428.4020208@intel.com>
2017-10-11 13:49           ` Michael S. Tsirkin
     [not found]           ` <20171011161912-mutt-send-email-mst@kernel.org>
2017-10-12  3:54             ` Wei Wang
     [not found]             ` <59DEE790.5040809@intel.com>
2017-10-13 13:38               ` Michael S. Tsirkin [this message]
     [not found]               ` <20171013163503-mutt-send-email-mst@kernel.org>
2017-10-19  8:07                 ` Wei Wang
2017-10-01 13:16 ` [PATCH v16 0/5] Virtio-balloon Enhancement Damian Tometzki
2017-10-01 13:25 ` Damian Tometzki
     [not found] ` <1506744354-20979-4-git-send-email-wei.w.wang@intel.com>
2017-10-02  4:30   ` [PATCH v16 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG Michael S. Tsirkin
     [not found]   ` <20171002072106-mutt-send-email-mst@kernel.org>
2017-10-02 12:39     ` Wang, Wei W
     [not found]     ` <286AC319A985734F985F78AFA26841F73931FDB5@shsmsx102.ccr.corp.intel.com>
2017-10-02 13:44       ` Michael S. Tsirkin
2017-10-09 15:20   ` Michael S. Tsirkin
     [not found]   ` <20171009181612-mutt-send-email-mst@kernel.org>
2017-10-10  7:28     ` Wei Wang
     [not found]     ` <59DC76BA.7070202@intel.com>
     [not found]       ` <201710102008.FIG57851.QFJLMtVOFOHFOS@I-love.SAKURA.ne.jp>
2017-10-10 12:32         ` Wei Wang
     [not found]         ` <59DCBDE9.4050404@intel.com>
     [not found]           ` <201710102209.DBE39528.MtFLOJQSFOFVOH@I-love.SAKURA.ne.jp>
2017-10-11  1:51             ` Wei Wang
     [not found]             ` <59DD7932.3070106@intel.com>
     [not found]               ` <201710110226.v9B2QGdx019779@www262.sakura.ne.jp>
2017-10-11  3:16                 ` Wei Wang
     [not found] ` <1506744354-20979-5-git-send-email-wei.w.wang@intel.com>
2017-10-03 14:50   ` [PATCH v16 4/5] mm: support reporting free page blocks Michal Hocko
     [not found] ` <1506864327.1916.3.camel@icloud.com>
2017-10-09  9:39   ` [PATCH v16 0/5] Virtio-balloon Enhancement Wei Wang

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='20171013163503-mutt-send-email-mst__12419.51643392$1507901948$gmane$org@kernel.org' \
    --to=mst@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=amit.shah@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=liliang.opensource@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mawilcox@microsoft.com \
    --cc=mhocko@kernel.or \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quan.xu@aliyun.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.w.wang@intel.com \
    --cc=willy@infradead.org \
    --cc=yang.zhang.wz@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).