On Fri, Mar 20, 2020 at 5:48 PM Andrzej Jakowski <andrzej.jakow...@linux.intel.com> wrote: > > On 3/20/20 8:45 AM, Stefan Hajnoczi wrote: > > Please use qemu_ram_writeback() so that pmem_persist() and qemu_msync() > > are used as appropriate. > > Thx! > qemu_ram_writeback() doesn't return any status. How can I know that actual > msync succeds?
If the warn_report() message that is already printed by qemu_ram_writeback() is insufficient in terms of error reporting, I suggest propagating the return value from qemu_ram_writeback() and qemu_ram_block_writeback(). > Also qemu_ram_writeback() requires me to include #include "exec/ram_addr.h". > After including it when I compile code I'm getting following error: > > In file included from hw/block/nvme.c:49: > /root/sources/pmr/qemu/include/exec/ram_addr.h:23:10: fatal error: cpu.h: No > such file or directory > 23 | #include "cpu.h" > | ^~~~~~~ > compilation terminated. > make: *** [/root/sources/pmr/qemu/rules.mak:69: hw/block/nvme.o] Error 1 > > Why this is happening and what should be changed. Generally object files are built as part of common-obj-y in Makefile.objs. These object files are built only once across all QEMU targets (e.g. qemu-system-x86_64, qemu-system-arm, ...). Some code embeds target-specific information and is therefore not suitable for common-obj-y. These object files are built as part of obj-y in Makefile.objs. You can fix this compilation issue by changing hw/block/Makefile.objs to like this: diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs index 4b4a2b338d..12d5d5dac6 100644 --- a/hw/block/Makefile.objs +++ b/hw/block/Makefile.objs @@ -7,11 +7,11 @@ common-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o common-obj-$(CONFIG_XEN) += xen-block.o common-obj-$(CONFIG_ECC) += ecc.o common-obj-$(CONFIG_ONENAND) += onenand.o -common-obj-$(CONFIG_NVME_PCI) += nvme.o common-obj-$(CONFIG_SWIM) += swim.o common-obj-$(CONFIG_SH4) += tc58128.o +obj-$(CONFIG_NVME_PCI) += nvme.o obj-$(CONFIG_VIRTIO_BLK) += virtio-blk.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk.o Stefan