From: Igor Mammedov <imammedo@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "pingfank@linux.vnet.ibm.com" <pingfank@linux.vnet.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"gleb@redhat.com" <gleb@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] add cpu_set qmp command
Date: Thu, 19 Jan 2012 12:04:54 +0100 [thread overview]
Message-ID: <4F17F8D6.5060905@redhat.com> (raw)
In-Reply-To: <4F17EF6F.9080906@siemens.com>
On 01/19/2012 11:24 AM, Jan Kiszka wrote:
> On 2012-01-19 10:38, Igor Mammedov wrote:
>> On 01/17/2012 03:18 PM, Jan Kiszka wrote:
>>> On 2012-01-17 14:17, Igor Mammedov wrote:
>>>> Signed-off-by: Igor Mammedov<imammedo@redhat.com>
>>>> ---
>>>> 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.
>
> Well, you will still need the control logic of this patch, thus need to
> think about converting x86 CPUs to qdev. Otherwise, testing will only be
> possible over qemu-kvm.
>
> Jan
>
I've agree that converting x86 CPUs to qdev is needed. I've seen RFC
patches for qev-ifying ppc CPU but they haven't made to upstream yet. I'll
look at them as model for x86 CPU conversion but I can't promise fast
results here (I'm complete newbie in this). I'm open to suggestions if
you have a better idea how to do it or a better example.
I think there is sense in having in the tree the first 2 patches separately
from qdev-ifying cpu patches, since they provide a basic infrastructure
for vcpu hot-plug and we will reduce difference between qemu and qemu-kvm
in this parts of code. In addition, it will open a road for hot-unplug
patches that people send now against qemu-kvm.
It still will be possible to play with hot-plug using 3rd patch off the tree
while qdev-ifed cpu patch(es) in works.
--
Thanks,
Igor
prev parent reply other threads:[~2012-01-19 11:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-17 13:17 [Qemu-devel] [PATCH 0/3] Make vcpu hotplug work for qemu Igor Mammedov
2012-01-17 13:17 ` [Qemu-devel] [PATCH 1/3] Introduce a new bus "ICC" to connect APIC Igor Mammedov
2012-01-17 13:57 ` Jan Kiszka
2012-01-17 13:17 ` [Qemu-devel] [PATCH 2/3] VCPU hotplug support Igor Mammedov
2012-01-17 14:17 ` Jan Kiszka
2012-01-17 14:22 ` Jan Kiszka
2012-01-23 16:29 ` Igor Mammedov
2012-01-23 17:55 ` Jan Kiszka
2012-01-24 16:24 ` Igor Mammedov
2012-01-24 16:37 ` Jan Kiszka
2012-01-17 13:17 ` [Qemu-devel] [PATCH 3/3] add cpu_set qmp command Igor Mammedov
2012-01-17 14:18 ` Jan Kiszka
2012-01-19 9:38 ` Igor Mammedov
2012-01-19 10:24 ` Jan Kiszka
2012-01-19 11:04 ` Igor Mammedov [this message]
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=4F17F8D6.5060905@redhat.com \
--to=imammedo@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=pingfank@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.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 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.