qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Eduardo Habkost <eduardo@habkost.net>,
	Philippe Mathieu-Daude <philmd@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH V2 06/11] migration: fix mismatched GPAs during cpr
Date: Tue, 13 Aug 2024 16:43:08 -0400	[thread overview]
Message-ID: <ZrvFXCRPczXvCu2n@x1n> (raw)
In-Reply-To: <571a4f84-693c-43d4-a43a-52a53a1091e1@oracle.com>

On Wed, Aug 07, 2024 at 05:04:26PM -0400, Steven Sistare wrote:
> On 7/19/2024 12:28 PM, Peter Xu wrote:
> > On Sun, Jun 30, 2024 at 12:40:29PM -0700, Steve Sistare wrote:
> > > For new cpr modes, ramblock_is_ignored will always be true, because the
> > > memory is preserved in place rather than copied.  However, for an ignored
> > > block, parse_ramblock currently requires that the received address of the
> > > block must match the address of the statically initialized region on the
> > > target.  This fails for a PCI rom block, because the memory region address
> > > is set when the guest writes to a BAR on the source, which does not occur
> > > on the target, causing a "Mismatched GPAs" error during cpr migration.
> > 
> > Is this a common fix with/without cpr mode?
> > 
> > It looks to me mr->addr (for these ROMs) should only be set in PCI config
> > region updates as you mentioned.  But then I didn't figure out when they're
> > updated on dest in live migration: the ramblock info was sent at the
> > beginning of migration, so it doesn't even have PCI config space migrated;
> > I thought the real mr->addr should be in there.
> > 
> > I also failed to understand yet on why the mr->addr check needs to be done
> > by ignore-shared only.  Some explanation would be greatly helpful around
> > this area..
> 
> The error_report does not bite for normal migration because migrate_ram_is_ignored()
> is false for the problematic blocks, so the block->mr->addr check is not
> performed.  However, mr->addr is never fixed up in this case, which is a
> quiet potential bug, and this patch fixes that with the "has_addr" check.
> 
> For cpr-exec, migrate_ram_is_ignored() is true for all blocks,
> because we do not copy the contents over the migration stream, we preserve the
> memory in place.  So we fall into the block->mr->addr sanity check and fail
> with the original code.

OK I get your point now.  However this doesn't look right, instead I start
to question why we need to send mr->addr at all..

As I said previously, AFAIU mr->addr should only be updated when there's
some PCI config space updates so that it moves the MR around in the address
space based on how guest drivers / BIOS (?) set things up.  Now after these
days not looking, and just started to look at this again, I think the only
sane place to do this update is during a post_load().

And if we start to check some of the memory_region_set_address() users,
that's exactly what happened..

  - ich9_pm_iospace_update(), update addr for ICH9LPCPMRegs.io, where
    ich9_pm_post_load() also invokes it.

  - pm_io_space_update(), updates PIIX4PMState.io, where
    vmstate_acpi_post_load() also invokes it.

I stopped here just looking at the initial two users, it looks all sane to
me that it only got updated there, because the update requires pci config
space being migrated first.

IOW, I don't think having mismatched mr->addr is wrong at this stage.
Instead, I don't see why we should send mr->addr at all in this case during
as early as SETUP, and I don't see anything justifies the mr->addr needs to
be verified in parse_ramblock() since ignore-shared introduced by Yury in
commit fbd162e629aaf8 in 2019.

We can't drop mr->addr now when it's on-wire, but I think we should drop
the error report and addr check, instead of this patch.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2024-08-13 20:44 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-30 19:40 [PATCH V2 00/11] Live update: cpr-exec Steve Sistare
2024-06-30 19:40 ` [PATCH V2 01/11] machine: alloc-anon option Steve Sistare
2024-07-15 17:52   ` Fabiano Rosas
2024-07-16  9:19   ` Igor Mammedov
2024-07-17 19:24     ` Peter Xu
2024-07-18 15:43       ` Steven Sistare
2024-07-18 16:22         ` Peter Xu
2024-07-20 20:35       ` Steven Sistare
2024-08-04 16:20         ` Peter Xu
2024-07-20 20:28     ` Steven Sistare
2024-07-22  9:10       ` David Hildenbrand
2024-07-29 12:29       ` Igor Mammedov
2024-08-08 18:32         ` Steven Sistare
2024-08-12 18:37           ` Steven Sistare
2024-08-13 15:35             ` Peter Xu
2024-08-13 17:00               ` Alex Williamson
2024-08-13 18:45                 ` Peter Xu
2024-08-13 18:56                   ` Steven Sistare
2024-08-13 18:46                 ` Steven Sistare
2024-08-13 18:49                   ` Steven Sistare
2024-08-13 17:34               ` Steven Sistare
2024-08-13 19:02                 ` Peter Xu
2024-06-30 19:40 ` [PATCH V2 02/11] migration: cpr-state Steve Sistare
2024-07-17 18:39   ` Fabiano Rosas
2024-07-19 15:03   ` Peter Xu
2024-07-20 19:53     ` Steven Sistare
2024-06-30 19:40 ` [PATCH V2 03/11] migration: save cpr mode Steve Sistare
2024-07-17 18:39   ` Fabiano Rosas
2024-07-18 15:47     ` Steven Sistare
2024-06-30 19:40 ` [PATCH V2 04/11] migration: stop vm earlier for cpr Steve Sistare
2024-07-17 18:59   ` Fabiano Rosas
2024-07-20 20:00     ` Steven Sistare
2024-07-22 13:42       ` Fabiano Rosas
2024-08-06 20:52         ` Steven Sistare
2024-06-30 19:40 ` [PATCH V2 05/11] physmem: preserve ram blocks " Steve Sistare
2024-06-30 19:40 ` [PATCH V2 06/11] migration: fix mismatched GPAs during cpr Steve Sistare
2024-07-19 16:28   ` Peter Xu
2024-07-20 21:28     ` Steven Sistare
2024-08-07 21:04     ` Steven Sistare
2024-08-13 20:43       ` Peter Xu [this message]
2024-08-15 20:54         ` Steven Sistare
2024-08-16 14:43           ` Peter Xu
2024-08-16 17:10             ` Steven Sistare
2024-08-21 16:57               ` Peter Xu
2024-06-30 19:40 ` [PATCH V2 07/11] oslib: qemu_clear_cloexec Steve Sistare
2024-06-30 19:40 ` [PATCH V2 08/11] vl: helper to request exec Steve Sistare
2024-06-30 19:40 ` [PATCH V2 09/11] migration: cpr-exec-command parameter Steve Sistare
2024-06-30 19:40 ` [PATCH V2 10/11] migration: cpr-exec save and load Steve Sistare
2024-06-30 19:40 ` [PATCH V2 11/11] migration: cpr-exec mode Steve Sistare
2024-07-18 15:56 ` [PATCH V2 00/11] Live update: cpr-exec Peter Xu
2024-07-20 21:26   ` Steven Sistare
2024-08-04 16:10     ` Peter Xu
2024-08-07 19:47       ` Steven Sistare
2024-08-13 20:12         ` Peter Xu
2024-08-20 16:28           ` [PATCH V2 00/11] Live update: cpr-exec (reconnections) Steven Sistare
2024-07-22  8:59   ` [PATCH V2 00/11] Live update: cpr-exec David Hildenbrand
2024-08-04 15:43     ` Peter Xu
2024-08-05  9:52       ` David Hildenbrand
2024-08-05 10:06         ` David Hildenbrand
2024-08-05 10:01   ` Daniel P. Berrangé
2024-08-06 20:56     ` Steven Sistare
2024-08-13 19:46       ` Peter Xu
2024-08-15 20:55         ` Steven Sistare
2024-08-16 15:06           ` Peter Xu
2024-08-16 15:16             ` Daniel P. Berrangé
2024-08-16 15:19               ` Steven Sistare
2024-08-16 15:34               ` Peter Xu
2024-08-16 16:00                 ` Daniel P. Berrangé
2024-08-16 16:17                   ` Peter Xu
2024-08-16 16:28                     ` Daniel P. Berrangé
2024-08-16 17:09                     ` Steven Sistare
2024-08-21 18:34                       ` Peter Xu
2024-09-04 20:58                         ` Steven Sistare
2024-09-04 22:23                           ` Peter Xu
2024-09-05  9:49                             ` Daniel P. Berrangé
2024-09-05  9:43                           ` Daniel P. Berrangé
2024-09-05  9:30                       ` Daniel P. Berrangé

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=ZrvFXCRPczXvCu2n@x1n \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.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 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).