From patchwork Thu Sep 20 11:44:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Chamarthy X-Patchwork-Id: 10607551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18EDD913 for ; Thu, 20 Sep 2018 11:45:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0866B2CF9D for ; Thu, 20 Sep 2018 11:45:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0D812D1A3; Thu, 20 Sep 2018 11:44:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 815622CF9D for ; Thu, 20 Sep 2018 11:44:59 +0000 (UTC) Received: from localhost ([::1]:49815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2xOE-0007qt-Ey for patchwork-qemu-devel@patchwork.kernel.org; Thu, 20 Sep 2018 07:44:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2xNX-0007XS-TV for qemu-devel@nongnu.org; Thu, 20 Sep 2018 07:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2xNT-00006Z-Pf for qemu-devel@nongnu.org; Thu, 20 Sep 2018 07:44:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2xNT-00005k-FB for qemu-devel@nongnu.org; Thu, 20 Sep 2018 07:44:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AD0630024D8 for ; Thu, 20 Sep 2018 11:44:10 +0000 (UTC) Received: from paraplu.localdomain (ovpn-117-100.ams2.redhat.com [10.36.117.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BD107FCAD; Thu, 20 Sep 2018 11:44:09 +0000 (UTC) From: Kashyap Chamarthy To: qemu-devel@nongnu.org Date: Thu, 20 Sep 2018 13:44:06 +0200 Message-Id: <20180920114406.20818-1-kchamart@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 20 Sep 2018 11:44:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] Deprecate QMP `cpu-add` X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kashyap Chamarthy , armbru@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The intended functionality of QMP command `cpu-add` is replaced by `device_add` (and `query-hotpluggable-cpus`). So let's deprecate `cpu-add`. A complete example of vCPU hotplug with the recommended way, using `device_add`: (1) Launch QEMU as follows (note that the "maxcpus" is mandatory to allow vCPU hotplug): $ qemu-system-x86_64 -display none -no-user-config -m 2048 \ -nodefaults -monitor stdio -machine pc,accel=kvm,usb=off \ -smp 1,maxcpus=2 -cpu IvyBridge-IBRS \ -blockdev node-name=node-Base,driver=qcow2,file.driver=file,file.filename=./base.qcow2 \ -device virtio-blk,drive=node-Base,id=virtio0 -qmp unix:/tmp/qmp-sock,server,nowait (2) Run 'qmp-shell' (located in the source tree) to connect to the just-launched QEMU: $> ./qmp/qmp-shell -p -v /tmp/qmp-sock [...] (QEMU) (3) Check which socket is free to allow hotplugging a CPU: (QEMU) query-hotpluggable-cpus { "execute":"query-hotpluggable-cpus", "arguments":{ } } { "return":[ { "type":"IvyBridge-IBRS-x86_64-cpu", "vcpus-count":1, "props":{ "socket-id":1, "core-id":0, "thread-id":0 } }, { "qom-path":"/machine/unattached/device[0]", "type":"IvyBridge-IBRS-x86_64-cpu", "vcpus-count":1, "props":{ "socket-id":0, "core-id":0, "thread-id":0 } } ] } (QEMU) (4) We can see that socket 1 is free, so use `device_add` to hotplug "IvyBridge-IBRS-x86_64-cpu": (QEMU) device_add id=cpu-2 driver=IvyBridge-IBRS-x86_64-cpu socket-id=1 core-id=0 thread-id=0 { "execute": "device_add", "arguments": { "socket-id": 1, "driver": "IvyBridge-IBRS-x86_64-cpu", "id": "cpu-2", "core-id": 0, "thread-id": 0 } } { "return": {} } (QEMU) (5) Optionally, run QMP `query-cpus-fast` for some details about the vCPUs. Suggested-by: Eduardo Habkost --- Also shouldn't we update tests/cpu-plug-test.c to make it use `device_add`. Can take a stab at it, if you'd like me to. --- qapi/misc.json | 6 +++++- qemu-deprecated.texi | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qapi/misc.json b/qapi/misc.json index d450cfef21..83bc9ad0ee 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -1104,7 +1104,11 @@ ## # @cpu-add: # -# Adds CPU with specified ID +# Adds CPU with specified ID. +# +# Notes: This command is deprecated. The `device_add` command should be +# used instead. See the `query-hotpluggable-cpus` command for +# details. # # @id: ID of CPU to be created, valid values [0..max_cpus) # diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 1b9c007f12..9c6d70d43a 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -155,6 +155,11 @@ The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command. The ``arch'' output member of the ``query-cpus-fast'' command is replaced by the ``target'' output member. +@subsection cpu-add (since 3.1) + +The intended functionality of ``cpu-add'' command, which is the ability +to hot-plug vCPUs, can now be achieved by the ``device_add'' command. + @section System emulator devices @subsection ivshmem (since 2.6.0)