All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Sistare <steven.sistare@oracle.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
	Philippe Mathieu-Daude <philmd@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH V4] migration: ram block cpr blockers
Date: Wed, 26 Feb 2025 08:29:08 -0500	[thread overview]
Message-ID: <fa6bd2bc-aef8-474d-b055-772ccc669b0c@oracle.com> (raw)
In-Reply-To: <28175337-552e-45c3-b6db-86c8f06fbce8@redhat.com>

On 2/25/2025 4:10 PM, David Hildenbrand wrote:
>> +    /* Ram device is remapped in new QEMU */
>> +    if (memory_region_is_ram_device(mr)) {
>> +        return true;
>> +    }
>> +
>> +    /* Named files are remapped in new QEMU, same contents if shared (no COW) */
>> +    if (qemu_ram_is_shared(rb) && qemu_ram_is_named_file(rb)) {
>> +        return true;
>> +    }
>> +
>> +    /* A file descriptor is remapped in new QEMU */
>> +    if (rb->fd >= 0 && qemu_ram_is_shared(rb)) {
>> +        return true;
>> +    }
> 
> 
> Sorry, I was not fast enough to reply to your v3 reply.
> 
> This is now essentially:
> 
> if (qemu_ram_is_shared(rb) &&
>      (qemu_ram_is_named_file(rb) || rb->fd >= 0)) {
>      return true;
> }
> 
> But what is the purpose of the "name file" check then, if rb->fd essentially allows for any files?
> 
> So either the "fd >= 0" check is insufficient or the qemu_ram_is_named_file() check us superfluous.

Yup, qemu_ram_is_named_file always has an fd at this point, so that check is gratuitous.
The preservation mechanism is different, which is why I thought of it as a different
case, but that is just a commenting issue.

V5 will be:

static bool ram_is_cpr_compatible(RAMBlock *rb)
{
     MemoryRegion *mr = rb->mr;

     if (!mr || !memory_region_is_ram(mr)) {
         return true;
     }

     /* Ram device is remapped in new QEMU */
     if (memory_region_is_ram_device(mr)) {
         return true;
     }

     /*
      * A file descriptor is passed to new QEMU and remapped, or its backing
      * file is reopened and mapped.  It must be shared to avoid COW.
      */
     if (rb->fd >= 0 && qemu_ram_is_shared(rb)) {
         return true;
     }

     return false;
}

- Steve



      reply	other threads:[~2025-02-26 13:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25 21:06 [PATCH V4] migration: ram block cpr blockers Steve Sistare
2025-02-25 21:10 ` David Hildenbrand
2025-02-26 13:29   ` Steven Sistare [this message]

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=fa6bd2bc-aef8-474d-b055-772ccc669b0c@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=david@redhat.com \
    --cc=farosas@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.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 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.