From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffTL3-0006rH-IE for qemu-devel@nongnu.org; Tue, 17 Jul 2018 13:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffTL0-0003Kk-7f for qemu-devel@nongnu.org; Tue, 17 Jul 2018 13:00:37 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:38250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffTKz-0003K1-O9 for qemu-devel@nongnu.org; Tue, 17 Jul 2018 13:00:33 -0400 Received: by mail-pg1-x544.google.com with SMTP id k3-v6so707222pgq.5 for ; Tue, 17 Jul 2018 10:00:33 -0700 (PDT) Sender: Richard Henderson References: <1531809130-31088-1-git-send-email-junyan.he@gmx.com> <1531809130-31088-6-git-send-email-junyan.he@gmx.com> From: Richard Henderson Message-ID: Date: Tue, 17 Jul 2018 10:00:30 -0700 MIME-Version: 1.0 In-Reply-To: <1531809130-31088-6-git-send-email-junyan.he@gmx.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/7 V10] mem/nvdimm: ensure write persistence to PMEM in label emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: junyan.he@gmx.com, qemu-devel@nongnu.org Cc: ehabkost@redhat.com, imammedo@redhat.com, pbonzini@redhat.com, crosthwaite.peter@gmail.com, xiaoguangrong.eric@gmail.com, mst@redhat.com, quintela@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, yi.z.zhang@intel.com, Junyan He , Haozhong Zhang On 07/16/2018 11:32 PM, junyan.he@gmx.com wrote: > +++ b/stubs/pmem.c > @@ -0,0 +1,19 @@ > +/* > + * Stubs for libpmem. > + * > + * Copyright (c) 2018 Intel Corporation. > + * > + * Author: Haozhong Zhang > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + */ > + > +#include > + > +#include "qemu/pmem.h" > + > +void *pmem_memcpy_persist(void *pmemdest, const void *src, size_t len) > +{ > + return memcpy(pmemdest, src, len); > +} > This will never be used, because you prevented is_pmem from being set when creating the device. I also know that you want to avoid an ifdef within nvdimm_write_label_data, but a more obvious solution might be in qemu/pmem.h, #ifdef CONFIG_LIBPMEM #include #else /* !CONFIG_LIBPMEM */ static inline void * pmem_memcpy_persist(void *pmemdest, const void *src, size_t len) { g_assert_not_reached(); } #endif /* CONFIG_LIBPMEM */ r~