Re: [PATCH] xio3130_downstream: Set the maximum link width and speed

2021-06-02 Thread Haozhong Zhang
On 05/28/21 01:06, Haozhong Zhang wrote: > The current implementation leaves 0 in the maximum link width (MLW) > and speed (MLS) fields of the PCI_EXP_LNKCAP register of a xio3130 > downstream port device. As a consequence, when that downstream port > negotiates the link width and sp

[PATCH] xio3130_downstream: Set the maximum link width and speed

2021-05-27 Thread Haozhong Zhang
setting MLW and MLS in PCI_EXP_LNKCAP of the xio3130 downstream port to values defined in its data manual, i.e., x1 and 2.5 GT respectively. Signed-off-by: Haozhong Zhang --- hw/pci-bridge/xio3130_downstream.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/hw/pci-bridge/xio3130_downstrea

Re: [Qemu-devel] [PATCH v3 11/13] nvdimm: allow setting the label-size to 0

2018-06-15 Thread Haozhong Zhang
On 06/15/18 16:04, David Hildenbrand wrote: > It is inititally 0, so setting it to 0 should be allowed, too. I'm fine with this change and believe nothing is broken in practice, but what is expected by the user who sets a zero label size? Look at nvdimm_dsm_device() which enables label DSMs only

Re: [Qemu-devel] [RFC PATCH 1/1] nvdimm: let qemu requiring section alignment of pmem resource.

2018-06-12 Thread Haozhong Zhang
On 06/11/18 19:55, Dan Williams wrote: > On Mon, Jun 11, 2018 at 9:26 AM, Stefan Hajnoczi wrote: > > On Mon, Jun 11, 2018 at 06:54:25PM +0800, Zhang Yi wrote: > >> Nvdimm driver use Memory hot-plug APIs to map it's pmem resource, > >> which at a section granularity. > >> > >> When QEMU emulated

Re: [Qemu-devel] [PATCH v4 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-04-01 Thread Haozhong Zhang
On 03/29/18 19:59 +0100, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@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

Re: [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-04-01 Thread Haozhong Zhang
On 03/29/18 20:12 +0100, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > > > > Post-copy with NVDIMM currently fails with message "Postcopy on shared > > RAM (...) is not yet supported". Is it enough? > > What does

Re: [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-03-12 Thread Haozhong Zhang
On 03/12/18 15:39 +, Stefan Hajnoczi wrote: > On Wed, Feb 28, 2018 at 03:25:50PM +0800, Haozhong Zhang wrote: > > QEMU writes to vNVDIMM backends in the vNVDIMM label emulation and > > live migration. If the backend is on the persistent memory, QEMU needs > > to t

[Qemu-devel] [PATCH v6 5/5] test/acpi-test-data: add ACPI tables for dimmpxm test

2018-03-10 Thread Haozhong Zhang
Reviewers can use ACPI tables in this patch to run test_acpi_{piix4,q35}_tcg_dimm_pxm cases. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/acpi-test-data/pc/APIC.dimmpxm | Bin 0 -> 144 bytes tests/acpi-test-data/pc/DSDT.dimmpxm | Bin 0 -> 6803 bytes tests/ac

[Qemu-devel] [PATCH v6 0/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-10 Thread Haozhong Zhang
ng code. * (Patch 3) s/'static-plugged'/'present at boot time' in commit message. Changes in v2: * Build SRAT memory affinity structures of PC-DIMM devices as well. * Add test cases. Haozhong Zhang (5): pc-dimm: make qmp_pc_dimm_device_list() sort devices by address qmp: distinguish

[Qemu-devel] [PATCH v6 4/5] tests/bios-tables-test: add test cases for DIMM proximity

2018-03-10 Thread Haozhong Zhang
-data/q35/NFIT.dimmpxm tests/acpi-test-data/q35/SRAT.dimmpxm tests/acpi-test-data/q35/SSDT.dimmpxm New APIC and DSDT are needed because of the multiple processors configuration. New NFIT and SSDT are needed because of NVDIMM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Sug

[Qemu-devel] [PATCH v6 3/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-10 Thread Haozhong Zhang
ity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/i386/acpi-build.c | 56 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c

[Qemu-devel] [PATCH v6 1/5] pc-dimm: make qmp_pc_dimm_device_list() sort devices by address

2018-03-10 Thread Haozhong Zhang
(qdev_get_machine(), ); could be replaced with simpler: list = qmp_pc_dimm_device_list(); * follow up patch will use it in build_srat() Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Reviewed-by: Igor Mammedov <imamm...@redhat.com> Acked-by: David Gibson <da...@gibson.dropbear

Re: [Qemu-devel] [PATCH v5 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-10 Thread Haozhong Zhang
On 03/10/18 20:31 -0600, Eric Blake wrote: > On 03/10/2018 07:34 PM, Haozhong Zhang wrote: > > It may need to treat PC-DIMM and NVDIMM differently, e.g., when > > deciding the necessity of non-volatile flag bit in SRAT memory > > affinity structures. > > > > NVDI

[Qemu-devel] [PATCH v6 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-10 Thread Haozhong Zhang
necessary in the future. It also fixes "info memory-devices"/query-memory-devices which currently show nvdimm devices as dimm devices since object_dynamic_cast(obj, TYPE_PC_DIMM) happily cast nvdimm to TYPE_PC_DIMM which it's been inherited from. Signed-off-by: Haozhong Zhang &l

[Qemu-devel] [PATCH v5 5/5][DO NOT APPLY] test/acpi-test-data: add ACPI tables for dimmpxm test

2018-03-10 Thread Haozhong Zhang
Reviewers can use ACPI tables in this patch to run test_acpi_{piix4,q35}_tcg_dimm_pxm cases. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/acpi-test-data/pc/APIC.dimmpxm | Bin 0 -> 144 bytes tests/acpi-test-data/pc/DSDT.dimmpxm | Bin 0 -> 6803 bytes tests/ac

[Qemu-devel] [PATCH v5 4/5] tests/bios-tables-test: add test cases for DIMM proximity

2018-03-10 Thread Haozhong Zhang
-data/q35/NFIT.dimmpxm tests/acpi-test-data/q35/SRAT.dimmpxm tests/acpi-test-data/q35/SSDT.dimmpxm New APIC and DSDT are needed because of the multiple processors configuration. New NFIT and SSDT are needed because of NVDIMM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Sug

[Qemu-devel] [PATCH v5 3/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-10 Thread Haozhong Zhang
ity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/i386/acpi-build.c | 56 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c

[Qemu-devel] [PATCH v5 1/5] pc-dimm: make qmp_pc_dimm_device_list() sort devices by address

2018-03-10 Thread Haozhong Zhang
(qdev_get_machine(), ); could be replaced with simpler: list = qmp_pc_dimm_device_list(); * follow up patch will use it in build_srat() Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Reviewed-by: Igor Mammedov <imamm...@redhat.com> Acked-by: David Gibson <da...@gibson.dropbear

[Qemu-devel] [PATCH v5 0/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-10 Thread Haozhong Zhang
esent at boot time' in commit message. Changes in v2: * Build SRAT memory affinity structures of PC-DIMM devices as well. * Add test cases. Haozhong Zhang (5): pc-dimm: make qmp_pc_dimm_device_list() sort devices by address qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList hw/acpi-build:

[Qemu-devel] [PATCH v5 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-10 Thread Haozhong Zhang
it's been inherited from. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hmp.c| 14 +++--- hw/mem/pc-dimm.c | 10 +- numa.c | 19 +-- qapi/misc.json | 6 +- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git

Re: [Qemu-devel] [PATCH v4 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-08 Thread Haozhong Zhang
On 03/08/18 11:22 -0600, Eric Blake wrote: > On 03/07/2018 08:33 PM, Haozhong Zhang wrote: > > It may need to treat PC-DIMM and NVDIMM differently, e.g., when > > deciding the necessity of non-volatile flag bit in SRAT memory > > affinity structures. > > > > NVDI

Re: [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-03-07 Thread Haozhong Zhang
Ping? On 02/28/18 15:25 +0800, Haozhong Zhang wrote: > QEMU writes to vNVDIMM backends in the vNVDIMM label emulation and > live migration. If the backend is on the persistent memory, QEMU needs > to take proper operations to ensure its writes persistent on the > persistent memor

Re: [Qemu-devel] [PATCH v4 0/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-07 Thread Haozhong Zhang
On 03/08/18 10:33 +0800, Haozhong Zhang wrote: > (Patch 5 is only for reviewers to run test cases in patch 4) > > ACPI 6.2A Table 5-129 "SPA Range Structure" requires the proximity > domain of a NVDIMM SPA range must match with corresponding entry in > SRAT table

[Qemu-devel] [PATCH v4 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-07 Thread Haozhong Zhang
it's been inherited from. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hmp.c| 14 +++--- hw/mem/pc-dimm.c | 20 ++-- numa.c | 19 +-- qapi/misc.json | 18 +- 4 files changed, 59 insertions(+), 12 de

[Qemu-devel] [PATCH v4 3/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-07 Thread Haozhong Zhang
ity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/i386/acpi-build.c | 57 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c

[Qemu-devel] [PATCH v4 4/5] tests/bios-tables-test: add test cases for DIMM proximity

2018-03-07 Thread Haozhong Zhang
-data/q35/NFIT.dimmpxm tests/acpi-test-data/q35/SRAT.dimmpxm tests/acpi-test-data/q35/SSDT.dimmpxm New APIC and DSDT are needed because of the multiple processors configuration. New NFIT and SSDT are needed because of NVDIMM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Sug

[Qemu-devel] [PATCH v4 5/5] [DO NOT APPLY] test/acpi-test-data: add ACPI tables for dimmpxm test

2018-03-07 Thread Haozhong Zhang
Reviewers can use ACPI tables in this patch to run test_acpi_{piix4,q35}_tcg_dimm_pxm cases. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/acpi-test-data/pc/APIC.dimmpxm | Bin 0 -> 144 bytes tests/acpi-test-data/pc/DSDT.dimmpxm | Bin 0 -> 6803 bytes tests/ac

[Qemu-devel] [PATCH v4 0/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-07 Thread Haozhong Zhang
y structures of PC-DIMM devices as well. * Add test cases. Haozhong Zhang (5): pc-dimm: make qmp_pc_dimm_device_list() sort devices by address qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList hw/acpi-build: build SRAT memory affinity structures for DIMM devices tests/bios-tab

[Qemu-devel] [PATCH v4 1/5] pc-dimm: make qmp_pc_dimm_device_list() sort devices by address

2018-03-07 Thread Haozhong Zhang
(qdev_get_machine(), ); could be replaced with simpler: list = qmp_pc_dimm_device_list(); * follow up patch will use it in build_srat() Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Reviewed-by: Igor Mammedov <imamm...@redhat.com> --- hw/mem/pc-dimm.c

Re: [Qemu-devel] [Xen-devel] [RFC QEMU PATCH v4 00/10] Implement vNVDIMM for Xen HVM guest

2018-03-05 Thread Haozhong Zhang
On 03/02/18 12:03 +, Anthony PERARD wrote: > On Wed, Feb 28, 2018 at 05:36:59PM +0800, Haozhong Zhang wrote: > > On 02/27/18 17:22 +, Anthony PERARD wrote: > > > On Thu, Dec 07, 2017 at 06:18:02PM +0800, Haozhong Zhang wrote: > > > > This is th

Re: [Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-05 Thread Haozhong Zhang
On 03/05/18 13:14 -0600, Eric Blake wrote: > On 03/05/2018 12:57 AM, Haozhong Zhang wrote: > > It may need to treat PC-DIMM and NVDIMM differently, e.g., when > > deciding the necessity of non-volatile flag bit in SRAT memory > > affinity structures. > > > > NVDI

Re: [Qemu-devel] [RFC QEMU PATCH v4 03/10] hostmem-xen: add a host memory backend for Xen

2018-03-04 Thread Haozhong Zhang
On 03/02/18 11:50 +, Anthony PERARD wrote: > On Wed, Feb 28, 2018 at 03:56:54PM +0800, Haozhong Zhang wrote: > > On 02/27/18 16:41 +, Anthony PERARD wrote: > > > On Thu, Dec 07, 2017 at 06:18:05PM +0800, Haozhong Zhang wrote: > > > > @@ -108,7 +109,

[Qemu-devel] [PATCH v3 1/5] pc-dimm: refactor qmp_pc_dimm_device_list

2018-03-04 Thread Haozhong Zhang
Use pc_dimm_built_list to hide recursive callbacks from callers. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/mem/pc-dimm.c | 83 +--- hw/ppc/spapr.c | 3 +- include/hw/mem/pc-dimm.h | 2 +-

[Qemu-devel] [PATCH v3 5/5] tests/bios-tables-test: add test cases for DIMM proximity

2018-03-04 Thread Haozhong Zhang
of the last node. Add test cases on PC and Q35 machines with 3 proximity domains, and one PC-DIMM and one NVDIMM attached to the second proximity domain. Check whether the QEMU-built SRAT tables match with the expected ones. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Suggested-by

[Qemu-devel] [PATCH v3 3/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-04 Thread Haozhong Zhang
ity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/i386/acpi-build.c | 60 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c

[Qemu-devel] [PATCH v3 0/5] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-04 Thread Haozhong Zhang
static-plugged'/'present at boot time' in commit message. Changes in v2: * Build SRAT memory affinity structures of PC-DIMM devices as well. * Add test cases. Haozhong Zhang (5): pc-dimm: refactor qmp_pc_dimm_device_list qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList hw/acpi-bui

[Qemu-devel] [PATCH v3 4/5] tests/bios-tables-test: allow setting extra machine options

2018-03-04 Thread Haozhong Zhang
Some test cases may require extra machine options than those used in the current test_acpi_ones(), e.g., nvdimm test cases require the machine option 'nvdimm=on'. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/bios-tables-test.

[Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

2018-03-04 Thread Haozhong Zhang
-specific data is currently left empty and will be filled when necessary in the future. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hmp.c| 14 +++--- hw/mem/pc-dimm.c | 20 ++-- numa.c | 19 +-- qapi-schema.jso

Re: [Qemu-devel] [PATCH v2 1/3] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-01 Thread Haozhong Zhang
On 03/01/18 14:01 +0100, Igor Mammedov wrote: > On Thu, 1 Mar 2018 19:56:51 +0800 > Haozhong Zhang <haozhong.zh...@intel.com> wrote: > > > On 03/01/18 11:42 +0100, Igor Mammedov wrote: > > > On Wed, 28 Feb 2018 12:02:58 +0800 > > > Haozhong

Re: [Qemu-devel] [PATCH v2 1/3] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-03-01 Thread Haozhong Zhang
On 03/01/18 11:42 +0100, Igor Mammedov wrote: > On Wed, 28 Feb 2018 12:02:58 +0800 > Haozhong Zhang <haozhong.zh...@intel.com> wrote: > > > ACPI 6.2A Table 5-129 "SPA Range Structure" requires the proximity > > domain of a NVDIMM SPA range must match with

Re: [Qemu-devel] [RFC QEMU PATCH v4 00/10] Implement vNVDIMM for Xen HVM guest

2018-02-28 Thread Haozhong Zhang
On 02/27/18 17:22 +, Anthony PERARD wrote: > On Thu, Dec 07, 2017 at 06:18:02PM +0800, Haozhong Zhang wrote: > > This is the QEMU part patches that works with the associated Xen > > patches to enable vNVDIMM support for Xen HVM domains. Xen relies on > > QEMU to build

Re: [Qemu-devel] [RFC QEMU PATCH v4 05/10] xen-hvm: initialize fw_cfg interface

2018-02-28 Thread Haozhong Zhang
On 02/27/18 16:46 +, Anthony PERARD wrote: > On Thu, Dec 07, 2017 at 06:18:07PM +0800, Haozhong Zhang wrote: > > Xen is going to reuse QEMU to build ACPI of some devices (e.g., NFIT > > and SSDT for NVDIMM) for HVM domains. The existing QEMU ACPI build > > code requir

Re: [Qemu-devel] [RFC QEMU PATCH v4 03/10] hostmem-xen: add a host memory backend for Xen

2018-02-27 Thread Haozhong Zhang
On 02/27/18 16:41 +, Anthony PERARD wrote: > On Thu, Dec 07, 2017 at 06:18:05PM +0800, Haozhong Zhang wrote: > > diff --git a/backends/hostmem.c b/backends/hostmem.c > > index ee2c2d5bfd..ba13a52994 100644 > > --- a/backends/hostmem.c > > +++ b/backends/h

Re: [Qemu-devel] [RFC QEMU PATCH v4 02/10] xen-hvm: create the hotplug memory region on Xen

2018-02-27 Thread Haozhong Zhang
On 02/27/18 16:37 +, Anthony PERARD wrote: > On Thu, Dec 07, 2017 at 06:18:04PM +0800, Haozhong Zhang wrote: > > The guest physical address of vNVDIMM is allocated from the hotplug > > memory region, which is not created when QEMU is used as Xen device > > model. In

[Qemu-devel] [PATCH v4 6/8] migration/ram: ensure write persistence on loading normal pages to PMEM

2018-02-27 Thread Haozhong Zhang
When loading a normal page to persistent memory, load its data by libpmem function pmem_memcpy_nodrain() instead of memcpy(). Combined with a call to pmem_drain() at the end of memory loading, we can guarantee all those normal pages are persistenly loaded to PMEM. Signed-off-by: Haozhong Zhang

Re: [Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-02-27 Thread Haozhong Zhang
On 02/28/18 15:25 +0800, Haozhong Zhang wrote: > QEMU writes to vNVDIMM backends in the vNVDIMM label emulation and > live migration. If the backend is on the persistent memory, QEMU needs > to take proper operations to ensure its writes persistent on the > persistent memory. Other

[Qemu-devel] [PATCH v4 4/8] mem/nvdimm: ensure write persistence to PMEM in label emulation

2018-02-27 Thread Haozhong Zhang
configurations. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/mem/nvdimm.c | 9 - include/qemu/pmem.h | 23 +++ stubs/Makefile.objs | 1 + stubs/pmem.c| 19 +++ 4 files changed, 51 insertions(+), 1 deletion(-) creat

[Qemu-devel] [PATCH v4 7/8] migration/ram: ensure write persistence on loading compressed pages to PMEM

2018-02-27 Thread Haozhong Zhang
When loading a compressed page to persistent memory, flush CPU cache after the data is decompressed. Combined with a call to pmem_drain() at the end of memory loading, we can guarantee those compressed pages are persistently loaded to PMEM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.

[Qemu-devel] [PATCH v4 8/8] migration/ram: ensure write persistence on loading xbzrle pages to PMEM

2018-02-27 Thread Haozhong Zhang
-by: Haozhong Zhang <haozhong.zh...@intel.com> --- migration/ram.c| 6 +++--- migration/xbzrle.c | 8 ++-- migration/xbzrle.h | 3 ++- tests/Makefile.include | 2 +- tests/test-xbzrle.c| 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/migration/r

[Qemu-devel] [PATCH v4 3/8] configure: add libpmem support

2018-02-27 Thread Haozhong Zhang
(formerly known as NMVL), https://github.com/pmem/pmdk/ [2] https://github.com/pmem/pmdk/blob/38bfa652721a37fd94c0130ce0e3f5d8baa3ed40/src/libpmem/pmem.c#L33 Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- configure | 35 +++ 1 file chang

[Qemu-devel] [PATCH v4 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-27 Thread Haozhong Zhang
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.zh

[Qemu-devel] [PATCH v4 1/8] memory, exec: switch file ram allocation functions to 'flags' parameters

2018-02-27 Thread Haozhong Zhang
' flag is converted to the QEMU_RAM_SHARE bit in flags, and other flag bits are ignored by above functions right now. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 3 ++- exec.c | 7 --- include/exec/memory.h

[Qemu-devel] [PATCH v4 2/8] hostmem-file: add the 'pmem' option

2018-02-27 Thread Haozhong Zhang
the backend storage of memory-backend-file is a real persistent memory. If 'pmem=on', QEMU will set the flag RAM_PMEM in the RAM block of the corresponding memory region. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 26 +-

[Qemu-devel] [PATCH v4 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-02-27 Thread Haozhong Zhang
tion 'pmem' to hostmem-file. * (Patch 3) Use libpmem to operate on the persistent memory, rather than re-implementing those operations in QEMU. * (Patch 5-8) Consider the write persistence in the migration path. Haozhong Zhang (8): [1/8] memory, exec: switch file ram allocation functions

[Qemu-devel] [PATCH v2 3/3] tests/bios-tables-test: add test cases for DIMM proximity

2018-02-27 Thread Haozhong Zhang
of the last node. Add test cases on PC and Q35 machines with 3 proximity domains, and one PC-DIMM and one NVDIMM attached to the second proximity domain. Check whether the QEMU-built SRAT tables match with the expected ones. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Suggested-by

[Qemu-devel] [PATCH v2 0/3] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-02-27 Thread Haozhong Zhang
ity domain of the last node as before. Changes in v2: * Build SRAT memory affinity structures of PC-DIMM devices as well. * Add test cases. Haozhong Zhang (3): hw/acpi-build: build SRAT memory affinity structures for DIMM devices tests/bios-tables-test: allow setting extra machine options tests/b

[Qemu-devel] [PATCH v2 2/3] tests/bios-tables-test: allow setting extra machine options

2018-02-27 Thread Haozhong Zhang
Some test cases may require extra machine options than the those used in the current test_acpi_ones(), e.g., nvdimm test cases require the machine option 'nvdimm=on'. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/bios-tables-test.

[Qemu-devel] [PATCH v2 1/3] hw/acpi-build: build SRAT memory affinity structures for DIMM devices

2018-02-27 Thread Haozhong Zhang
ity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/i386/acpi-build.c | 50 hw/mem/pc-dimm.c | 8 include/hw/mem/pc-dimm.h | 10 ++ 3 files changed, 64 insertions(+), 4 de

Re: [Qemu-devel] [PATCH] hw/acpi-build: build SRAT memory affinity structures for NVDIMM

2018-02-26 Thread Haozhong Zhang
On 02/26/18 14:59 +0100, Igor Mammedov wrote: > On Thu, 22 Feb 2018 09:40:00 +0800 > Haozhong Zhang <haozhong.zh...@intel.com> wrote: > > > On 02/21/18 14:55 +0100, Igor Mammedov wrote: > > > On Tue, 20 Feb 2018 17:17:58 -0800 > > > Dan Wi

Re: [Qemu-devel] [PATCH] hw/acpi-build: build SRAT memory affinity structures for NVDIMM

2018-02-23 Thread Haozhong Zhang
Hi Fam, On 02/23/18 17:17 -0800, no-re...@patchew.org wrote: > Hi, > > This series failed build test on s390x host. Please find the details below. > > N/A. Internal error while reading log file What does this message mean? Where can I get the log file? Thanks, Haozhong

Re: [Qemu-devel] [PATCH] hw/acpi-build: build SRAT memory affinity structures for NVDIMM

2018-02-21 Thread Haozhong Zhang
On 02/21/18 14:55 +0100, Igor Mammedov wrote: > On Tue, 20 Feb 2018 17:17:58 -0800 > Dan Williams <dan.j.willi...@intel.com> wrote: > > > On Tue, Feb 20, 2018 at 6:10 AM, Igor Mammedov <imamm...@redhat.com> wrote: > > > On Sat, 17 Feb 2018 14:31:35 +08

[Qemu-devel] [PATCH] hw/acpi-build: build SRAT memory affinity structures for NVDIMM

2018-02-16 Thread Haozhong Zhang
y affinity structure for each NVDIMM device with the proximity domain used in NFIT. The remaining hot-pluggable address space is covered by one or multiple SRAT memory affinity structures with the proximity domain of the last node as before. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel

[Qemu-devel] [PATCH v3 6/8] migration/ram: ensure write persistence on loading normal pages to PMEM

2018-02-16 Thread Haozhong Zhang
When loading a normal page to persistent memory, load its data by libpmem function pmem_memcpy_nodrain() instead of memcpy(). Combined with a call to pmem_drain() at the end of memory loading, we can guarantee all those normal pages are persistenly loaded to PMEM. Signed-off-by: Haozhong Zhang

[Qemu-devel] [PATCH v3 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-16 Thread Haozhong Zhang
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.zh

[Qemu-devel] [PATCH v3 8/8] migration/ram: ensure write persistence on loading xbzrle pages to PMEM

2018-02-16 Thread Haozhong Zhang
-by: Haozhong Zhang <haozhong.zh...@intel.com> --- migration/ram.c| 6 +++--- migration/xbzrle.c | 8 ++-- migration/xbzrle.h | 3 ++- tests/Makefile.include | 2 +- tests/test-xbzrle.c| 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/migration/r

[Qemu-devel] [PATCH v3 4/8] mem/nvdimm: ensure write persistence to PMEM in label emulation

2018-02-16 Thread Haozhong Zhang
configurations. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/mem/nvdimm.c | 9 - include/qemu/pmem.h | 23 +++ stubs/Makefile.objs | 1 + stubs/pmem.c| 19 +++ 4 files changed, 51 insertions(+), 1 deletion(-) creat

[Qemu-devel] [PATCH v3 7/8] migration/ram: ensure write persistence on loading compressed pages to PMEM

2018-02-16 Thread Haozhong Zhang
When loading a compressed page to persistent memory, flush CPU cache after the data is decompressed. Combined with a call to pmem_drain() at the end of memory loading, we can guarantee those compressed pages are persistently loaded to PMEM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.

[Qemu-devel] [PATCH v3 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-02-16 Thread Haozhong Zhang
ns in QEMU. * (Patch 5-8) Consider the write persistence in the migration path. Haozhong Zhang (8): [1/8] memory, exec: switch file ram allocation functions to 'flags' parameters [2/8] hostmem-file: add the 'pmem' option [3/8] configure: add libpmem support [4/8] mem/nvdimm: ensure write p

[Qemu-devel] [PATCH v3 3/8] configure: add libpmem support

2018-02-16 Thread Haozhong Zhang
(formerly known as NMVL), https://github.com/pmem/pmdk/ [2] https://github.com/pmem/pmdk/blob/38bfa652721a37fd94c0130ce0e3f5d8baa3ed40/src/libpmem/pmem.c#L33 Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- configure | 35 +++ 1 file chang

[Qemu-devel] [PATCH v3 1/8] memory, exec: switch file ram allocation functions to 'flags' parameters

2018-02-16 Thread Haozhong Zhang
' flag is converted to the QEMU_RAM_SHARE bit in flags, and other flag bits are ignored by above functions right now. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 3 ++- exec.c | 7 --- include/exec/memory.h

[Qemu-devel] [PATCH v3 2/8] hostmem-file: add the 'pmem' option

2018-02-16 Thread Haozhong Zhang
the backend storage of memory-backend-file is a real persistent memory. If 'pmem=on', QEMU will set the flag RAM_PMEM in the RAM block of the corresponding memory region. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 26 +-

Re: [Qemu-devel] [PATCH v2 4/8] mem/nvdimm: ensure write persistence to PMEM in label emulation

2018-02-09 Thread Haozhong Zhang
On 02/09/18 14:27 +, Stefan Hajnoczi wrote: > On Wed, Feb 07, 2018 at 03:33:27PM +0800, Haozhong Zhang wrote: > > @@ -156,11 +157,17 @@ static void nvdimm_write_label_data(NVDIMMDevice > > *nvdimm, const void *buf, > > { > > MemoryRegion *mr; > > PC

Re: [Qemu-devel] [PATCH v2 7/8] migration/ram: ensure write persistence on loading compressed pages to PMEM

2018-02-07 Thread Haozhong Zhang
On 02/07/18 13:03 +, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > On 02/07/18 11:54 +, Dr. David Alan Gilbert wrote: > > > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > > > When loading a compressed page t

Re: [Qemu-devel] [PATCH v2 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-07 Thread Haozhong Zhang
On 02/07/18 19:52 +0800, Haozhong Zhang wrote: > On 02/07/18 11:38 +, Dr. David Alan Gilbert wrote: > > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > > When loading a zero page, check whether it will be loaded to > > > persistent memory If yes,

Re: [Qemu-devel] [PATCH v2 7/8] migration/ram: ensure write persistence on loading compressed pages to PMEM

2018-02-07 Thread Haozhong Zhang
On 02/07/18 11:54 +, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > When loading a compressed page to persistent memory, flush CPU cache > > after the data is decompressed. Combined with a call to pmem_drain() > > at the end of m

Re: [Qemu-devel] [PATCH v2 6/8] migration/ram: ensure write persistence on loading normal pages to PMEM

2018-02-07 Thread Haozhong Zhang
On 02/07/18 11:49 +, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > When loading a normal page to persistent memory, load its data by > > libpmem function pmem_memcpy_nodrain() instead of memcpy(). Combined > > with a call to pm

Re: [Qemu-devel] [PATCH v2 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-07 Thread Haozhong Zhang
On 02/07/18 11:38 +, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@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

Re: [Qemu-devel] [PATCH v2 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-07 Thread Haozhong Zhang
But > I also see empty definition. Anything I am missing here? Functions defined in include/qemu/pmem.h are stubs and used only when QEMU is not compiled with libpmem. When QEMU is compiled with --enabled-libpmem, the one in libpmem is used. Haozhong > > Thanks, > Pank

[Qemu-devel] [PATCH v2 4/8] mem/nvdimm: ensure write persistence to PMEM in label emulation

2018-02-06 Thread Haozhong Zhang
configurations. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- hw/mem/nvdimm.c | 9 - include/qemu/pmem.h | 31 +++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 include/qemu/pmem.h diff --git a/hw/mem/nvdimm.c b/

[Qemu-devel] [PATCH v2 3/8] configure: add libpmem support

2018-02-06 Thread Haozhong Zhang
(formerly known as NMVL), https://github.com/pmem/pmdk/ [2] https://github.com/pmem/pmdk/blob/38bfa652721a37fd94c0130ce0e3f5d8baa3ed40/src/libpmem/pmem.c#L33 Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- configure | 35 +++ 1 file chang

[Qemu-devel] [PATCH v2 6/8] migration/ram: ensure write persistence on loading normal pages to PMEM

2018-02-06 Thread Haozhong Zhang
When loading a normal page to persistent memory, load its data by libpmem function pmem_memcpy_nodrain() instead of memcpy(). Combined with a call to pmem_drain() at the end of memory loading, we can guarantee all those normal pages are persistenly loaded to PMEM. Signed-off-by: Haozhong Zhang

[Qemu-devel] [PATCH v2 8/8] migration/ram: ensure write persistence on loading xbzrle pages to PMEM

2018-02-06 Thread Haozhong Zhang
-by: Haozhong Zhang <haozhong.zh...@intel.com> --- migration/ram.c| 15 ++- migration/xbzrle.c | 20 ++-- migration/xbzrle.h | 1 + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 924d2b9537..87f977617d

[Qemu-devel] [PATCH v2 2/8] hostmem-file: add the 'pmem' option

2018-02-06 Thread Haozhong Zhang
the backend storage of memory-backend-file is a real persistent memory. If 'pmem=on', QEMU will set the flag RAM_PMEM in the RAM block of the corresponding memory region. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 26 +-

[Qemu-devel] [PATCH v2 5/8] migration/ram: ensure write persistence on loading zero pages to PMEM

2018-02-06 Thread Haozhong Zhang
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.zh

[Qemu-devel] [PATCH v2 7/8] migration/ram: ensure write persistence on loading compressed pages to PMEM

2018-02-06 Thread Haozhong Zhang
When loading a compressed page to persistent memory, flush CPU cache after the data is decompressed. Combined with a call to pmem_drain() at the end of memory loading, we can guarantee those compressed pages are persistently loaded to PMEM. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.

[Qemu-devel] [PATCH v2 1/8] memory, exec: switch file ram allocation functions to 'flags' parameters

2018-02-06 Thread Haozhong Zhang
' flag is converted to the QEMU_RAM_SHARE bit in flags, and other flag bits are ignored by above functions right now. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file.c | 3 ++- exec.c | 7 --- include/exec/memory.h

[Qemu-devel] [PATCH v2 0/8] nvdimm: guarantee persistence of QEMU writes to persistent memory

2018-02-06 Thread Haozhong Zhang
than re-implementing those operations in QEMU. * (Patch 5-8) Consider the write persistence in the migration path. Haozhong Zhang (8): [1/8] memory, exec: switch file ram allocation functions to 'flags' parameters [2/8] hostmem-file: add the 'pmem' option [3/8] configure: add libpmem support

Re: [Qemu-devel] [PATCH v4 0/6] nvdimm: support MAP_SYNC for memory-backend-file

2018-02-01 Thread Haozhong Zhang
On 01/31/18 19:02 -0800, Dan Williams wrote: > On Wed, Jan 31, 2018 at 6:29 PM, Haozhong Zhang > <haozhong.zh...@intel.com> wrote: > > + vfio maintainer Alex Williamson in case my understanding of vfio is > > incorrect. > > > > On 01/31/18 16:32 -0800, Dan

Re: [Qemu-devel] [PATCH v4 0/6] nvdimm: support MAP_SYNC for memory-backend-file

2018-01-31 Thread Haozhong Zhang
+ vfio maintainer Alex Williamson in case my understanding of vfio is incorrect. On 01/31/18 16:32 -0800, Dan Williams wrote: > On Wed, Jan 31, 2018 at 4:24 PM, Haozhong Zhang > <haozhong.zh...@intel.com> wrote: > > On 01/31/18 16:08 -0800, Dan Williams wrote: > >> On W

Re: [Qemu-devel] [PATCH v4 0/6] nvdimm: support MAP_SYNC for memory-backend-file

2018-01-31 Thread Haozhong Zhang
On 01/31/18 16:08 -0800, Dan Williams wrote: > On Wed, Jan 31, 2018 at 4:02 PM, Haozhong Zhang > <haozhong.zh...@intel.com> wrote: > > On 01/31/18 14:25 -0800, Dan Williams wrote: > >> On Tue, Jan 30, 2018 at 10:02 PM, Haozhong Zhang > >> <haozhong.zh

Re: [Qemu-devel] [PATCH v4 0/6] nvdimm: support MAP_SYNC for memory-backend-file

2018-01-31 Thread Haozhong Zhang
On 01/31/18 14:25 -0800, Dan Williams wrote: > On Tue, Jan 30, 2018 at 10:02 PM, Haozhong Zhang > <haozhong.zh...@intel.com> wrote: > > Linux 4.15 introduces a new mmap flag MAP_SYNC, which can be used to > > guarantee the write persistence to mmap'ed files supporting DAX

[Qemu-devel] [PATCH v4 5/6] hostmem: add more information in error messages

2018-01-30 Thread Haozhong Zhang
When there are multiple memory backends in use, including the object type name, ID and the property name in the error message can help users to locate the error. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Suggested-by: "Dr. David Alan Gilbert" <dgilb...@r

[Qemu-devel] [PATCH v4 4/6] util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap()

2018-01-30 Thread Haozhong Zhang
. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- include/exec/memory.h | 26 ++ include/exec/ram_addr.h | 4 include/qemu/mmap-alloc.h | 4 include/standard-headers/linux/mman.

[Qemu-devel] [PATCH v4 2/6] exec: switch qemu_ram_alloc_from_{file, fd} to the 'flags' parameter

2018-01-30 Thread Haozhong Zhang
As more flag parameters besides the existing 'share' are going to be added to qemu_ram_alloc_from_{file,fd}(), let's swith 'share' to a 'flags' parameters in advance, so as to ease the further additions. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- exec.c

[Qemu-devel] [PATCH v4 0/6] nvdimm: support MAP_SYNC for memory-backend-file

2018-01-30 Thread Haozhong Zhang
tion to control the use of MAP_SYNC. (Eduardo Habkost) * Remove the unnecessary set of MAP_SHARED_VALIDATE in some cases and the retry mechanism in qemu_ram_mmap(). (Michael S. Tsirkin) * Move OS dependent definitions of MAP_SYNC and MAP_SHARED_VALIDATE to osdep.h. (Michael S. Tsirkin) Haozhong Z

[Qemu-devel] [PATCH v4 1/6] util/mmap-alloc: switch qemu_ram_mmap() to 'flags' parameter

2018-01-30 Thread Haozhong Zhang
As more flag parameters besides the existing 'shared' are going to be added to qemu_ram_mmap(), let's switch 'shared' to a 'flags' parameter in advance, so as to ease the further additions. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Suggested-by: "Michael S.

[Qemu-devel] [PATCH v4 3/6] memory: switch memory_region_init_ram_from_file() to 'flags' parameter

2018-01-30 Thread Haozhong Zhang
As more flag parameters besides the existing 'share' are going to be added to memory_region_init_ram_from_file(), let's switch 'share' to a 'flags' parameter in advance, so as to ease the further additions. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- backends/hostmem-file

[Qemu-devel] [PATCH v4 6/6] hostmem-file: add 'sync' option

2018-01-30 Thread Haozhong Zhang
as if 'sync=on'; otherwise, work as if 'sync=off' Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Suggested-by: Eduardo Habkost <ehabk...@redhat.com> Reviewed-by: Michael S. Tsirkin <m...@redhat.com> --- backends/hostmem-file.c | 41

Re: [Qemu-devel] [PATCH v3 3/3] hostmem-file: add 'sync' option

2018-01-24 Thread Haozhong Zhang
On 01/24/18 22:23 +0200, Michael S. Tsirkin wrote: > On Wed, Jan 17, 2018 at 04:13:25PM +0800, Haozhong Zhang wrote: > > This option controls whether QEMU mmap(2) the memory backend file with > > MAP_SYNC flag, which can fully guarantee the guest write persistence > > to the

Re: [Qemu-devel] [PATCH v3 1/3] util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap()

2018-01-24 Thread Haozhong Zhang
On 01/24/18 22:20 +0200, Michael S. Tsirkin wrote: > > index 50385e3f81..dd5876471f 100644 > > --- a/include/qemu/mmap-alloc.h > > +++ b/include/qemu/mmap-alloc.h > > @@ -7,7 +7,8 @@ size_t qemu_fd_getpagesize(int fd); > > > > size_t qemu_mempath_getpagesize(const char *mem_path); > > > >

  1   2   3   4   >