qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and


From: Xiao Guangrong
Subject: Re: [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and perform flush on back store
Date: Tue, 11 Apr 2017 19:55:04 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0



On 04/11/2017 04:29 PM, Haozhong Zhang wrote:
On 04/11/17 16:22 +0800, Haozhong Zhang wrote:
On 04/06/17 19:52 +0800, Xiao Guangrong wrote:


On 03/31/2017 04:41 PM, Haozhong Zhang wrote:
fsync() is used to persist modifications to the back store. If the
host NVDIMM is used as the back store, fsync() on Linux will trigger
the write to the host flush hint address.

Signed-off-by: Haozhong Zhang <address@hidden>
---
 hw/mem/nvdimm.c         | 22 ++++++++++++++++++++++
 include/hw/mem/nvdimm.h | 13 +++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index db896b0..484ab8b 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -78,6 +78,26 @@ static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice 
*dimm)
     return &nvdimm->nvdimm_mr;
 }

+static void nvdimm_flush_init(NVDIMMDevice *nvdimm, MemoryRegion *hostmem_mr)
+{
+    if (nvdimm->flush_hint_enabled) {
+        nvdimm->backend_fd = memory_region_get_fd(hostmem_mr);

Hmm, IIRC host-mem-file does not initalize backend_fd at all.

Oops, forgot to add this part. Thanks for remind.

Sorry, I replied too quick.

For hostmem-file, hostmem_mr->ram_block->fd is set in file_ram_alloc(),
which can be got by memory_region_get_fd() here.

Okay, my wrong memory and did not check the code during patch
review. :)




reply via email to

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