All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org,
	pbonzini@redhat.com, liliang.opensource@gmail.com,
	yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com,
	riel@redhat.com
Subject: [virtio-dev] Re: [PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
Date: Thu, 25 Jan 2018 11:32:05 +0800	[thread overview]
Message-ID: <5A694FB5.5090803@intel.com> (raw)
In-Reply-To: <20180124183349-mutt-send-email-mst@kernel.org>

On 01/25/2018 01:15 AM, Michael S. Tsirkin wrote:
> On Wed, Jan 24, 2018 at 06:42:42PM +0800, Wei Wang wrote:
> +
> +static void report_free_page_func(struct work_struct *work)
> +{
> +	struct virtio_balloon *vb;
> +	unsigned long flags;
> +
> +	vb = container_of(work, struct virtio_balloon, report_free_page_work);
> +
> +	/* Start by sending the obtained cmd id to the host with an outbuf */
> +	send_cmd_id(vb, &vb->start_cmd_id);
> +
> +	/*
> +	 * Set start_cmd_id to VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID to
> +	 * indicate a new request can be queued.
> +	 */
> +	spin_lock_irqsave(&vb->stop_update_lock, flags);
> +	vb->start_cmd_id = cpu_to_virtio32(vb->vdev,
> +				VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID);
> +	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
> +
> +	walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);
> Can you teach walk_free_mem_block to return the && of all
> return calls, so caller knows whether it completed?

There will be two cases that can cause walk_free_mem_block to return 
without completing:
1) host requests to stop in advance
2) vq->broken

How about letting walk_free_mem_block simply return the value returned 
by its callback (i.e. virtio_balloon_send_free_pages)?

For host requests to stop, it returns "1", and the above only bails out 
when walk_free_mem_block return a "< 0" value.

Best,
Wei

---------------------------------------------------------------------
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: Wei Wang <wei.w.wang@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org,
	pbonzini@redhat.com, liliang.opensource@gmail.com,
	yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com,
	riel@redhat.com
Subject: Re: [PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
Date: Thu, 25 Jan 2018 11:32:05 +0800	[thread overview]
Message-ID: <5A694FB5.5090803@intel.com> (raw)
In-Reply-To: <20180124183349-mutt-send-email-mst@kernel.org>

On 01/25/2018 01:15 AM, Michael S. Tsirkin wrote:
> On Wed, Jan 24, 2018 at 06:42:42PM +0800, Wei Wang wrote:
> +
> +static void report_free_page_func(struct work_struct *work)
> +{
> +	struct virtio_balloon *vb;
> +	unsigned long flags;
> +
> +	vb = container_of(work, struct virtio_balloon, report_free_page_work);
> +
> +	/* Start by sending the obtained cmd id to the host with an outbuf */
> +	send_cmd_id(vb, &vb->start_cmd_id);
> +
> +	/*
> +	 * Set start_cmd_id to VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID to
> +	 * indicate a new request can be queued.
> +	 */
> +	spin_lock_irqsave(&vb->stop_update_lock, flags);
> +	vb->start_cmd_id = cpu_to_virtio32(vb->vdev,
> +				VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID);
> +	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
> +
> +	walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);
> Can you teach walk_free_mem_block to return the && of all
> return calls, so caller knows whether it completed?

There will be two cases that can cause walk_free_mem_block to return 
without completing:
1) host requests to stop in advance
2) vq->broken

How about letting walk_free_mem_block simply return the value returned 
by its callback (i.e. virtio_balloon_send_free_pages)?

For host requests to stop, it returns "1", and the above only bails out 
when walk_free_mem_block return a "< 0" value.

Best,
Wei

WARNING: multiple messages have this Message-ID (diff)
From: Wei Wang <wei.w.wang@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org,
	pbonzini@redhat.com, liliang.opensource@gmail.com,
	yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com,
	riel@redhat.com
Subject: Re: [PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
Date: Thu, 25 Jan 2018 11:32:05 +0800	[thread overview]
Message-ID: <5A694FB5.5090803@intel.com> (raw)
In-Reply-To: <20180124183349-mutt-send-email-mst@kernel.org>

On 01/25/2018 01:15 AM, Michael S. Tsirkin wrote:
> On Wed, Jan 24, 2018 at 06:42:42PM +0800, Wei Wang wrote:
> +
> +static void report_free_page_func(struct work_struct *work)
> +{
> +	struct virtio_balloon *vb;
> +	unsigned long flags;
> +
> +	vb = container_of(work, struct virtio_balloon, report_free_page_work);
> +
> +	/* Start by sending the obtained cmd id to the host with an outbuf */
> +	send_cmd_id(vb, &vb->start_cmd_id);
> +
> +	/*
> +	 * Set start_cmd_id to VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID to
> +	 * indicate a new request can be queued.
> +	 */
> +	spin_lock_irqsave(&vb->stop_update_lock, flags);
> +	vb->start_cmd_id = cpu_to_virtio32(vb->vdev,
> +				VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID);
> +	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
> +
> +	walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);
> Can you teach walk_free_mem_block to return the && of all
> return calls, so caller knows whether it completed?

There will be two cases that can cause walk_free_mem_block to return 
without completing:
1) host requests to stop in advance
2) vq->broken

How about letting walk_free_mem_block simply return the value returned 
by its callback (i.e. virtio_balloon_send_free_pages)?

For host requests to stop, it returns "1", and the above only bails out 
when walk_free_mem_block return a "< 0" value.

Best,
Wei

--
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>

  parent reply	other threads:[~2018-01-25  3:29 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 10:42 [virtio-dev] [PATCH v24 0/2] Virtio-balloon: support free page reporting Wei Wang
2018-01-24 10:42 ` Wei Wang
2018-01-24 10:42 ` Wei Wang
2018-01-24 10:42 ` [virtio-dev] [PATCH v24 1/2] mm: support reporting free page blocks Wei Wang
2018-01-24 10:42   ` Wei Wang
2018-01-24 10:42   ` Wei Wang
2018-01-25 13:41   ` [virtio-dev] " Michael S. Tsirkin
2018-01-25 13:41     ` Michael S. Tsirkin
2018-01-25 13:41     ` Michael S. Tsirkin
2018-01-25 14:56     ` Pankaj Gupta
2018-01-25 14:56     ` Pankaj Gupta
2018-01-25 14:56       ` Pankaj Gupta
2018-01-25 17:31       ` Michael S. Tsirkin
2018-01-25 17:31       ` [virtio-dev] " Michael S. Tsirkin
2018-01-25 17:31         ` Michael S. Tsirkin
2018-01-25 17:31         ` Michael S. Tsirkin
2018-01-26  3:29     ` Wei Wang
2018-01-26  3:29     ` [virtio-dev] " Wei Wang
2018-01-26  3:29       ` Wei Wang
2018-01-26  3:29       ` Wei Wang
2018-01-26 15:00       ` [virtio-dev] " Michael S. Tsirkin
2018-01-26 15:00         ` Michael S. Tsirkin
2018-01-26 15:00         ` Michael S. Tsirkin
2018-01-26 21:43         ` Michael S. Tsirkin
2018-01-26 21:43         ` [virtio-dev] " Michael S. Tsirkin
2018-01-26 21:43           ` Michael S. Tsirkin
2018-01-26 21:43           ` Michael S. Tsirkin
2018-01-27 13:13           ` [virtio-dev] " Wang, Wei W
2018-01-27 13:13             ` Wang, Wei W
2018-01-27 13:13             ` Wang, Wei W
2018-01-27 13:13           ` Wang, Wei W
2018-01-27 14:00         ` Wang, Wei W
2018-01-27 14:00         ` [virtio-dev] " Wang, Wei W
2018-01-27 14:00           ` Wang, Wei W
2018-01-27 14:00           ` Wang, Wei W
2018-01-26 15:00       ` Michael S. Tsirkin
2018-01-25 13:41   ` Michael S. Tsirkin
2018-01-24 10:42 ` Wei Wang
2018-01-24 10:42 ` [PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT Wei Wang
2018-01-24 10:42 ` [virtio-dev] " Wei Wang
2018-01-24 10:42   ` Wei Wang
2018-01-24 10:42   ` Wei Wang
2018-01-24 17:15   ` [virtio-dev] " Michael S. Tsirkin
2018-01-24 17:15     ` Michael S. Tsirkin
2018-01-24 17:15     ` Michael S. Tsirkin
2018-01-25  3:32     ` Wei Wang
2018-01-25  3:32     ` Wei Wang [this message]
2018-01-25  3:32       ` Wei Wang
2018-01-25  3:32       ` Wei Wang
2018-01-25 11:28       ` Tetsuo Handa
2018-01-25 11:28         ` Tetsuo Handa
2018-01-25 12:55         ` [virtio-dev] " Wei Wang
2018-01-25 12:55           ` Wei Wang
2018-01-25 12:55           ` Wei Wang
2018-01-25 12:55           ` Wei Wang
2018-02-01 19:14         ` [virtio-dev] " Michael S. Tsirkin
2018-02-01 19:14           ` Michael S. Tsirkin
2018-02-01 19:14           ` Michael S. Tsirkin
2018-02-01 19:14         ` Michael S. Tsirkin
2018-01-25 11:28       ` Tetsuo Handa
2018-01-25  9:45     ` Wei Wang
2018-01-25  9:45     ` [virtio-dev] " Wei Wang
2018-01-25  9:45       ` Wei Wang
2018-01-25  9:45       ` Wei Wang
2018-01-24 17:15   ` Michael S. Tsirkin

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=5A694FB5.5090803@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=liliang.opensource@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mst@redhat.com \
    --cc=nilal@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=quan.xu0@gmail.com \
    --cc=riel@redhat.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.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 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.