All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Alexander Duyck <alexander.duyck@gmail.com>,
	Peter Xu <peterx@redhat.com>
Cc: "Juan Quintela" <quintela@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	"Wei Wang" <wei.w.wang@intel.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v1 2/2] virtio-balloon: disallow postcopy with VIRTIO_BALLOON_F_FREE_PAGE_HINT
Date: Thu, 8 Jul 2021 09:23:09 +0200	[thread overview]
Message-ID: <a3183ca9-419e-18db-966c-090efc75ebc1@redhat.com> (raw)
In-Reply-To: <CAKgT0Ucp60nxvk4ysydE29RPXUEFUU2f4+=3XMaXFagMef+hbA@mail.gmail.com>

On 07.07.21 23:22, Alexander Duyck wrote:
> On Wed, Jul 7, 2021 at 1:08 PM Peter Xu <peterx@redhat.com> wrote:
>>
>> On Wed, Jul 07, 2021 at 08:57:29PM +0200, David Hildenbrand wrote:
>>> On 07.07.21 20:02, Peter Xu wrote:
>>>> On Wed, Jul 07, 2021 at 04:06:55PM +0200, David Hildenbrand wrote:
>>>>> As it never worked properly, let's disable it via the postcopy notifier on
>>>>> the destination. Trying to set "migrate_set_capability postcopy-ram on"
>>>>> on the destination now results in "virtio-balloon: 'free-page-hint' does
>>>>> not support postcopy Error: Postcopy is not supported".
>>>>
>>>> Would it be possible to do this in reversed order?  Say, dynamically disable
>>>> free-page-hinting if postcopy capability is set when migration starts? Perhaps
>>>> it can also be re-enabled automatically when migration completes?
>>>
>>> I remember that this might be quite racy. We would have to make sure that no
>>> hinting happens before we enable the capability.
>>>
>>> As soon as we messed with the dirty bitmap (during precopy), postcopy is no
>>> longer safe. As noted in the patch, the only runtime alternative is to
>>> disable postcopy as soon as we actually do clear a bit. Alternatively, we
>>> could ignore any hints if the postcopy capability was enabled.
>>
>> Logically migration capabilities are applied at VM starts, and these
>> capabilities should be constant during migration (I didn't check if there's a
>> hard requirement; easy to add that if we want to assure it), and in most cases
>> for the lifecycle of the vm.
> 
> Would it make sense to maybe just look at adding a postcopy value to
> the PrecopyNotifyData that you could populate with
> migration_in_postcopy() in precopy_notify()?
> 
> Then all you would need to do is check for that value and if it is set
> you shut down the page hinting or don't start it since I suspect it
> wouldn't likely add any value anyway since I would think flagging
> unused pages doesn't add much value in a postcopy environment anyway.

I don't think that's true. With free page hinting you reduce the 
effective VM size you have to migrate. Any page that has to be migrated 
will consume bandwidth.

1. Although postcopy transfers only the currently requested pages, the 
background thread will keep pushing pages, making postcopy eventually 
run longer. While in postcopy (well, and in precopy) we are faced with a 
clear performance degradation, so we want to minimize the overall time 
spent.

2. Usually you let precopy run for a while before switching to postcopy. 
With free page hinting you might be able to greatly reduce the number of 
pages you'll have to migrate later in the same amount of time.


So there would be value, but at least I am not too interested in making 
it work in combination perfectly if it results in significant migration 
code changes; my goal is to not silently break guests when used in 
combination -- once there is the actual requirement to optimize this 
setup, we can work on that optimization (as discussed with MST here).

So I'll explore going the migrate_postcopy_ram() way to silently (or at 
least warn) disable free page hinting. Thanks.

-- 
Thanks,

David / dhildenb



  parent reply	other threads:[~2021-07-08  7:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 14:06 [PATCH v1 0/2] virtio-balloon: disallow postcopy with VIRTIO_BALLOON_F_FREE_PAGE_HINT David Hildenbrand
2021-07-07 14:06 ` [PATCH v1 1/2] migration/postcopy-ram: define type for "struct PostcopyNotifyData" David Hildenbrand
2021-07-07 20:30   ` Pankaj Gupta
2021-07-07 14:06 ` [PATCH v1 2/2] virtio-balloon: disallow postcopy with VIRTIO_BALLOON_F_FREE_PAGE_HINT David Hildenbrand
2021-07-07 18:02   ` Peter Xu
2021-07-07 18:57     ` David Hildenbrand
2021-07-07 19:07       ` Michael S. Tsirkin
2021-07-07 20:08       ` Peter Xu
2021-07-07 21:22         ` Alexander Duyck
2021-07-07 22:40           ` Peter Xu
2021-07-08  7:14             ` David Hildenbrand
2021-07-08  7:23           ` David Hildenbrand [this message]
2021-07-07 19:05   ` Michael S. Tsirkin
2021-07-07 19:14     ` David Hildenbrand
2021-07-07 19:19       ` Michael S. Tsirkin
2021-07-07 19:47         ` David Hildenbrand
2021-07-07 19:57           ` Michael S. Tsirkin
2021-07-08  8:19             ` David Hildenbrand
2021-07-08 19:07             ` Dr. David Alan Gilbert
2021-07-09 11:27               ` 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=a3183ca9-419e-18db-966c-090efc75ebc1@redhat.com \
    --to=david@redhat.com \
    --cc=alexander.duyck@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=mst@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wei.w.wang@intel.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.