From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
mst@redhat.com, Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
Juan Quintela <quintela@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [Qemu-devel] [PATCH v4 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM
Date: Thu, 29 Mar 2018 19:59:09 +0100 [thread overview]
Message-ID: <20180329185909.GG2982@work-vm> (raw)
In-Reply-To: <20180228072558.7434-6-haozhong.zhang@intel.com>
* Haozhong Zhang (haozhong.zhang@intel.com) wrote:
> When loading a zero page, check whether it will be loaded to
> persistent memory If yes, load it by libpmem function
> pmem_memset_nodrain(). Combined with a call to pmem_drain() at the
> end of RAM loading, we can guarantee all those zero pages are
> persistently loaded.
>
> Depending on the host HW/SW configurations, pmem_drain() can be
> "sfence". Therefore, we do not call pmem_drain() after each
> pmem_memset_nodrain(), or use pmem_memset_persist() (equally
> pmem_memset_nodrain() + pmem_drain()), in order to avoid unnecessary
> overhead.
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
I'm still thinking this is way too invasive; especially the next patch
that touches qemu_file.
One thing that would help a little, but not really enough, would be
to define a :
struct MemOps {
void (*copy)(like a memcpy);
void (*set)(like a memset);
}
then you could have:
struct MemOps normalops = {memcpy, memset};
struct MemOps pmem_nodrain_ops = { pmem_memcopy_nodrain, pmem_memset_nodrain };
then things like ram_handle_compressed would be:
void ram_handle_compressed(void *host, uint8_t ch, uint64_t size, const struct MemOps *mem)
{
if (ch != 0 || !is_zero_range(host, size)) {
mem->set(host, ch,size);
}
}
which means the change is pretty tiny to each function.
> diff --git a/migration/rdma.c b/migration/rdma.c
> index da474fc19f..573bcd2cb0 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -3229,7 +3229,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
> host_addr = block->local_host_addr +
> (comp->offset - block->offset);
>
> - ram_handle_compressed(host_addr, comp->value, comp->length);
> + ram_handle_compressed(host_addr, comp->value, comp->length, false);
Is that right? Is RDMA not allowed to work on PMEM?
(and anyway this call is a normal clear rather than an actual RDMA op).
Dave
> break;
>
> case RDMA_CONTROL_REGISTER_FINISHED:
> diff --git a/stubs/pmem.c b/stubs/pmem.c
> index 03d990e571..a65b3bfc6b 100644
> --- a/stubs/pmem.c
> +++ b/stubs/pmem.c
> @@ -17,3 +17,12 @@ void *pmem_memcpy_persist(void *pmemdest, const void *src, size_t len)
> {
> return memcpy(pmemdest, src, len);
> }
> +
> +void *pmem_memset_nodrain(void *pmemdest, int c, size_t len)
> +{
> + return memset(pmemdest, c, len);
> +}
> +
> +void pmem_drain(void)
> +{
> +}
> --
> 2.14.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-03-29 18:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 7:25 [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 1/8] memory, exec: switch file ram allocation functions to 'flags' parameters Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 2/8] hostmem-file: add the 'pmem' option Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 3/8] configure: add libpmem support Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 4/8] mem/nvdimm: ensure write persistence to PMEM in label emulation Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM Haozhong Zhang
2018-03-29 18:59 ` Dr. David Alan Gilbert [this message]
2018-04-02 1:42 ` Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 6/8] migration/ram: ensure write persistence on loading normal " Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 7/8] migration/ram: ensure write persistence on loading compressed " Haozhong Zhang
2018-02-28 7:25 ` [Qemu-devel] [PATCH v4 8/8] migration/ram: ensure write persistence on loading xbzrle " Haozhong Zhang
2018-02-28 7:31 ` [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory Haozhong Zhang
2018-03-08 6:49 ` Haozhong Zhang
2018-03-12 15:39 ` Stefan Hajnoczi
2018-03-13 0:11 ` Haozhong Zhang
2018-03-13 9:36 ` Dr. David Alan Gilbert
2018-03-13 10:44 ` Stefan Hajnoczi
2018-03-29 19:12 ` Dr. David Alan Gilbert
2018-04-02 1:29 ` Haozhong Zhang
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=20180329185909.GG2982@work-vm \
--to=dgilbert@redhat.com \
--cc=dan.j.williams@intel.com \
--cc=ehabkost@redhat.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=xiaoguangrong.eric@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).