qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 02/70] RAMBlock: Add support of KVM private guest memfd


From: Xiaoyao Li
Subject: Re: [PATCH v3 02/70] RAMBlock: Add support of KVM private guest memfd
Date: Thu, 30 Nov 2023 15:37:49 +0800
User-agent: Mozilla Thunderbird

On 11/20/2023 5:24 PM, David Hildenbrand wrote:
  uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
  {
      uint8_t mask = mr->dirty_log_mask;
diff --git a/system/physmem.c b/system/physmem.c
index fc2b0fee0188..0af2213cbd9c 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -1841,6 +1841,20 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
          }
      }
+#ifdef CONFIG_KVM
+    if (kvm_enabled() && new_block->flags & RAM_GUEST_MEMFD &&


I recall that we prefer to write this as

     if (kvm_enabled() && (new_block->flags & RAM_GUEST_MEMFD) &&

get it.

Thanks!

+        new_block->guest_memfd < 0) {
+        /* TODO: to decide if KVM_GUEST_MEMFD_ALLOW_HUGEPAGE is supported */
+        uint64_t flags = 0;
+        new_block->guest_memfd = kvm_create_guest_memfd(new_block->max_length,
+                                                        flags, errp);

Get rid of "flags" and just pass 0". Whatever code wants to pass flags later can decide how to do that.


How to handle it please see the reply to patch 3.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]