From nobody Mon Apr 29 05:12:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537886300117685.961202592508; Tue, 25 Sep 2018 07:38:20 -0700 (PDT) Received: from localhost ([::1]:53500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oTi-0000r9-40 for importer@patchew.org; Tue, 25 Sep 2018 10:38:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oQ4-0006qe-Ps for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4oQ1-0002eg-DT for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4oQ0-0002Y9-W9 for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15E0C80467; Tue, 25 Sep 2018 14:34:20 +0000 (UTC) Received: from dgilbert-t530.redhat.com (unknown [10.36.118.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B74A19E01; Tue, 25 Sep 2018 14:34:18 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 15:34:12 +0100 Message-Id: <20180925143414.49554-2-dgilbert@redhat.com> In-Reply-To: <20180925143414.49554-1-dgilbert@redhat.com> References: <20180925143414.49554-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 25 Sep 2018 14:34:20 +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] [PULL 1/3] monitor: print message when using 'help' with an unknown command 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: marcandre.lureau@redhat.com, walling@linux.ibm.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Collin Walling When typing 'help' followed by an unknown command, QEMU will not print anything to the command line to let the user know they typed a bad command. Let's fix this by printing a message to the monitor when this happens. For example: (qemu) help xyz unknown command: 'xyz' Reported-by: Stefan Zimmermann Signed-off-by: Collin Walling Message-Id: <1532115624-27568-1-git-send-email-walling@linux.ibm.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- monitor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index 3b90c9eb5f..c4677b502b 100644 --- a/monitor.c +++ b/monitor.c @@ -952,6 +952,7 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t= *cmds, char **args, int nb_args, int arg_index) { const mon_cmd_t *cmd; + size_t i; =20 /* No valid arg need to compare with, dump all in *cmds */ if (arg_index >=3D nb_args) { @@ -973,9 +974,15 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_= t *cmds, } else { help_cmd_dump_one(mon, cmd, args, arg_index); } - break; + return; } } + + /* Command not found */ + monitor_printf(mon, "unknown command: '"); + for (i =3D 0; i <=3D arg_index; i++) { + monitor_printf(mon, "%s%s", args[i], i =3D=3D arg_index ? "'\n" : = " "); + } } =20 static void help_cmd(Monitor *mon, const char *name) --=20 2.17.1 From nobody Mon Apr 29 05:12:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537886179258896.5046849497268; Tue, 25 Sep 2018 07:36:19 -0700 (PDT) Received: from localhost ([::1]:53490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oRl-0007nq-4Q for importer@patchew.org; Tue, 25 Sep 2018 10:36:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oQ4-0006qZ-PS for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4oQ1-0002fJ-HC for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25415) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4oQ1-0002YX-44 for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6872E601B; Tue, 25 Sep 2018 14:34:21 +0000 (UTC) Received: from dgilbert-t530.redhat.com (unknown [10.36.118.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EC7019E71; Tue, 25 Sep 2018 14:34:20 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 15:34:13 +0100 Message-Id: <20180925143414.49554-3-dgilbert@redhat.com> In-Reply-To: <20180925143414.49554-1-dgilbert@redhat.com> References: <20180925143414.49554-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 25 Sep 2018 14:34:21 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL 2/3] hmp: fix migrate status timer leak 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: marcandre.lureau@redhat.com, walling@linux.ibm.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Spotted by ASAN doing some manual testing: Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f5fcdc75e50 in calloc (/lib64/libasan.so.5+0xeee50) #1 0x7f5fcd47241d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d) #2 0x55f989be92ce in timer_new /home/elmarco/src/qq/include/qemu/timer.= h:561 #3 0x55f989be92ff in timer_new_ms /home/elmarco/src/qq/include/qemu/tim= er.h:630 #4 0x55f989c0219d in hmp_migrate /home/elmarco/src/qq/hmp.c:2038 #5 0x55f98955927b in handle_hmp_command /home/elmarco/src/qq/monitor.c:= 3498 #6 0x55f98955fb8c in monitor_command_cb /home/elmarco/src/qq/monitor.c:= 4371 #7 0x55f98ad40f11 in readline_handle_byte /home/elmarco/src/qq/util/rea= dline.c:393 #8 0x55f98955fa4f in monitor_read /home/elmarco/src/qq/monitor.c:4354 #9 0x55f98aae30d7 in qemu_chr_be_write_impl /home/elmarco/src/qq/charde= v/char.c:175 #10 0x55f98aae317a in qemu_chr_be_write /home/elmarco/src/qq/chardev/ch= ar.c:187 #11 0x55f98aae940c in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.= c:66 #12 0x55f98ab63018 in qio_channel_fd_source_dispatch /home/elmarco/src/= qq/io/channel-watch.c:84 #13 0x7f5fcd46c8ac in g_main_dispatch gmain.c:3177 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180901134652.25884-1-marcandre.lureau@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- hmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hmp.c b/hmp.c index 4975fa56b0..52a4279e51 100644 --- a/hmp.c +++ b/hmp.c @@ -2001,6 +2001,7 @@ static void hmp_migrate_status_cb(void *opaque) } monitor_resume(status->mon); timer_del(status->timer); + timer_free(status->timer); g_free(status); } =20 --=20 2.17.1 From nobody Mon Apr 29 05:12:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537886181813229.65388285722713; Tue, 25 Sep 2018 07:36:21 -0700 (PDT) Received: from localhost ([::1]:53491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oRo-0007pE-Gl for importer@patchew.org; Tue, 25 Sep 2018 10:36:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4oQ4-0006qb-PM for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4oQ0-0002bT-Fi for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4oPz-0002Z7-Fh for qemu-devel@nongnu.org; Tue, 25 Sep 2018 10:34:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDD29C049AF8; Tue, 25 Sep 2018 14:34:22 +0000 (UTC) Received: from dgilbert-t530.redhat.com (unknown [10.36.118.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id B310419E77; Tue, 25 Sep 2018 14:34:21 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 15:34:14 +0100 Message-Id: <20180925143414.49554-4-dgilbert@redhat.com> In-Reply-To: <20180925143414.49554-1-dgilbert@redhat.com> References: <20180925143414.49554-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 25 Sep 2018 14:34:22 +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] [PULL 3/3] qmp, hmp: add PCI subsystem id and vendor id to PCI info 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: marcandre.lureau@redhat.com, walling@linux.ibm.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Denis V. Lunev" This is a long story. Red Hat has relicensed Windows KVM device drivers in 2018 and there was an agreement that to avoid WHQL driver conflict software manufacturers should set proper PCI subsystem vendor ID in their distributions. Thus PCI subsystem vendor id becomes actively used. The problem is that this field is applied by us via hardware compats. Thus technically it could be lost. This patch adds PCI susbsystem id and vendor id to exportable parameters for validation. Signed-off-by: Denis V. Lunev CC: "Dr. David Alan Gilbert" CC: Eric Blake CC: Markus Armbruster Message-Id: <20180918095852.28422-1-den@openvz.org> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Signed-off-by: Dr. David Alan Gilbert --- hmp.c | 2 ++ hw/pci/pci.c | 3 +++ qapi/misc.json | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index 52a4279e51..80a95fc269 100644 --- a/hmp.c +++ b/hmp.c @@ -824,6 +824,8 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) =20 monitor_printf(mon, ": PCI device %04" PRIx64 ":%04" PRIx64 "\n", dev->id->vendor, dev->id->device); + monitor_printf(mon, " PCI subsystem %04" PRIx64 ":%04" PRIx64 "\n= ", + dev->id->subsystem_vendor, dev->id->subsystem); =20 if (dev->has_irq) { monitor_printf(mon, " IRQ %" PRId64 ".\n", dev->irq); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 80bc45930d..51d0dec466 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1737,6 +1737,9 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice = *dev, PCIBus *bus, info->id =3D g_new0(PciDeviceId, 1); info->id->vendor =3D pci_get_word(dev->config + PCI_VENDOR_ID); info->id->device =3D pci_get_word(dev->config + PCI_DEVICE_ID); + info->id->subsystem =3D pci_get_word(dev->config + PCI_SUBSYSTEM_ID); + info->id->subsystem_vendor =3D + pci_get_word(dev->config + PCI_SUBSYSTEM_VENDOR_ID); info->regions =3D qmp_query_pci_regions(dev); info->qdev_id =3D g_strdup(dev->qdev.id ? dev->qdev.id : ""); =20 diff --git a/qapi/misc.json b/qapi/misc.json index d450cfef21..ada9af5add 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -832,10 +832,15 @@ # # @vendor: the PCI vendor id # +# @subsystem: the PCI subsystem id (since 3.1) +# +# @subsystem-vendor: the PCI subsystem vendor id (since 3.1) +# # Since: 2.4 ## { 'struct': 'PciDeviceId', - 'data': {'device': 'int', 'vendor': 'int'} } + 'data': {'device': 'int', 'vendor': 'int', 'subsystem': 'int', + 'subsystem-vendor': 'int'} } =20 ## # @PciDeviceInfo: --=20 2.17.1