* David Hildenbrand (da...@redhat.com) wrote:
> RDMA will pin all guest memory (as documented in docs/rdma.txt). We want
> to mark RAM block discards to be broken - however, to keep it simple
> use ram_block_discard_is_required() instead of inhibiting.
Should this be dependent on whether rdma->pin_all is set?
Even with !pin_all some will be pinned at any given time
(when it's registered with the rdma stack).
Dave
> Cc: "Michael S. Tsirkin" <m...@redhat.com>
> Cc: Juan Quintela <quint...@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilb...@redhat.com>
> Signed-off-by: David Hildenbrand <da...@redhat.com>
> ---
> migration/rdma.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index f61587891b..029adbb950 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -29,6 +29,7 @@
> #include "qemu/sockets.h"
> #include "qemu/bitmap.h"
> #include "qemu/coroutine.h"
> +#include "exec/memory.h"
> #include <sys/socket.h>
> #include <netdb.h>
> #include <arpa/inet.h>
> @@ -4017,8 +4018,14 @@ void rdma_start_incoming_migration(const char
> *host_port, Error **errp)
> Error *local_err = NULL;
>
> trace_rdma_start_incoming_migration();
> - rdma = qemu_rdma_data_init(host_port, &local_err);
>
> + /* Avoid ram_block_discard_set_broken(), cannot change during migration.
> */
> + if (ram_block_discard_is_required()) {
> + error_setg(errp, "RDMA: cannot set discarding of RAM broken");
> + return;
> + }
> +
> + rdma = qemu_rdma_data_init(host_port, &local_err);
> if (rdma == NULL) {
> goto err;
> }
> @@ -4064,10 +4071,17 @@ void rdma_start_outgoing_migration(void *opaque,
> const char *host_port, Error **errp)
> {
> MigrationState *s = opaque;
> - RDMAContext *rdma = qemu_rdma_data_init(host_port, errp);
> RDMAContext *rdma_return_path = NULL;
> + RDMAContext *rdma;
> int ret = 0;
>
> + /* Avoid ram_block_discard_set_broken(), cannot change during migration.
> */
> + if (ram_block_discard_is_required()) {
> + error_setg(errp, "RDMA: cannot set discarding of RAM broken");
> + return;
> + }
> +
> + rdma = qemu_rdma_data_init(host_port, errp);
> if (rdma == NULL) {
> goto err;
> }
> --
> 2.25.3
>
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK