[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 10/13] migration/ram: Handle RAM block resizes during post
From: |
Peter Xu |
Subject: |
Re: [PATCH v2 10/13] migration/ram: Handle RAM block resizes during postcopy |
Date: |
Mon, 24 Feb 2020 17:26:18 -0500 |
On Fri, Feb 21, 2020 at 05:42:01PM +0100, David Hildenbrand wrote:
[...]
> @@ -3160,7 +3160,13 @@ static int ram_load_postcopy(QEMUFile *f)
> break;
> }
>
> - if (!offset_in_ramblock(block, addr)) {
> + /*
> + * Relying on used_length is racy and can result in false
> positives.
> + * We might place pages beyond used_length in case RAM was shrunk
> + * while in postcopy, which is fine - trying to place via
> + * UFFDIO_COPY/UFFDIO_ZEROPAGE will never segfault.
> + */
> + if (!block->host || addr >= block->postcopy_length) {
I'm thinking whether we can even avoid the -ENOENT failure of
UFFDIO_COPY. With the postcopy_length you introduced, I think it's
the case when addr >= used_length && addr < postcopy_length, right?
Can we skip those?
Thanks,
> error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
> ret = -EINVAL;
> break;
> @@ -3757,6 +3763,7 @@ static void ram_mig_ram_block_resized(RAMBlockNotifier
> *n, void *host,
> rb->idstr);
> }
> }
> + rb->postcopy_length = new_size;
> break;
> case POSTCOPY_INCOMING_NONE:
> case POSTCOPY_INCOMING_RUNNING:
> --
> 2.24.1
>
--
Peter Xu
- [PATCH v2 04/13] numa: Make all callbacks of ram block notifiers optional, (continued)
- [PATCH v2 04/13] numa: Make all callbacks of ram block notifiers optional, David Hildenbrand, 2020/02/21
- [PATCH v2 05/13] migration/ram: Handle RAM block resizes during precopy, David Hildenbrand, 2020/02/21
- [PATCH v2 06/13] exec: Relax range check in ram_block_discard_range(), David Hildenbrand, 2020/02/21
- [PATCH v2 08/13] migration/ram: Simplify host page handling in ram_load_postcopy(), David Hildenbrand, 2020/02/21
- [PATCH v2 07/13] migration/ram: Discard RAM when growing RAM blocks after ram_postcopy_incoming_init(), David Hildenbrand, 2020/02/21
- [PATCH v2 09/13] migration/ram: Consolidate variable reset after placement in ram_load_postcopy(), David Hildenbrand, 2020/02/21
- [PATCH v2 10/13] migration/ram: Handle RAM block resizes during postcopy, David Hildenbrand, 2020/02/21
- [PATCH v2 11/13] migration/multifd: Print used_length of memory block, David Hildenbrand, 2020/02/21
- [PATCH v2 12/13] migration/ram: Use offset_in_ramblock() in range checks, David Hildenbrand, 2020/02/21
- [PATCH v2 13/13] migration/ram: Tolerate partially changed mappings in postcopy code, David Hildenbrand, 2020/02/21
Re: [PATCH v2 00/13] migrate/ram: Fix resizing RAM blocks while migrating, Peter Xu, 2020/02/21