From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
David Hildenbrand <david@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Peter Xu <peterx@redhat.com>, Juan Quintela <quintela@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH v5 03/10] numa: Make all callbacks of ram block notifiers optional
Date: Thu, 29 Apr 2021 13:27:01 +0200 [thread overview]
Message-ID: <20210429112708.12291-4-david@redhat.com> (raw)
In-Reply-To: <20210429112708.12291-1-david@redhat.com>
Let's make add/remove optional. We want to introduce a RAM block
notifier for RAM migration that is only interested in resize events.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
hw/core/numa.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 921bf86ab4..64b9334050 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -819,8 +819,11 @@ static int ram_block_notify_add_single(RAMBlock *rb, void *opaque)
void ram_block_notifier_add(RAMBlockNotifier *n)
{
QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next);
+
/* Notify about all existing ram blocks. */
- qemu_ram_foreach_block(ram_block_notify_add_single, n);
+ if (n->ram_block_added) {
+ qemu_ram_foreach_block(ram_block_notify_add_single, n);
+ }
}
void ram_block_notifier_remove(RAMBlockNotifier *n)
@@ -833,7 +836,9 @@ void ram_block_notify_add(void *host, size_t size, size_t max_size)
RAMBlockNotifier *notifier;
QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
- notifier->ram_block_added(notifier, host, size, max_size);
+ if (notifier->ram_block_added) {
+ notifier->ram_block_added(notifier, host, size, max_size);
+ }
}
}
@@ -842,7 +847,9 @@ void ram_block_notify_remove(void *host, size_t size, size_t max_size)
RAMBlockNotifier *notifier;
QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
- notifier->ram_block_removed(notifier, host, size, max_size);
+ if (notifier->ram_block_removed) {
+ notifier->ram_block_removed(notifier, host, size, max_size);
+ }
}
}
--
2.30.2
next prev parent reply other threads:[~2021-04-29 11:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 11:26 [PATCH v5 00/10] numa/exec/migration: Fix resizing RAM blocks while migrating David Hildenbrand
2021-04-29 11:26 ` [PATCH v5 01/10] util: vfio-helpers: Factor out and fix processing of existing ram blocks David Hildenbrand
2021-04-29 13:13 ` Philippe Mathieu-Daudé
2021-04-29 11:27 ` [PATCH v5 02/10] numa: Teach ram block notifiers about resizeable " David Hildenbrand
2021-04-29 11:27 ` David Hildenbrand
2021-04-29 11:27 ` David Hildenbrand [this message]
2021-04-29 11:27 ` [PATCH v5 04/10] migration/ram: Handle RAM block resizes during precopy David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 05/10] exec: Relax range check in ram_block_discard_range() David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 06/10] migration/ram: Discard RAM when growing RAM blocks after ram_postcopy_incoming_init() David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 07/10] migration/ram: Simplify host page handling in ram_load_postcopy() David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 08/10] migration/ram: Handle RAM block resizes during postcopy David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 09/10] migration/multifd: Print used_length of memory block David Hildenbrand
2021-04-29 11:27 ` [PATCH v5 10/10] migration/ram: Use offset_in_ramblock() in range checks David Hildenbrand
2021-05-06 17:57 ` [PATCH v5 00/10] numa/exec/migration: Fix resizing RAM blocks while migrating Eduardo Habkost
2021-05-06 18:04 ` Dr. David Alan Gilbert
2021-05-11 9:42 ` Dr. David Alan Gilbert
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=20210429112708.12291-4-david@redhat.com \
--to=david@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.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.