[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <286AC319A985734F985F78AFA26841F73928C952@shsmsx102.ccr.corp.intel.com>
Date: Thu, 3 Aug 2017 15:17:59 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.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>,
"mawilcox@...rosoft.com" <mawilcox@...rosoft.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"virtio-dev@...ts.oasis-open.org" <virtio-dev@...ts.oasis-open.org>,
"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>,
"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 v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
On Thursday, August 3, 2017 10:23 PM, Michael S. Tsirkin wrote:
> On Thu, Aug 03, 2017 at 02:38:17PM +0800, Wei Wang wrote:
> > +static void send_one_sg(struct virtio_balloon *vb, struct virtqueue *vq,
> > + void *addr, uint32_t size)
> > +{
> > + struct scatterlist sg;
> > + unsigned int len;
> > +
> > + sg_init_one(&sg, addr, size);
> > + while (unlikely(virtqueue_add_inbuf(vq, &sg, 1, vb, GFP_KERNEL)
> > + == -ENOSPC)) {
> > + /*
> > + * It is uncommon to see the vq is full, because the sg is sent
> > + * one by one and the device is able to handle it in time. But
> > + * if that happens, we kick and wait for an entry is released.
>
> is released -> to get used.
>
> > + */
> > + virtqueue_kick(vq);
> > + while (!virtqueue_get_buf(vq, &len) &&
> > + !virtqueue_is_broken(vq))
> > + cpu_relax();
>
> Please rework to use wait_event in that case too.
For the balloon page case here, it is fine to use wait_event. But for the free page
case, I think it might not be suitable because the mm lock is being held.
Best,
Wei
Powered by blists - more mailing lists