From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"mhocko@kernel.org" <mhocko@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"virtio-dev@lists.oasis-open.org"
<virtio-dev@lists.oasis-open.org>,
"david@redhat.com" <david@redhat.com>,
"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"amit.shah@redhat.com" <amit.shah@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"liliang.opensource@gmail.com" <liliang.opensource@gmail.com>,
"yang.zhang.wz@gmail.com" <yang.zhang.wz@gmail.com>,
"quan.xu@aliyun.com" <quan.xu@aliyun.com>
Subject: [virtio-dev] Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
Date: Thu, 3 Aug 2017 18:55:50 +0300 [thread overview]
Message-ID: <20170803185508-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <286AC319A985734F985F78AFA26841F73928C952@shsmsx102.ccr.corp.intel.com>
On Thu, Aug 03, 2017 at 03:17:59PM +0000, Wang, Wei W wrote:
> 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
You will have to find a way to drop the lock and restart from where you
stopped then.
--
MST
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"mhocko@kernel.org" <mhocko@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"virtio-dev@lists.oasis-open.org"
<virtio-dev@lists.oasis-open.org>,
"david@redhat.com" <david@redhat.com>,
"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"amit.shah@redhat.com" <amit.shah@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"liliang.opensource@gmail.com" <liliang.opensource@gmail.com>,
"yang.zhang.wz@gmail.com" <yang.zhang.wz@gmail.com>,
"quan.xu@aliyu
Subject: Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
Date: Thu, 3 Aug 2017 18:55:50 +0300 [thread overview]
Message-ID: <20170803185508-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <286AC319A985734F985F78AFA26841F73928C952@shsmsx102.ccr.corp.intel.com>
On Thu, Aug 03, 2017 at 03:17:59PM +0000, Wang, Wei W wrote:
> 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
You will have to find a way to drop the lock and restart from where you
stopped then.
--
MST
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"mhocko@kernel.org" <mhocko@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"virtio-dev@lists.oasis-open.org"
<virtio-dev@lists.oasis-open.org>,
"david@redhat.com" <david@redhat.com>,
"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"amit.shah@redhat.com" <amit.shah@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"liliang.opensource@gmail.com" <liliang.opensource@gmail.com>,
"yang.zhang.wz@gmail.com" <yang.zhang.wz@gmail.com>,
"quan.xu@aliyun.com" <quan.xu@aliyun.com>
Subject: Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
Date: Thu, 3 Aug 2017 18:55:50 +0300 [thread overview]
Message-ID: <20170803185508-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <286AC319A985734F985F78AFA26841F73928C952@shsmsx102.ccr.corp.intel.com>
On Thu, Aug 03, 2017 at 03:17:59PM +0000, Wang, Wei W wrote:
> 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
You will have to find a way to drop the lock and restart from where you
stopped then.
--
MST
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"mhocko@kernel.org" <mhocko@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"virtio-dev@lists.oasis-open.org"
<virtio-dev@lists.oasis-open.org>,
"david@redhat.com" <david@redhat.com>,
"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"amit.shah@redhat.com" <amit.shah@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"liliang.opensource@gmail.com" <liliang.opensource@gmail.com>,
"yang.zhang.wz@gmail.com" <yang.zhang.wz@gmail.com>,
"quan.xu@aliyun.com" <quan.xu@aliyun.com>
Subject: Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
Date: Thu, 3 Aug 2017 18:55:50 +0300 [thread overview]
Message-ID: <20170803185508-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <286AC319A985734F985F78AFA26841F73928C952@shsmsx102.ccr.corp.intel.com>
On Thu, Aug 03, 2017 at 03:17:59PM +0000, Wang, Wei W wrote:
> 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
You will have to find a way to drop the lock and restart from where you
stopped then.
--
MST
next prev parent reply other threads:[~2017-08-03 15:55 UTC|newest]
Thread overview: 135+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 6:38 [virtio-dev] [PATCH v13 0/5] Virtio-balloon Enhancement Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` [virtio-dev] [PATCH v13 1/5] Introduce xbitmap Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-07 6:58 ` [virtio-dev] " Wei Wang
2017-08-07 6:58 ` Wei Wang
2017-08-07 6:58 ` Wei Wang
2017-08-07 6:58 ` Wei Wang
2017-08-09 21:36 ` Andrew Morton
2017-08-09 21:36 ` Andrew Morton
2017-08-09 21:36 ` Andrew Morton
2017-08-10 5:59 ` [virtio-dev] " Wei Wang
2017-08-10 5:59 ` Wei Wang
2017-08-10 5:59 ` Wei Wang
2017-08-10 5:59 ` Wei Wang
2017-08-03 6:38 ` [virtio-dev] [PATCH v13 2/5] xbitmap: add xb_find_next_bit() and xb_zero() Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` [virtio-dev] [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 14:22 ` Michael S. Tsirkin
2017-08-03 14:22 ` [virtio-dev] " Michael S. Tsirkin
2017-08-03 14:22 ` Michael S. Tsirkin
2017-08-03 14:22 ` Michael S. Tsirkin
2017-08-03 15:17 ` [virtio-dev] " Wang, Wei W
2017-08-03 15:17 ` Wang, Wei W
2017-08-03 15:17 ` Wang, Wei W
2017-08-03 15:17 ` Wang, Wei W
2017-08-03 15:55 ` Michael S. Tsirkin [this message]
2017-08-03 15:55 ` Michael S. Tsirkin
2017-08-03 15:55 ` Michael S. Tsirkin
2017-08-03 15:55 ` Michael S. Tsirkin
2017-08-03 15:55 ` Michael S. Tsirkin
2017-08-03 15:17 ` Wang, Wei W
2017-08-03 6:38 ` [virtio-dev] [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 9:11 ` Michal Hocko
2017-08-03 9:11 ` Michal Hocko
2017-08-03 10:42 ` [virtio-dev] " Wei Wang
2017-08-03 10:42 ` Wei Wang
2017-08-03 10:42 ` Wei Wang
2017-08-03 10:44 ` Michal Hocko
2017-08-03 10:44 ` Michal Hocko
2017-08-03 11:27 ` [virtio-dev] " Wei Wang
2017-08-03 11:27 ` Wei Wang
2017-08-03 11:27 ` Wei Wang
2017-08-03 11:28 ` Michal Hocko
2017-08-03 11:28 ` Michal Hocko
2017-08-03 12:11 ` [virtio-dev] " Wei Wang
2017-08-03 12:11 ` Wei Wang
2017-08-03 12:11 ` Wei Wang
2017-08-03 12:41 ` Michal Hocko
2017-08-03 12:41 ` Michal Hocko
2017-08-03 13:17 ` [virtio-dev] " Wei Wang
2017-08-03 13:17 ` Wei Wang
2017-08-03 13:17 ` Wei Wang
2017-08-03 13:50 ` Michal Hocko
2017-08-03 13:50 ` Michal Hocko
2017-08-03 15:20 ` [virtio-dev] " Wang, Wei W
2017-08-03 15:20 ` Wang, Wei W
2017-08-03 15:20 ` Wang, Wei W
2017-08-03 15:20 ` Wang, Wei W
2017-08-03 21:02 ` Michael S. Tsirkin
2017-08-03 21:02 ` [virtio-dev] " Michael S. Tsirkin
2017-08-03 21:02 ` Michael S. Tsirkin
2017-08-03 21:02 ` Michael S. Tsirkin
2017-08-03 21:02 ` Michael S. Tsirkin
2017-08-04 7:53 ` Michal Hocko
2017-08-04 7:53 ` Michal Hocko
2017-08-04 7:53 ` Michal Hocko
2017-08-04 8:15 ` Wei Wang
2017-08-04 8:15 ` [virtio-dev] " Wei Wang
2017-08-04 8:15 ` Wei Wang
2017-08-04 8:15 ` Wei Wang
2017-08-04 8:24 ` Michal Hocko
2017-08-04 8:24 ` Michal Hocko
2017-08-04 8:24 ` Michal Hocko
2017-08-04 8:55 ` Wei Wang
2017-08-04 8:55 ` [virtio-dev] " Wei Wang
2017-08-04 8:55 ` Wei Wang
2017-08-04 8:55 ` Wei Wang
2017-08-04 8:55 ` Wei Wang
2017-08-04 8:24 ` Michal Hocko
2017-08-04 7:53 ` Michal Hocko
2017-08-03 15:20 ` Wang, Wei W
2017-08-08 6:12 ` [virtio-dev] " Wei Wang
2017-08-08 6:12 ` Wei Wang
2017-08-08 6:12 ` Wei Wang
2017-08-08 6:34 ` [virtio-dev] " Wei Wang
2017-08-08 6:34 ` Wei Wang
2017-08-08 6:34 ` Wei Wang
2017-08-08 6:34 ` Wei Wang
2017-08-08 6:34 ` Wei Wang
2017-08-10 7:05 ` [virtio-dev] " Michal Hocko
2017-08-10 7:05 ` Michal Hocko
2017-08-10 7:05 ` Michal Hocko
2017-08-10 7:38 ` Wei Wang
2017-08-10 7:38 ` Wei Wang
2017-08-10 7:38 ` Wei Wang
2017-08-10 7:38 ` Wei Wang
2017-08-10 7:38 ` Wei Wang
2017-08-10 7:53 ` [virtio-dev] " Michal Hocko
2017-08-10 7:53 ` Michal Hocko
2017-08-10 7:53 ` Michal Hocko
2017-08-08 6:12 ` Wei Wang
2017-08-03 6:38 ` [virtio-dev] [PATCH v13 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 6:38 ` Wei Wang
2017-08-03 8:13 ` Pankaj Gupta
2017-08-03 8:13 ` Pankaj Gupta
2017-08-03 12:28 ` [virtio-dev] " Wei Wang
2017-08-03 12:28 ` Wei Wang
2017-08-03 12:28 ` Wei Wang
2017-08-03 13:05 ` Pankaj Gupta
2017-08-03 13:05 ` Pankaj Gupta
2017-08-03 13:21 ` [virtio-dev] " Wei Wang
2017-08-03 13:21 ` Wei Wang
2017-08-03 13:21 ` Wei Wang
2017-08-03 12:33 ` [virtio-dev] " Michael S. Tsirkin
2017-08-03 12:33 ` Michael S. Tsirkin
2017-08-03 12:33 ` Michael S. Tsirkin
2017-08-03 16:11 ` kbuild test robot
2017-08-03 16:11 ` kbuild test robot
2017-08-16 5:57 ` [virtio-dev] [PATCH v13 0/5] Virtio-balloon Enhancement Adam Tao
2017-08-16 5:57 ` Adam Tao
2017-08-16 5:57 ` Adam Tao
2017-08-16 5:57 ` Adam Tao
2017-08-16 9:33 ` Wei Wang
2017-08-16 9:33 ` Wei Wang
2017-08-16 9:33 ` Wei Wang
2017-08-16 9:33 ` 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=20170803185508-mutt-send-email-mst@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=david@redhat.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=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=pbonzini@redhat.com \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.