xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [RFC XEN PATCH 12/16] tools/libxl: build qemu options from xl vNVDIMM configs
Date: Wed, 8 Feb 2017 13:42:36 +0800	[thread overview]
Message-ID: <20170208054236.x24aw52eg3svn4ct@hz-desktop> (raw)
In-Reply-To: <20170127214751.GG18581@localhost.localdomain>

On 01/27/17 16:47 -0500, Konrad Rzeszutek Wilk wrote:
>On Mon, Oct 10, 2016 at 08:32:31AM +0800, Haozhong Zhang wrote:
>> For xl vNVDIMM configs
>>   vnvdimms = [ '/path/to/pmem0', '/path/to/pmem1', ... ]
>>
>> the following qemu options are built
>>   -machine <existing options>,nvdimm
>>   -m <existing options>,slots=$NR_SLOTS,maxmem=$MEM_SIZE
>>   -object memory-backend-xen,id=mem1,size=$PMEM0_SIZE,mem-path=/path/to/pmem0
>>   -device nvdimm,id=nvdimm1,memdev=mem1
>>   -object memory-backend-xen,id=mem2,size=$PMEM1_SIZE,mem-path=/path/to/pmem1
>>   -device nvdimm,id=nvdimm2,memdev=mem2
>>   ...
>> where
>> * NR_SLOTS is the number of entries in vnvdimms + 1,
>> * MEM_SIZE is the total size of all RAM and NVDIMM devices,
>> * PMEM#_SIZE is the size of the host pmem device/file '/path/to/pmem#'.
>>
>> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>> ---
>> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
>> Cc: Wei Liu <wei.liu2@citrix.com>
>> ---
>>  tools/libxl/libxl_dm.c      | 113 +++++++++++++++++++++++++++++++++++++++++++-
>>  tools/libxl/libxl_types.idl |   8 ++++
>>  tools/libxl/xl_cmdimpl.c    |  16 +++++++
>
>You probably also want this new parameter in the xl manpage.

will add description in xl manpage

>
>>  3 files changed, 135 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>> index ad366a8..6b8c019 100644
>> --- a/tools/libxl/libxl_dm.c
>> +++ b/tools/libxl/libxl_dm.c
>> @@ -24,6 +24,10 @@
>>  #include <sys/types.h>
>>  #include <pwd.h>
>>
>> +#if defined(__linux__)
>> +#include <linux/fs.h>
>> +#endif
>> +
>>  static const char *libxl_tapif_script(libxl__gc *gc)
>>  {
>>  #if defined(__linux__) || defined(__FreeBSD__)
>> @@ -905,6 +909,86 @@ static char *qemu_disk_ide_drive_string(libxl__gc *gc, const char *target_path,
>>      return drive;
>>  }
>>
>> +#if defined(__linux__)
>> +
>> +static uint64_t libxl__build_dm_vnvdimm_args(libxl__gc *gc, flexarray_t *dm_args,
>> +                                             struct libxl_device_vnvdimm *dev,
>> +                                             int dev_no)
>> +{
>> +    int fd, rc;
>> +    struct stat st;
>> +    uint64_t size = 0;
>> +    char *arg;
>> +
>> +    fd = open(dev->file, O_RDONLY);
>> +    if (fd < 0) {
>> +        LOG(ERROR, "failed to open file %s: %s",
>> +            dev->file, strerror(errno));
>> +        goto out;
>> +    }
>> +
>> +    if (stat(dev->file, &st)) {
>> +        LOG(ERROR, "failed to get status of file %s: %s",
>> +            dev->file, strerror(errno));
>> +        goto out_fclose;
>> +    }
>> +
>> +    switch (st.st_mode & S_IFMT) {
>> +    case S_IFBLK:
>> +        rc = ioctl(fd, BLKGETSIZE64, &size);
>> +        if (rc == -1) {
>> +            LOG(ERROR, "failed to get size of block device %s: %s",
>> +                dev->file, strerror(errno));
>> +            size = 0;
>> +        }
>> +        break;
>> +
>> +    case S_IFREG:
>> +        size = st.st_size;
>> +        break;
>> +
>> +    default:
>> +        LOG(ERROR, "%s is not a block device or regular file", dev->file);
>> +        break;
>> +    }
>> +
>> +    if (!size)
>> +        goto out_fclose;
>> +
>> +    flexarray_append(dm_args, "-object");
>> +    arg = GCSPRINTF("memory-backend-xen,id=mem%d,size=%"PRIu64",mem-path=%s",
>> +                    dev_no + 1, size, dev->file);
>> +    flexarray_append(dm_args, arg);
>> +
>> +    flexarray_append(dm_args, "-device");
>> +    arg = GCSPRINTF("nvdimm,id=nvdimm%d,memdev=mem%d", dev_no + 1, dev_no + 1);
>> +    flexarray_append(dm_args, arg);
>> +
>> + out_fclose:
>> +    close(fd);
>> + out:
>> +    return size;
>> +}
>> +
>> +static uint64_t libxl__build_dm_vnvdimms_args(
>> +    libxl__gc *gc, flexarray_t *dm_args,
>> +    struct libxl_device_vnvdimm *vnvdimms, int num_vnvdimms)
>> +{
>> +    uint64_t total_size = 0, size;
>> +    int i;
>
>unsigned int

will change

Thanks,
Haozhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-02-08  5:42 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10  0:32 [RFC XEN PATCH 00/16] Add vNVDIMM support to HVM domains Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 01/16] x86_64/mm: explicitly specify the location to place the frame table Haozhong Zhang
2016-12-09 21:35   ` Konrad Rzeszutek Wilk
2016-12-12  2:27     ` Haozhong Zhang
2016-12-12  8:25       ` Jan Beulich
2016-10-10  0:32 ` [RFC XEN PATCH 02/16] x86_64/mm: explicitly specify the location to place the M2P table Haozhong Zhang
2016-12-09 21:38   ` Konrad Rzeszutek Wilk
2016-12-12  2:31     ` Haozhong Zhang
2016-12-12  8:26       ` Jan Beulich
2016-12-12  8:35         ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 03/16] xen/x86: add a hypercall XENPF_pmem_add to report host pmem regions Haozhong Zhang
2016-10-11 19:13   ` Andrew Cooper
2016-12-09 22:02   ` Konrad Rzeszutek Wilk
2016-12-12  4:16     ` Haozhong Zhang
2016-12-12  8:30       ` Jan Beulich
2016-12-12  8:38         ` Haozhong Zhang
2016-12-12 14:44           ` Konrad Rzeszutek Wilk
2016-12-13  1:08             ` Haozhong Zhang
2016-12-22 11:58   ` Jan Beulich
2016-10-10  0:32 ` [RFC XEN PATCH 04/16] xen/x86: add XENMEM_populate_pmemmap to map host pmem pages to guest Haozhong Zhang
2016-12-09 22:22   ` Konrad Rzeszutek Wilk
2016-12-12  4:38     ` Haozhong Zhang
2016-12-22 12:19   ` Jan Beulich
2016-10-10  0:32 ` [RFC XEN PATCH 05/16] xen/x86: release pmem pages at domain destroy Haozhong Zhang
2016-12-09 22:27   ` Konrad Rzeszutek Wilk
2016-12-12  4:47     ` Haozhong Zhang
2016-12-22 12:22   ` Jan Beulich
2016-10-10  0:32 ` [RFC XEN PATCH 06/16] tools: reserve guest memory for ACPI from device model Haozhong Zhang
2017-01-27 20:44   ` Konrad Rzeszutek Wilk
2017-02-08  1:39     ` Haozhong Zhang
2017-02-08 14:31       ` Konrad Rzeszutek Wilk
2016-10-10  0:32 ` [RFC XEN PATCH 07/16] tools/libacpi: add callback acpi_ctxt.p2v to get a pointer from physical address Haozhong Zhang
2017-01-27 20:46   ` Konrad Rzeszutek Wilk
2017-02-08  1:42     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 08/16] tools/libacpi: expose details of memory allocation callback Haozhong Zhang
2017-01-27 20:58   ` Konrad Rzeszutek Wilk
2017-02-08  2:12     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 09/16] tools/libacpi: add callbacks to access XenStore Haozhong Zhang
2017-01-27 21:10   ` Konrad Rzeszutek Wilk
2017-02-08  2:19     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 10/16] tools/libacpi: add a simple AML builder Haozhong Zhang
2017-01-27 21:19   ` Konrad Rzeszutek Wilk
2017-02-08  2:33     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 11/16] tools/libacpi: load ACPI built by the device model Haozhong Zhang
2017-01-27 21:40   ` Konrad Rzeszutek Wilk
2017-02-08  5:38     ` Haozhong Zhang
2017-02-08 14:35       ` Konrad Rzeszutek Wilk
2016-10-10  0:32 ` [RFC XEN PATCH 12/16] tools/libxl: build qemu options from xl vNVDIMM configs Haozhong Zhang
2017-01-27 21:47   ` Konrad Rzeszutek Wilk
2017-02-08  5:42     ` Haozhong Zhang [this message]
2017-01-27 21:48   ` Konrad Rzeszutek Wilk
2017-02-08  5:47     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 13/16] tools/libxl: add support to map host pmem device to guests Haozhong Zhang
2017-01-27 22:06   ` Konrad Rzeszutek Wilk
2017-01-27 22:09     ` Konrad Rzeszutek Wilk
2017-02-08  5:59     ` Haozhong Zhang
2017-02-08 14:37       ` Konrad Rzeszutek Wilk
2016-10-10  0:32 ` [RFC XEN PATCH 14/16] tools/libxl: add support to map files on pmem devices " Haozhong Zhang
2017-01-27 22:10   ` Konrad Rzeszutek Wilk
2017-02-08  6:03     ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 15/16] tools/libxl: handle return code of libxl__qmp_initializations() Haozhong Zhang
2017-01-27 22:11   ` Konrad Rzeszutek Wilk
2017-02-08  6:07     ` Haozhong Zhang
2017-02-08 10:31       ` Wei Liu
2017-02-09  2:47         ` Haozhong Zhang
2017-02-09 10:13           ` Wei Liu
2017-02-09 10:16             ` Wei Liu
2017-02-10  2:37             ` Haozhong Zhang
2017-02-10  8:11               ` Wei Liu
2017-02-10  8:23                 ` Wei Liu
2017-02-10  8:24                 ` Haozhong Zhang
2016-10-10  0:32 ` [RFC XEN PATCH 16/16] tools/libxl: initiate pmem mapping via qmp callback Haozhong Zhang
2017-01-27 22:13   ` Konrad Rzeszutek Wilk
2017-02-08  6:08     ` Haozhong Zhang
2016-10-24 16:37 ` [RFC XEN PATCH 00/16] Add vNVDIMM support to HVM domains Wei Liu
2016-10-25  6:55   ` Haozhong Zhang
2016-10-25 11:28     ` Wei Liu

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=20170208054236.x24aw52eg3svn4ct@hz-desktop \
    --to=haozhong.zhang@intel.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=konrad@darnok.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).