From: Xiao Guangrong <guangrong.xiao@gmail.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>, qemu-devel@nongnu.org
Cc: dan.j.williams@intel.com,
Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
Igor Mammedov <imammedo@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 1/4] pc-dimm: add 'reserved-size' to reserve address range after the ending address
Date: Thu, 6 Apr 2017 19:50:51 +0800 [thread overview]
Message-ID: <5f625ae6-3908-51fa-9316-0557cfe55c47@gmail.com> (raw)
In-Reply-To: <20170331084147.32716-2-haozhong.zhang@intel.com>
On 03/31/2017 04:41 PM, Haozhong Zhang wrote:
> If option 'reserved-size=RSVD' is present, QEMU will reserve an
> address range of size 'RSVD' after the ending address of pc-dimm
> device.
>
> For the following example,
> -object memory-backend-file,id=mem0,size=4G,...
> -device nvdimm,id=dimm0,memdev=mem0,reserved-size=4K,...
> -device pc-dimm,id=dimm1,...
> if dimm0 is allocated to address N ~ N+4G, the address range of
> dimm1 will start from N+4G+4K or higher.
>
> Its current usage is to reserve spaces for flush hint addresses
> of nvdimm devices.
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> ---
> hw/mem/pc-dimm.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
> include/hw/mem/pc-dimm.h | 2 ++
> 2 files changed, 47 insertions(+), 3 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 9e8dab0..13dcd71 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -28,6 +28,7 @@
> #include "sysemu/kvm.h"
> #include "trace.h"
> #include "hw/virtio/vhost.h"
> +#include "exec/address-spaces.h"
>
> typedef struct pc_dimms_capacity {
> uint64_t size;
> @@ -44,7 +45,12 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
> MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm);
> Error *local_err = NULL;
> uint64_t existing_dimms_capacity = 0;
> - uint64_t addr;
> + uint64_t addr, size = memory_region_size(mr);
> +
> + size += object_property_get_int(OBJECT(dimm), PC_DIMM_RSVD_PROP, &local_err);
> + if (local_err) {
> + goto out;
> + }
>
> addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err);
> if (local_err) {
> @@ -54,7 +60,7 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
> addr = pc_dimm_get_free_addr(hpms->base,
> memory_region_size(&hpms->mr),
> !addr ? NULL : &addr, align,
> - memory_region_size(mr), &local_err);
> + size, &local_err);
> if (local_err) {
> goto out;
> }
> @@ -64,7 +70,7 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
> goto out;
> }
>
> - if (existing_dimms_capacity + memory_region_size(mr) >
> + if (existing_dimms_capacity + size >
> machine->maxram_size - machine->ram_size) {
> error_setg(&local_err, "not enough space, currently 0x%" PRIx64
> " in use of total hot pluggable 0x" RAM_ADDR_FMT,
> @@ -315,6 +321,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
> PCDIMMDevice *dimm = item->data;
> uint64_t dimm_size = object_property_get_int(OBJECT(dimm),
> PC_DIMM_SIZE_PROP,
> + errp) +
> + object_property_get_int(OBJECT(dimm),
> + PC_DIMM_RSVD_PROP,
> errp);
> if (errp && *errp) {
> goto out;
> @@ -382,6 +391,37 @@ static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name,
> error_propagate(errp, local_err);
> }
>
Should count the reserved size in pc_existing_dimms_capacity_internal()
too.
next prev parent reply other threads:[~2017-04-06 11:51 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 8:41 [Qemu-devel] [RFC PATCH 0/4] nvdimm: enable flush hint address structure Haozhong Zhang
2017-03-31 8:41 ` [Qemu-devel] [RFC PATCH 1/4] pc-dimm: add 'reserved-size' to reserve address range after the ending address Haozhong Zhang
2017-04-06 10:24 ` Stefan Hajnoczi
2017-04-06 10:46 ` Haozhong Zhang
2017-04-07 13:46 ` Stefan Hajnoczi
2017-04-11 8:57 ` Haozhong Zhang
2017-04-20 10:54 ` Igor Mammedov
2017-04-06 11:50 ` Xiao Guangrong [this message]
2017-03-31 8:41 ` [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and perform flush on back store Haozhong Zhang
2017-04-06 11:52 ` Xiao Guangrong
2017-04-11 8:22 ` Haozhong Zhang
2017-04-11 8:29 ` Haozhong Zhang
2017-04-11 11:55 ` Xiao Guangrong
2017-04-20 13:12 ` Igor Mammedov
2017-03-31 8:41 ` [Qemu-devel] [RFC PATCH 3/4] nvdimm acpi: record the cache line size in AcpiNVDIMMState Haozhong Zhang
2017-03-31 8:41 ` [Qemu-devel] [RFC PATCH 4/4] nvdimm acpi: build flush hint address structure if required Haozhong Zhang
2017-04-06 10:13 ` Stefan Hajnoczi
2017-04-06 10:53 ` Haozhong Zhang
2017-04-07 14:41 ` Stefan Hajnoczi
2017-04-07 15:51 ` Dan Williams
2017-04-06 10:25 ` Stefan Hajnoczi
2017-04-20 11:22 ` Igor Mammedov
2017-04-06 9:39 ` [Qemu-devel] [RFC PATCH 0/4] nvdimm: enable flush hint address structure Xiao Guangrong
2017-04-06 9:58 ` Haozhong Zhang
2017-04-06 11:46 ` Xiao Guangrong
2017-04-06 9:43 ` Stefan Hajnoczi
2017-04-06 10:31 ` Haozhong Zhang
2017-04-07 14:38 ` Stefan Hajnoczi
2017-04-06 12:02 ` Xiao Guangrong
2017-04-11 8:41 ` Haozhong Zhang
2017-04-11 14:56 ` Dan Williams
2017-04-20 19:49 ` Dan Williams
2017-04-21 13:56 ` Stefan Hajnoczi
2017-04-21 19:14 ` Dan Williams
2017-04-06 14:32 ` Dan Williams
2017-04-07 14:31 ` Stefan Hajnoczi
2017-04-11 6:34 ` Haozhong Zhang
2017-04-18 10:15 ` Stefan Hajnoczi
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=5f625ae6-3908-51fa-9316-0557cfe55c47@gmail.com \
--to=guangrong.xiao@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--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).