All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, xen-devel@lists.xensource.com,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [RFC QEMU PATCH 8/8] qmp: add a qmp command 'query-nvdimms' to get plugged NVDIMM devices
Date: Tue, 11 Oct 2016 09:45:56 -0500	[thread overview]
Message-ID: <aeaaff1e-3721-4668-0f93-aaa4be33913e@redhat.com> (raw)
In-Reply-To: <87d1j7pa62.fsf@dusky.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On 10/11/2016 03:22 AM, Markus Armbruster wrote:

> query-memory-devices returns a list of MemoryDeviceInfo:
> 
>     ##
>     # @MemoryDeviceInfo:
>     #
>     # Union containing information about a memory device
>     #
>     # Since: 2.1
>     ##
>     { 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
> 
> This is a union, designed to be extended for other types of memory
> device frontends.
> 
> Sadly, it's a "simple" union (I dislike those).
> 
> You could add a new member to be used for the NVDIMM case.  It would
> probably duplicate some or all of PCDIMMDeviceInfo, though.
> 
> If it needs all of PCDIMMDeviceInfo, you could make the new member's
> type have PCDIMMDeviceInfo as base.
> 
> If we can identify information *any* memory device frontend should have,
> the appropriate design would be a flat union with common information
> common, and type-specific information in union branches.  Could
> MemoryDeviceInfo be backward-compatibly morphed into such a type?

Yes, conversion to a flat union is possible without breaking existing
QMP usage.  It would look something like this (with anonymous base and
branch classes, which is still one of my pending qapi patches to post):

{ 'enum': 'MemoryDeviceType', 'data': [ 'dimm', 'nvdimm' ] }
{ 'union': 'MemoryDeviceInfo', 'base': { 'type': 'MemoryDeviceType' },
  'discriminator': 'type',
  'data': { 'dimm': { 'data': 'PCIMMDeviceInfo' },
            'nvdimm': 'whatever_type_here' } }

We would still have back-compatible:

{ "type": "dimm", "data": { "addr":..., "size":..., ... } }

for dimm, and for nvdimm, we would have

{ "type": "nvdimm", whatever fields we want here }

whether we want all the fields to be flattened in the nvdimm case, vs.
nested (for back-compat) under a 'data' dict in the 'dimm' case, or
whether we want both uses to be nested under a 'data' dict for
consistency, is a matter of taste.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: xen-devel@lists.xensource.com,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [RFC QEMU PATCH 8/8] qmp: add a qmp command 'query-nvdimms' to get plugged NVDIMM devices
Date: Tue, 11 Oct 2016 09:45:56 -0500	[thread overview]
Message-ID: <aeaaff1e-3721-4668-0f93-aaa4be33913e@redhat.com> (raw)
In-Reply-To: <87d1j7pa62.fsf@dusky.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On 10/11/2016 03:22 AM, Markus Armbruster wrote:

> query-memory-devices returns a list of MemoryDeviceInfo:
> 
>     ##
>     # @MemoryDeviceInfo:
>     #
>     # Union containing information about a memory device
>     #
>     # Since: 2.1
>     ##
>     { 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
> 
> This is a union, designed to be extended for other types of memory
> device frontends.
> 
> Sadly, it's a "simple" union (I dislike those).
> 
> You could add a new member to be used for the NVDIMM case.  It would
> probably duplicate some or all of PCDIMMDeviceInfo, though.
> 
> If it needs all of PCDIMMDeviceInfo, you could make the new member's
> type have PCDIMMDeviceInfo as base.
> 
> If we can identify information *any* memory device frontend should have,
> the appropriate design would be a flat union with common information
> common, and type-specific information in union branches.  Could
> MemoryDeviceInfo be backward-compatibly morphed into such a type?

Yes, conversion to a flat union is possible without breaking existing
QMP usage.  It would look something like this (with anonymous base and
branch classes, which is still one of my pending qapi patches to post):

{ 'enum': 'MemoryDeviceType', 'data': [ 'dimm', 'nvdimm' ] }
{ 'union': 'MemoryDeviceInfo', 'base': { 'type': 'MemoryDeviceType' },
  'discriminator': 'type',
  'data': { 'dimm': { 'data': 'PCIMMDeviceInfo' },
            'nvdimm': 'whatever_type_here' } }

We would still have back-compatible:

{ "type": "dimm", "data": { "addr":..., "size":..., ... } }

for dimm, and for nvdimm, we would have

{ "type": "nvdimm", whatever fields we want here }

whether we want all the fields to be flattened in the nvdimm case, vs.
nested (for back-compat) under a 'data' dict in the 'dimm' case, or
whether we want both uses to be nested under a 'data' dict for
consistency, is a matter of taste.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2016-10-11 14:46 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10  0:34 [Qemu-devel] [RFC QEMU PATCH 0/8] Implement vNVDIMM for Xen HVM guest Haozhong Zhang
2016-10-10  0:34 ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 1/8] nvdimm: do not initialize label_data if label_size is zero Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2017-02-15 22:18   ` [Qemu-devel] " Konrad Rzeszutek Wilk
2017-02-15 22:18     ` Konrad Rzeszutek Wilk
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 2/8] xen-hvm: add a function to copy ACPI to guest Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 3/8] nvdimm acpi: do not use fw_cfg on Xen Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 4/8] nvdimm acpi: build and copy NFIT to guest " Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 5/8] nvdimm acpi: build and copy NVDIMM namespace devices " Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 6/8] hostmem: add a host memory backend for Xen Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 7/8] xen-hvm: create hotplug memory region for HVM guest Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10  0:34 ` [Qemu-devel] [RFC QEMU PATCH 8/8] qmp: add a qmp command 'query-nvdimms' to get plugged NVDIMM devices Haozhong Zhang
2016-10-10  0:34   ` Haozhong Zhang
2016-10-10 19:16   ` [Qemu-devel] " Eric Blake
2016-10-10 19:16     ` Eric Blake
2016-10-11  6:31     ` [Qemu-devel] " Haozhong Zhang
2016-10-11  6:31       ` Haozhong Zhang
2016-10-11  8:22       ` [Qemu-devel] " Markus Armbruster
2016-10-11  8:22         ` Markus Armbruster
2016-10-11 10:12         ` [Qemu-devel] " Haozhong Zhang
2016-10-11 10:12           ` Haozhong Zhang
2016-10-11 14:45         ` Eric Blake [this message]
2016-10-11 14:45           ` Eric Blake
2016-10-10 16:52 ` [Qemu-devel] [RFC QEMU PATCH 0/8] Implement vNVDIMM for Xen HVM guest no-reply
2016-10-10 16:52   ` no-reply

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=aeaaff1e-3721-4668-0f93-aaa4be33913e@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=imammedo@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.