From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: "David Hildenbrand" <david@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Leonardo Bras" <leobras@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peng Tao" <tao.peng@linux.alibaba.com>
Subject: [PATCH v1 3/4] migration/ram: Expose ramblock_is_ignored() as migrate_ram_is_ignored()
Date: Tue, 20 Jun 2023 15:03:53 +0200 [thread overview]
Message-ID: <20230620130354.322180-4-david@redhat.com> (raw)
In-Reply-To: <20230620130354.322180-1-david@redhat.com>
virtio-mem wants to know whether it should not mess with the RAMBlock
content (e.g., discard RAM, preallocate memory) on incoming migration.
So let's expose that function as migrate_ram_is_ignored() in
migration/misc.h
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/migration/misc.h | 1 +
migration/postcopy-ram.c | 2 +-
migration/ram.c | 14 +++++++-------
migration/ram.h | 3 +--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 5ebe13b4b9..7dcc0b5c2c 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -40,6 +40,7 @@ int precopy_notify(PrecopyNotifyReason reason, Error **errp);
void ram_mig_init(void);
void qemu_guest_free_page_hint(void *addr, size_t len);
+bool migrate_ram_is_ignored(RAMBlock *block);
/* migration/block.c */
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 5615ec29eb..29aea9456d 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -408,7 +408,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, Error **errp)
/*
* We don't support postcopy with some type of ramblocks.
*
- * NOTE: we explicitly ignored ramblock_is_ignored() instead we checked
+ * NOTE: we explicitly ignored migrate_ram_is_ignored() instead we checked
* all possible ramblocks. This is because this function can be called
* when creating the migration object, during the phase RAM_MIGRATABLE
* is not even properly set for all the ramblocks.
diff --git a/migration/ram.c b/migration/ram.c
index 5283a75f02..0ada6477e8 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -194,7 +194,7 @@ static bool postcopy_preempt_active(void)
return migrate_postcopy_preempt() && migration_in_postcopy();
}
-bool ramblock_is_ignored(RAMBlock *block)
+bool migrate_ram_is_ignored(RAMBlock *block)
{
return !qemu_ram_is_migratable(block) ||
(migrate_ignore_shared() && qemu_ram_is_shared(block)
@@ -696,7 +696,7 @@ static void pss_find_next_dirty(PageSearchStatus *pss)
unsigned long size = rb->used_length >> TARGET_PAGE_BITS;
unsigned long *bitmap = rb->bmap;
- if (ramblock_is_ignored(rb)) {
+ if (migrate_ram_is_ignored(rb)) {
/* Points directly to the end, so we know no dirty page */
pss->page = size;
return;
@@ -780,7 +780,7 @@ unsigned long colo_bitmap_find_dirty(RAMState *rs, RAMBlock *rb,
*num = 0;
- if (ramblock_is_ignored(rb)) {
+ if (migrate_ram_is_ignored(rb)) {
return size;
}
@@ -2260,7 +2260,7 @@ static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss)
unsigned long start_page = pss->page;
int res;
- if (ramblock_is_ignored(pss->block)) {
+ if (migrate_ram_is_ignored(pss->block)) {
error_report("block %s should not be migrated !", pss->block->idstr);
return 0;
}
@@ -3347,7 +3347,7 @@ static inline RAMBlock *ram_block_from_stream(MigrationIncomingState *mis,
return NULL;
}
- if (ramblock_is_ignored(block)) {
+ if (migrate_ram_is_ignored(block)) {
error_report("block %s should not be migrated !", id);
return NULL;
}
@@ -3958,7 +3958,7 @@ static int ram_load_precopy(QEMUFile *f)
}
if (migrate_ignore_shared()) {
hwaddr addr = qemu_get_be64(f);
- if (ramblock_is_ignored(block) &&
+ if (migrate_ram_is_ignored(block) &&
block->mr->addr != addr) {
error_report("Mismatched GPAs for block %s "
"%" PRId64 "!= %" PRId64,
@@ -4254,7 +4254,7 @@ static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host,
RAMBlock *rb = qemu_ram_block_from_host(host, false, &offset);
Error *err = NULL;
- if (ramblock_is_ignored(rb)) {
+ if (migrate_ram_is_ignored(rb)) {
return;
}
diff --git a/migration/ram.h b/migration/ram.h
index ea1f3c25b5..145c915ca7 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -36,11 +36,10 @@
extern XBZRLECacheStats xbzrle_counters;
extern CompressionStats compression_counters;
-bool ramblock_is_ignored(RAMBlock *block);
/* Should be holding either ram_list.mutex, or the RCU lock. */
#define RAMBLOCK_FOREACH_NOT_IGNORED(block) \
INTERNAL_RAMBLOCK_FOREACH(block) \
- if (ramblock_is_ignored(block)) {} else
+ if (migrate_ram_is_ignored(block)) {} else
#define RAMBLOCK_FOREACH_MIGRATABLE(block) \
INTERNAL_RAMBLOCK_FOREACH(block) \
--
2.40.1
next prev parent reply other threads:[~2023-06-20 13:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 13:03 [PATCH v1 0/4] virtio-mem: Support "x-ignore-shared" migration David Hildenbrand
2023-06-20 13:03 ` [PATCH v1 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping David Hildenbrand
2023-06-21 15:55 ` Peter Xu
2023-06-21 16:17 ` David Hildenbrand
2023-06-21 16:55 ` Peter Xu
2023-06-22 13:10 ` David Hildenbrand
2023-06-22 14:54 ` Peter Xu
2023-06-20 13:03 ` [PATCH v1 2/4] virtio-mem: Skip most of virtio_mem_unplug_all() without plugged memory David Hildenbrand
2023-06-20 13:03 ` David Hildenbrand [this message]
2023-06-21 15:56 ` [PATCH v1 3/4] migration/ram: Expose ramblock_is_ignored() as migrate_ram_is_ignored() Peter Xu
2023-06-20 13:03 ` [PATCH v1 4/4] virtio-mem: Support "x-ignore-shared" migration David Hildenbrand
2023-06-20 13:06 ` Michael S. Tsirkin
2023-06-20 13:40 ` David Hildenbrand
2023-07-06 5:59 ` [PATCH v1 0/4] " Mario Casquero
2023-07-06 7:19 ` 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=20230620130354.322180-4-david@redhat.com \
--to=david@redhat.com \
--cc=leobras@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=tao.peng@linux.alibaba.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).