From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnoSK-0006NN-Cb for qemu-devel@nongnu.org; Thu, 19 Jan 2012 04:38:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnoSE-0006r7-Kv for qemu-devel@nongnu.org; Thu, 19 Jan 2012 04:38:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnoSE-0006r2-3d for qemu-devel@nongnu.org; Thu, 19 Jan 2012 04:38:46 -0500 Message-ID: <4F17E49E.8020303@redhat.com> Date: Thu, 19 Jan 2012 10:38:38 +0100 From: Igor Mammedov MIME-Version: 1.0 References: <1326806230-2734-1-git-send-email-imammedo@redhat.com> <1326806230-2734-4-git-send-email-imammedo@redhat.com> <4F158324.7050300@siemens.com> In-Reply-To: <4F158324.7050300@siemens.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] add cpu_set qmp command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: "pingfank@linux.vnet.ibm.com" , "qemu-devel@nongnu.org" , "gleb@redhat.com" On 01/17/2012 03:18 PM, Jan Kiszka wrote: > On 2012-01-17 14:17, Igor Mammedov wrote: >> Signed-off-by: Igor Mammedov >> --- >> qapi-schema.json | 9 +++++++++ >> qmp-commands.hx | 26 ++++++++++++++++++++++++++ >> qmp.c | 15 +++++++++++++++ >> 3 files changed, 50 insertions(+), 0 deletions(-) >> >> diff --git a/qapi-schema.json b/qapi-schema.json >> index 44cf764..05cc582 100644 >> --- a/qapi-schema.json >> +++ b/qapi-schema.json >> @@ -903,6 +903,15 @@ >> { 'command': 'cpu', 'data': {'index': 'int'} } >> >> ## >> +# @cpu_set >> +# >> +# Sets specified cpu to online/ofline mode >> +# >> +# Notes: semantics is : cpu_set x online|offline >> +## >> +{ 'command': 'cpu_set', 'data': {'cpu_index': 'int', 'status': 'str'} } >> + >> +## >> # @memsave: >> # >> # Save a portion of guest memory to a file. >> diff --git a/qmp-commands.hx b/qmp-commands.hx >> index 7e3f4b9..ef1ac1e 100644 >> --- a/qmp-commands.hx >> +++ b/qmp-commands.hx >> @@ -348,6 +348,32 @@ Note: CPUs' indexes are obtained with the 'query-cpus' command. >> EQMP >> >> { >> + .name = "cpu_set", >> + .args_type = "cpu_index:i,status:s", >> + .mhandler.cmd_new = qmp_marshal_input_cpu_set, >> + }, >> + >> +SQMP >> +cpu_set >> +------- >> + >> +Sets virtual cpu to online/ofline state >> + >> +Arguments: >> + >> +- "cpu_index": virtual cpu index (json-int) >> +- "status": desired state of cpu, online/offline (json-string) >> + >> +Example: >> + >> +-> { "execute": "cpu_set", >> + "arguments": { "cpu_index": 2, >> + "status": "online" } } >> +<- { "return": {} } >> + >> +EQMP >> + >> + { >> .name = "memsave", >> .args_type = "val:l,size:i,filename:s,cpu:i?", >> .mhandler.cmd_new = qmp_marshal_input_memsave, >> diff --git a/qmp.c b/qmp.c >> index c74dde6..e2b268d 100644 >> --- a/qmp.c >> +++ b/qmp.c >> @@ -101,6 +101,21 @@ void qmp_cpu(int64_t index, Error **errp) >> /* Just do nothing */ >> } >> >> +void qmp_cpu_set(int64_t cpu_index, const char *status, Error **errp) >> +{ >> + int state; >> + >> + if (!strcmp(status, "online")) { >> + state = 1; >> + } else if (!strcmp(status, "offline")) { >> + state = 0; >> + } else { >> + error_set(errp, QERR_INVALID_PARAMETER, status); >> + return; >> + } >> + qemu_system_cpu_hot_add(cpu_index, state); >> +} >> + >> #ifndef CONFIG_VNC >> /* If VNC support is enabled, the "true" query-vnc command is >> defined in the VNC subsystem */ > > This shouldn't go upstream. We rather need qdev'ified CPUs that can be > added and removed as any other device. > Jan, Thanks for review! Then I'll drop this patch and re-post the other ones after fixing them. > Jan > -- Thanks, Igor