virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: jasowang@redhat.com, david@redhat.com,
	virtio-dev@lists.oasis-open.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio-balloon: Disable free page hinting/reporting if page poison is disabled
Date: Thu, 16 Apr 2020 18:13:16 -0400	[thread overview]
Message-ID: <20200416180845-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200416192809.8763.19308.stgit@localhost.localdomain>

On Thu, Apr 16, 2020 at 12:30:38PM -0700, Alexander Duyck wrote:
> From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> 
> If we have free page hinting or page reporting enabled we should disable it
> if the pages are poisoned or initialized on free and we cannot notify the
> hypervisor.
> 
> Fixes: 5d757c8d518d ("virtio-balloon: add support for providing free page reports to host")
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>


Why not put this logic in the hypervisor?
We don't know what hypervisor uses the hints for.
Yes you can not just drop them but you can maybe do
other things such as MADV_SOFT_OFFLINE.

Finally, VIRTIO_BALLOON_F_FREE_PAGE_HINT does nothing
at all unless guest gets the command from hypervisor,
so there isn't even any overhead.



> ---
>  drivers/virtio/virtio_balloon.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 95d9c2f0a7be..08bc86a6e468 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -1110,8 +1110,12 @@ static int virtballoon_validate(struct virtio_device *vdev)
>  	/* Tell the host whether we care about poisoned pages. */
>  	if (!want_init_on_free() &&
>  	    (IS_ENABLED(CONFIG_PAGE_POISONING_NO_SANITY) ||
> -	     !page_poisoning_enabled()))
> +	     !page_poisoning_enabled())) {
>  		__virtio_clear_bit(vdev, VIRTIO_BALLOON_F_PAGE_POISON);
> +	} else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) {
> +		__virtio_clear_bit(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT);
> +		__virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING);
> +	}
>  
>  	__virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM);
>  	return 0;

  reply	other threads:[~2020-04-16 22:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 19:30 [PATCH] virtio-balloon: Disable free page hinting/reporting if page poison is disabled Alexander Duyck
2020-04-16 22:13 ` Michael S. Tsirkin [this message]
2020-04-16 23:52   ` Alexander Duyck
2020-04-17  6:28     ` Michael S. Tsirkin
2020-04-17  7:49       ` [virtio-dev] " David Hildenbrand
2020-04-17  8:50         ` Michael S. Tsirkin
2020-04-17  9:07           ` David Hildenbrand
2020-04-17  9:21             ` Michael S. Tsirkin
2020-04-17  9:51               ` David Hildenbrand
2020-04-17  9:59                 ` Michael S. Tsirkin
2020-04-17 10:09                   ` David Hildenbrand
2020-04-17 10:19                     ` [virtio-dev] " Michael S. Tsirkin
2020-04-17 10:26                       ` David Hildenbrand
2020-04-17 10:29                         ` Michael S. Tsirkin
2020-04-17 10:31                           ` David Hildenbrand
2020-04-17 11:02                             ` Michael S. Tsirkin
2020-04-17 11:18                               ` David Hildenbrand
2020-04-17 16:22                     ` Alexander Duyck
2020-04-20 13:28                       ` David Hildenbrand
2020-04-20 18:32                         ` Alexander Duyck
2020-04-21  7:29                           ` David Hildenbrand
2020-04-21 15:05                             ` Alexander Duyck
2020-04-21 15:18                               ` [virtio-dev] " David Hildenbrand
2020-04-21 15:50                                 ` Alexander Duyck
2020-04-22 10:24                                   ` David Hildenbrand
2020-04-22 15:49                                     ` Alexander Duyck
2020-04-17  7:46 ` David Hildenbrand

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=20200416180845-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alexander.duyck@gmail.com \
    --cc=david@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).