[libvirt PATCH] qemu_migration: Avoid mem.hard_limit > 0 check

Jiri Denemark posted 1 patch 1 year, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/8b59a2e2fe17c53b6d1a2bb1b78065896a0e2763.1656081202.git.jdenemar@redhat.com
src/qemu/qemu_migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] qemu_migration: Avoid mem.hard_limit > 0 check
Posted by Jiri Denemark 1 year, 10 months ago
My original commit v8.4.0-288-gf01fc4d119 accidentally forgot to fix
both instances of the same problem. While it fixed the destination side
of migration, the source one remained broken.

However, that commit was also wrong in saying the issue could have
caused unlimited memory locking to be allowed for QEMU when RDMA
migration was used. It could not, because the code would refuse to even
think about starting RDMA migration if hard_limit was not set. But
avoiding the "mem.hard_limit > 0" check is useful anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2a6b7b7819..9a10ce4abe 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4623,7 +4623,7 @@ qemuMigrationSrcStart(virDomainObj *vm,
     switch (spec->destType) {
     case MIGRATION_DEST_HOST:
         if (STREQ(spec->dest.host.protocol, "rdma") &&
-            vm->def->mem.hard_limit > 0 &&
+            virMemoryLimitIsSet(vm->def->mem.hard_limit) &&
             qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
                                     &priv->preMigrationMemlock) < 0) {
             return -1;
-- 
2.35.1
Re: [libvirt PATCH] qemu_migration: Avoid mem.hard_limit > 0 check
Posted by Michal Prívozník 1 year, 10 months ago
On 6/24/22 16:33, Jiri Denemark wrote:
> My original commit v8.4.0-288-gf01fc4d119 accidentally forgot to fix
> both instances of the same problem. While it fixed the destination side
> of migration, the source one remained broken.
> 
> However, that commit was also wrong in saying the issue could have
> caused unlimited memory locking to be allowed for QEMU when RDMA
> migration was used. It could not, because the code would refuse to even
> think about starting RDMA migration if hard_limit was not set. But
> avoiding the "mem.hard_limit > 0" check is useful anyway.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/qemu/qemu_migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal