From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2mqR-0007gz-Gz for qemu-devel@nongnu.org; Sun, 21 Dec 2014 15:11:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2mqJ-0000I0-QL for qemu-devel@nongnu.org; Sun, 21 Dec 2014 15:11:15 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:58913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2mqJ-0000HP-GP for qemu-devel@nongnu.org; Sun, 21 Dec 2014 15:11:07 -0500 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 21 Dec 2014 13:11:06 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id D2EFF3E40030 for ; Sun, 21 Dec 2014 13:11:02 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBLKBN7n39387220 for ; Sun, 21 Dec 2014 13:11:23 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBLKB2ZP022848 for ; Sun, 21 Dec 2014 13:11:02 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1417849159-6568-2-git-send-email-zhang.zhanghailiang@huawei.com> References: <1417849159-6568-1-git-send-email-zhang.zhanghailiang@huawei.com> <1417849159-6568-2-git-send-email-zhang.zhanghailiang@huawei.com> Message-ID: <20141221201056.15420.68865@loki> Date: Sun, 21 Dec 2014 14:10:56 -0600 Subject: Re: [Qemu-devel] [PATCH RFC for-2.3 1/6] qga: introduce three guest memory block commands with stubs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: peter.huangpeng@huawei.com Quoting zhanghailiang (2014-12-06 00:59:14) > Introduce three new guest commands: > guest-get-memory-blocks, guest-set-memory-blocks, guest-get-memory-block-= size. > = > With these three commands, we can support online/offline guest's memory b= lock > (logical memory hotplug/unplug) as required from host. > = > Signed-off-by: zhanghailiang > --- > qga/commands-posix.c | 19 ++++++++++++ > qga/commands-win32.c | 19 ++++++++++++ > qga/qapi-schema.json | 88 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++ > 3 files changed, 126 insertions(+) > = > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index f6f3e3c..b0d6a5d 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -1996,6 +1996,25 @@ GList *ga_command_blacklist_init(GList *blacklist) > return blacklist; > } > = > +GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return NULL; > +} > + > +int64_t qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, > + Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return -1; > +} > + > +int64_t qmp_guest_get_memory_block_size(Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return -1; > +} > + > /* register init/cleanup routines for stateful command groups */ > void ga_command_state_init(GAState *s, GACommandState *cs) > { > diff --git a/qga/commands-win32.c b/qga/commands-win32.c > index 3bcbeae..b53b679 100644 > --- a/qga/commands-win32.c > +++ b/qga/commands-win32.c > @@ -446,6 +446,25 @@ int64_t qmp_guest_set_vcpus(GuestLogicalProcessorLis= t *vcpus, Error **errp) > return -1; > } > = > +GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return NULL; > +} > + > +int64_t qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, > + Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return -1; > +} > + > +int64_t qmp_guest_get_memory_block_size(Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return -1; > +} > + > /* add unsupported commands to the blacklist */ > GList *ga_command_blacklist_init(GList *blacklist) > { > diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json > index 376e79f..4b81769 100644 > --- a/qga/qapi-schema.json > +++ b/qga/qapi-schema.json > @@ -738,3 +738,91 @@ > ## > { 'command': 'guest-get-fsinfo', > 'returns': ['GuestFilesystemInfo'] } > + > +## > +# @GuestMemoryBlock: > +# > +# @phys_index: Arbitrary guest-specific unique identifier of the MEMORY = BLOCK. > +# > +# @online: Whether the MEMORY BLOCK is enabled in logically. Not sure what was intended with "in logically". Logically enabled? Enabled = in guest maybe? > +# > +# @can-offline: #optional Whether offlining the MEMORY BLOCK is possibl= e. This member This line and a few below go beyond 80-char limit > +# is always filled in by the guest agent when the structur= e is > +# returned, and always ignored on input (hence it can be o= mitted > +# then). > +# > +# Since: 2.3 > +## > +{ 'type': 'GuestMemoryBlock', > + 'data': {'phys_index': 'uint64', > + 'online': 'bool', > + '*can-offline': 'bool'} } 'phys-index' would be the convention > + > +## > +# @guest-get-memory-blocks: > +# > +# Retrieve the list of the guest's memory blocks. > +# > +# This is a read-only operation. > +# > +# Returns: The list of all memory blocks the guest knows about. > +# Each memory block is put on the list exactly once, but their order > +# is unspecified. > +# > +# Since: 2.3 > +## > +{ 'command': 'guest-get-memory-blocks', > + 'returns': ['GuestMemoryBlock'] } > + > +## > +# @guest-set-memory-blocks: > +# > +# Attempt to reconfigure (currently: enable/disable) state of memory blo= cks > +# inside the guest. > +# > +# The input list is processed node by node in order. In each node @phys_= index > +# is used to look up the guest MEMORY BLOCK, for which @online specifies= the requested > +# state. The set of distinct @phys_index's is only required to be a subs= et of > +# the guest-supported identifiers. There's no restriction on list length= or on > +# repeating the same @phys_index (with possibly different @online field). > +# Preferably the input list should describe a modified subset of > +# @guest-get-memory-blocks' return value. > +# > +# Returns: The length of the initial sublist that has been successfully > +# processed. The guest agent maximizes this value. Possible cas= es: > +# > +# 0: if the @mem-blks list was empty on input. G= uest state > +# has not been changed. Otherwise, > +# > +# Error: processing the first node of @mem-blks fail= ed for the > +# reason returned. Guest state has not been c= hanged. > +# Otherwise, > +# > +# < length(@mem-blks): more than zero initial nodes have been p= rocessed, > +# but not the entire @mem-blks list. Guest st= ate has > +# changed accordingly. To retrieve the error > +# (assuming it persists), repeat the call wit= h the > +# successfully processed initial sublist remo= ved. > +# Otherwise, > +# > +# length(@mem-blks): call successful. I know this is how we handle set-vcpus, but repeating set-memory calls to g= et individual errors seems kind of painful in retrospect, and in this case, wh= ere there multiple points in the call which may fail, I'm not sure how useful an errno response would be. Perhaps we should return something like this inste= ad: { 'enum': 'GuestMemoryBlockResponseType', 'data': ['success', 'not-found', 'operation-not-supported', 'operation-fa= iled', ...]} { 'type': 'GuestMemoryBlockResponse', 'data': { 'response': 'GuestMemoryResponseType', '*error-code': 'int' }} { 'command': 'guest-set-memory-blocks', 'data': { 'mem-blks': ['GuestMemoryBlock'] }, 'returns': ['GuestMemoryBlockResponse'] } Where there's 1 response entry for each entry in mem-blk parameter. Alternatively, we could include the phys_index in the response entries, but since multiple requests for a particular block are accepted I think that would be more difficult to make sense of. > +# > +# Since: 2.3 > +## > +{ 'command': 'guest-set-memory-blocks', > + 'data': {'mem-blks': ['GuestMemoryBlock'] }, > + 'returns': 'int' } > + > +## > +# @guest-get-memory-block-size: > +# > +# Get the the size (in bytes) of a memory block in guest. > +# It is the unit of Memory online/offline operation (also called Logical= Memory Hotplug). > +# > +# Returns: memory block size in bytes. > +# > +# Since 2.3 > +## > +{ 'command': 'guest-get-memory-block-size', > + 'returns': 'int' } > + > -- = > 1.7.12.4