From patchwork Thu Apr 2 19:06:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7063F1392 for ; Thu, 2 Apr 2020 19:07:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46A3720719 for ; Thu, 2 Apr 2020 19:07:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AArqcsal" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46A3720719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Br-0004C4-DQ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33775) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5At-0002OV-LF for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5As-0000Aj-JX for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:47 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:23245 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5As-00009B-Fd for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sewDymgizkxqPJPRT3hku2hWbDlQTKfdk8fI/f5dunM=; b=AArqcsaltbFxIohBCirFam3Ic5sTtkxceDpDK0wyQOlE9ckQ294NY+/qWE9/CP2xf5OkEe XfN1Lz/ZYCSyvIW5WW+WyHhLUEyvG5I8ZLBCuJQ9Cri61qg++LC+jg8LjEm2oXjkX9AiDV wAj40nk45X86TE8VIeoVUudQEa39PXY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-157-AXgxyE0QNEOmQC29Dw-v8g-1; Thu, 02 Apr 2020 15:06:43 -0400 X-MC-Unique: AXgxyE0QNEOmQC29Dw-v8g-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58EC88018A7; Thu, 2 Apr 2020 19:06:42 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D746650BEE; Thu, 2 Apr 2020 19:06:41 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/15] hw/scsi/vmw_pvscsi: Remove assertion for kick after reset Date: Thu, 2 Apr 2020 15:06:26 -0400 Message-Id: <20200402190640.1693-2-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elazar Leibovich , Liran Alon Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Elazar Leibovich When running Ubuntu 3.13.0-65-generic guest, QEMU sometimes crashes during guest ACPI reset. It crashes on assert(s->rings_info_valid) in pvscsi_process_io(). Analyzing the crash revealed that it happens when userspace issues a sync during a reboot syscall. Below are backtraces we gathered from the guests. Guest backtrace when issuing PVSCSI_CMD_ADAPTER_RESET: pci_device_shutdown device_shutdown init_pid_ns init_pid_ns kernel_power_off SYSC_reboot Guest backtrace when issuing PVSCSI_REG_OFFSET_KICK_RW_IO: scsi_done scsi_dispatch_cmd blk_add_timer scsi_request_fn elv_rb_add __blk_run_queue queue_unplugged blk_flush_plug_list blk_finish_plug ext4_writepages set_next_entity do_writepages __filemap_fdatawrite_range filemap_write_and_wait_range ext4_sync_file ext4_sync_file do_fsync sys_fsync Since QEMU pvscsi should imitate VMware pvscsi device emulation, we decided to imitate VMware's behavior in this case. To check VMware behavior, we wrote a kernel module that issues a reset to the pvscsi device and then issues a kick. We ran it on VMware ESXi 6.5 and it seems that it simply ignores the kick. Hence, we decided to ignore the kick as well. Signed-off-by: Elazar Leibovich Signed-off-by: Liran Alon Message-Id: <20200315132634.113632-1-liran.alon@oracle.com> Signed-off-by: Paolo Bonzini --- hw/scsi/vmw_pvscsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index c91352cf46..ec5bf9ea34 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -719,7 +719,10 @@ pvscsi_process_io(PVSCSIState *s) PVSCSIRingReqDesc descr; hwaddr next_descr_pa; - assert(s->rings_info_valid); + if (!s->rings_info_valid) { + return; + } + while ((next_descr_pa = pvscsi_ring_pop_req_descr(&s->rings)) != 0) { /* Only read after production index verification */ From patchwork Thu Apr 2 19:06:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471319 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 046101392 for ; Thu, 2 Apr 2020 19:07:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEAEE20719 for ; Thu, 2 Apr 2020 19:07:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QCgGNY6g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEAEE20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Bq-00049v-Qg for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:07:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33766) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5At-0002OU-GM for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5As-00009n-8e for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:56451 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5As-00008e-4l for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLTKvMaeXidLHOB5oKca6XdBHm1iUVOIo6D0v329Ekk=; b=QCgGNY6giayxrcgkkLOiOQ3FcNLAIMTtbYFWi4qaqmgxWcDZFklckbt6QU9Sj0TqI0uzqJ 5aV+pHFWkGXkc/erjJVSE+whJrFs3mNTbnWIJpnVDpMnYEXEcdcT52AMQFF+0UaIciqyDS idgiUF7tob9YN/Q/JYWrYoGgSlR6jCE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-iYaiJ-9SOM2IJ4iX3p3JIQ-1; Thu, 02 Apr 2020 15:06:43 -0400 X-MC-Unique: iYaiJ-9SOM2IJ4iX3p3JIQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBE78800D50 for ; Thu, 2 Apr 2020 19:06:42 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FB48DA0F2; Thu, 2 Apr 2020 19:06:42 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/15] hw/isa/superio: Correct the license text Date: Thu, 2 Apr 2020 15:06:27 -0400 Message-Id: <20200402190640.1693-3-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The license is the 'GNU General Public License v2.0 or later', not 'and': This program is free software; you can redistribute it and/ori modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Fix the license comment. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20200312213712.16671-1-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 2 +- hw/isa/smc37c669-superio.c | 2 +- include/hw/isa/superio.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index c4e391916c..180a8b9625 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -5,7 +5,7 @@ * Copyright (c) 2011-2012 Andreas Färber * Copyright (c) 2018 Philippe Mathieu-Daudé * - * This code is licensed under the GNU GPLv2 and later. + * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * SPDX-License-Identifier: GPL-2.0-or-later */ diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c index 901a9f8e65..18287741cb 100644 --- a/hw/isa/smc37c669-superio.c +++ b/hw/isa/smc37c669-superio.c @@ -3,7 +3,7 @@ * * Copyright (c) 2018 Philippe Mathieu-Daudé * - * This code is licensed under the GNU GPLv2 and later. + * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * SPDX-License-Identifier: GPL-2.0-or-later */ diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index b151dcd753..147cc0a7b7 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -3,7 +3,7 @@ * * Copyright (c) 2018 Philippe Mathieu-Daudé * - * This code is licensed under the GNU GPLv2 and later. + * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. * SPDX-License-Identifier: GPL-2.0-or-later */ From patchwork Thu Apr 2 19:06:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F78B159A for ; Thu, 2 Apr 2020 19:09:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2633C20737 for ; Thu, 2 Apr 2020 19:09:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ARYEi5Cd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2633C20737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Do-0007i7-9V for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:09:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33778) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5At-0002OW-Qv for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5As-0000BF-Mp for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:47 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:44186 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5As-00009k-JK for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhyHSwnvPzmZ8Yxw/i98vXCiGBqNI3f3CCkkiY3LjfU=; b=ARYEi5Cd2wZR4ATq2U/wzGt4xEKX+HewH9m/dG85SvK3NgJrhzvj9lHV26wLNoNvasYG4n ppdKRSb7UqP/nyWo7NRmJucZ8X+g5dEeLRMfggtELU+m07aRUyB3NzHE3qJEFplt3CcbKJ d/Dyp0Dnj+HH2sOPvo3691WxRChTkNs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-112-ioGVWgRbMRakLxLskAMGiw-1; Thu, 02 Apr 2020 15:06:44 -0400 X-MC-Unique: ioGVWgRbMRakLxLskAMGiw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5386C100550D for ; Thu, 2 Apr 2020 19:06:43 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D10350BEE for ; Thu, 2 Apr 2020 19:06:42 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/15] virtio-iommu: depend on PCI Date: Thu, 2 Apr 2020 15:06:28 -0400 Message-Id: <20200402190640.1693-4-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The virtio-iommu device attaches itself to a PCI bus, so it makes no sense to include it unless PCI is supported---and in fact compilation fails without this change. Reported-by: Gerd Hoffmann Signed-off-by: Paolo Bonzini --- hw/virtio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index d29525b36f..83122424fa 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -12,7 +12,7 @@ config VIRTIO_RNG config VIRTIO_IOMMU bool default y - depends on VIRTIO + depends on PCI && VIRTIO config VIRTIO_PCI bool From patchwork Thu Apr 2 19:06:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471317 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34FE892C for ; Thu, 2 Apr 2020 19:07:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09B4320719 for ; Thu, 2 Apr 2020 19:07:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XEB4KeJn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09B4320719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Bp-00048V-3k for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:07:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33808) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Aw-0002P3-Rl for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5Av-0000Hh-TL for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:45739 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Av-0000H7-PY for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xDM3glSSSSp/hmegWVLuNV4TSCzdkttW5HQPD+qQA8E=; b=XEB4KeJnpbtCnw0dDvOYZ6iXF50TGw4yROmMoIM/ochnHv586NKOMNv47AjAdGjTzi3qKL IsP/njQWJ/OAGymeYW7lkb113kgys0MerVnmIblX5DhkDkXKX+/uqdJd0dkW5+WopUVkSw O9QascE7FS0IVrLpF1lB5ypoICcDgRQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-QELR6jvKOu6H1-bjkBzAqw-1; Thu, 02 Apr 2020 15:06:47 -0400 X-MC-Unique: QELR6jvKOu6H1-bjkBzAqw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 637DD107ACC4 for ; Thu, 2 Apr 2020 19:06:46 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 795FD50BEE; Thu, 2 Apr 2020 19:06:43 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/15] softmmu: fix crash with invalid -M memory-backend= Date: Thu, 2 Apr 2020 15:06:29 -0400 Message-Id: <20200402190640.1693-5-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Fixes: fe64d06afc1c5d895f220c268cfe4d5f1e65d44e ("vl.c: ensure that ram_size matches size of machine.memory-backend") Signed-off-by: Marc-André Lureau Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200309145155.168942-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/softmmu/vl.c b/softmmu/vl.c index a331fb5321..796a77e234 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4298,6 +4298,11 @@ void qemu_init(int argc, char **argv, char **envp) backend = object_resolve_path_type(current_machine->ram_memdev_id, TYPE_MEMORY_BACKEND, NULL); + if (!backend) { + error_report("Memory backend '%s' not found", + current_machine->ram_memdev_id); + exit(EXIT_FAILURE); + } backend_size = object_property_get_uint(backend, "size", &error_abort); if (have_custom_ram_size && backend_size != ram_size) { error_report("Size specified by -m option must match size of " From patchwork Thu Apr 2 19:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08D0B1392 for ; Thu, 2 Apr 2020 19:09:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D175A20719 for ; Thu, 2 Apr 2020 19:09:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PLabWmZ/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D175A20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Dp-0007mS-VG for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:09:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33874) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B1-0002Ua-Lo for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5Az-0000Oz-P1 for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52251 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Az-0000MX-KX for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=we81EMi0HuTjy4csfYnufkD+oqMDDEevQLiXwsqvJDI=; b=PLabWmZ/WVLcQun/XuFSDaRQP4GVDhzCEgURQJ9oVbdW6dIDgnCsWMIUoDNtXk1YLbJsrk peY9bAjrZaQiEU8MAQwnOtQmtW4rSL27A4NcQS0wY7P0xnWJqpWwFyzIax3o5PIZG+0/gy KPZ/685M7lMI3VLTXwmdg2CsDmjiH+U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-gS4d2xVXOJafHu86GwdGOQ-1; Thu, 02 Apr 2020 15:06:49 -0400 X-MC-Unique: gS4d2xVXOJafHu86GwdGOQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F6D1800D50; Thu, 2 Apr 2020 19:06:47 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 897D150BEE; Thu, 2 Apr 2020 19:06:46 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/15] MAINTAINERS: Add an entry for the HVF accelerator Date: Thu, 2 Apr 2020 15:06:30 -0400 Message-Id: <20200402190640.1693-6-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , Cameron Esfahani , Sergio Andres Gomez Del Real , Patrick Colp , Liran Alon , Nikita Leshenko , Heiher Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Roman Bolshakov Cc: Nikita Leshenko Cc: Sergio Andres Gomez Del Real Cc: Patrick Colp Cc: Cameron Esfahani Cc: Liran Alon Cc: Heiher Signed-off-by: Roman Bolshakov Message-Id: <20200316171825.42544-1-r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e580276603..7cb53ec138 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -412,6 +412,13 @@ S: Supported F: target/i386/kvm.c F: scripts/kvm/vmxcap +X86 HVF CPUs +M: Roman Bolshakov +S: Maintained +F: accel/stubs/hvf-stub.c +F: target/i386/hvf/ +F: include/sysemu/hvf.h + WHPX CPUs M: Sunil Muthuswamy S: Supported From patchwork Thu Apr 2 19:06:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1BBB992C for ; Thu, 2 Apr 2020 19:11:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E533620719 for ; Thu, 2 Apr 2020 19:11:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RjUYJQeI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E533620719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Fn-0002kR-0z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Az-0002R9-22 for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5Ay-0000Kr-22 for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57074 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Ax-0000Kd-UY for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1G5bVnPSpqOFZhuC7mRGX6s1v8ile8pX/juVa9Lw3ZA=; b=RjUYJQeIJXCZkSQ0PY4WNLrkrZ4IMQghupDaAg4FSKdOuZi5MYOq2V6Fion2Ib/4xceqP5 aq47wUJzNLdglaiQ34BXK6HhXAyC3O01xoQ1u4A72Hj/ve4dpro3zf3u4xyl+0ZbasVN5G UhwlM3DcJadsb9lqfguKl73VoVmeC5Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-sg6b8JHCOmimJr0BexzOjg-1; Thu, 02 Apr 2020 15:06:49 -0400 X-MC-Unique: sg6b8JHCOmimJr0BexzOjg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33838107ACC9; Thu, 2 Apr 2020 19:06:48 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6030DA0F2; Thu, 2 Apr 2020 19:06:47 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/15] util/bufferiszero: assign length_to_accel value for each accelerator case Date: Thu, 2 Apr 2020 15:06:31 -0400 Message-Id: <20200402190640.1693-7-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Hoo Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Robert Hoo Because in unit test, init_accel() will be called several times, each with different accelerator type. Signed-off-by: Robert Hoo Message-Id: <1585119021-46593-1-git-send-email-robert.hu@linux.intel.com> Signed-off-by: Paolo Bonzini --- util/bufferiszero.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index 663903553a..b8012532e4 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -254,13 +254,16 @@ static void init_accel(unsigned cache) bool (*fn)(const void *, size_t) = buffer_zero_int; if (cache & CACHE_SSE2) { fn = buffer_zero_sse2; + length_to_accel = 64; } #ifdef CONFIG_AVX2_OPT if (cache & CACHE_SSE4) { fn = buffer_zero_sse4; + length_to_accel = 64; } if (cache & CACHE_AVX2) { fn = buffer_zero_avx2; + length_to_accel = 64; } #endif #ifdef CONFIG_AVX512F_OPT From patchwork Thu Apr 2 19:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEA0292C for ; Thu, 2 Apr 2020 19:13:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70A7920719 for ; Thu, 2 Apr 2020 19:13:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BU5sGPkJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70A7920719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5H4-0004il-Cp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:13:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33864) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B1-0002UU-9m for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5Az-0000Lq-7X for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60319 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Ay-0000Kj-3T for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kQbtW20VeBRzAfEmdwTdAX4X14E+HlJSxEi4k04fnyQ=; b=BU5sGPkJ2TDK40sQdcb8IbQvWuVcp0cHzyZlE+vyNGcB1tZ46qmeSjgxGifXKmosQxgZyX hb/h4yD+mcKOAAvABQR9jUrnrHrnBO9y9ifCbxrLKRXWTyCfIum1MRKSGBECDZXSOdkj4f GR5uHLvOndnf6rreUDYGBShDw+R10Bw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-g7J99xCQMyCpt8a7Csgreg-1; Thu, 02 Apr 2020 15:06:49 -0400 X-MC-Unique: g7J99xCQMyCpt8a7Csgreg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3A3A107ACC4; Thu, 2 Apr 2020 19:06:48 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F9E50BEE; Thu, 2 Apr 2020 19:06:48 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/15] util/bufferiszero: improve avx2 accelerator Date: Thu, 2 Apr 2020 15:06:32 -0400 Message-Id: <20200402190640.1693-8-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Hoo Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Robert Hoo By increasing avx2 length_to_accel to 128, we can simplify its logic and reduce a branch. The authorship of this patch actually belongs to Richard Henderson , I just fixed a boundary case on his original patch. Suggested-by: Richard Henderson Signed-off-by: Robert Hoo Message-Id: <1585119021-46593-2-git-send-email-robert.hu@linux.intel.com> Signed-off-by: Paolo Bonzini --- util/bufferiszero.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index b8012532e4..695bb4ce28 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -158,27 +158,19 @@ buffer_zero_avx2(const void *buf, size_t len) __m256i *p = (__m256i *)(((uintptr_t)buf + 5 * 32) & -32); __m256i *e = (__m256i *)(((uintptr_t)buf + len) & -32); - if (likely(p <= e)) { - /* Loop over 32-byte aligned blocks of 128. */ - do { - __builtin_prefetch(p); - if (unlikely(!_mm256_testz_si256(t, t))) { - return false; - } - t = p[-4] | p[-3] | p[-2] | p[-1]; - p += 4; - } while (p <= e); - } else { - t |= _mm256_loadu_si256(buf + 32); - if (len <= 128) { - goto last2; + /* Loop over 32-byte aligned blocks of 128. */ + while (p <= e) { + __builtin_prefetch(p); + if (unlikely(!_mm256_testz_si256(t, t))) { + return false; } - } + t = p[-4] | p[-3] | p[-2] | p[-1]; + p += 4; + } ; /* Finish the last block of 128 unaligned. */ t |= _mm256_loadu_si256(buf + len - 4 * 32); t |= _mm256_loadu_si256(buf + len - 3 * 32); - last2: t |= _mm256_loadu_si256(buf + len - 2 * 32); t |= _mm256_loadu_si256(buf + len - 1 * 32); @@ -263,7 +255,7 @@ static void init_accel(unsigned cache) } if (cache & CACHE_AVX2) { fn = buffer_zero_avx2; - length_to_accel = 64; + length_to_accel = 128; } #endif #ifdef CONFIG_AVX512F_OPT From patchwork Thu Apr 2 19:06:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471323 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 383E492C for ; Thu, 2 Apr 2020 19:09:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0688920719 for ; Thu, 2 Apr 2020 19:09:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MD1xfAjG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0688920719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Do-0007hC-59 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:09:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33845) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B0-0002Tc-EL for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5Az-0000Mm-E2 for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:60464 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Az-0000Kn-9l for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FNt1Kfzuq9YitXxQvYRACSU9+bXSxIfVQgQnwMvCeoo=; b=MD1xfAjGklFkRrRViRpqDazgCG6Tq6hfGI7cjCFlWTlUpGDhq/QP3mNuZQVQn1QvTW3wRv mTjBYcamoPNb8MJVAi3hRj3g0BFb17HUBu+fqGI7Jm73uNT++qgLxws9Lr+yn0xBZcvEUR msWcqljxGg6I0HLaQpD01zfTd9o4f78= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-126-s0q8258vN-CVXAmsIA3Rpg-1; Thu, 02 Apr 2020 15:06:50 -0400 X-MC-Unique: s0q8258vN-CVXAmsIA3Rpg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 44C2D13F6 for ; Thu, 2 Apr 2020 19:06:49 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA22B89F0A; Thu, 2 Apr 2020 19:06:48 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/15] vl: fix broken IPA range for ARM -M virt with KVM enabled Date: Thu, 2 Apr 2020 15:06:33 -0400 Message-Id: <20200402190640.1693-9-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Commit a1b18df9a4848, broke virt_kvm_type() logic, which depends on maxram_size, ram_size, ram_slots being parsed/set on machine instance at the time accelerator (KVM) is initialized. set_memory_options() part was already reverted by commit 2a7b18a3205b, so revert remaining initialization of above machine fields to make virt_kvm_type() work as it used to. Signed-off-by: Igor Mammedov Reported-by: Auger Eric Reviewed-by: Eric Auger Tested-by: Eric Auger Message-Id: <20200326112829.19989-1-imammedo@redhat.com> Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 796a77e234..4f71ac10fd 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4137,6 +4137,9 @@ void qemu_init(int argc, char **argv, char **envp) machine_opts = qemu_get_machine_opts(); qemu_opt_foreach(machine_opts, machine_set_property, current_machine, &error_fatal); + current_machine->ram_size = ram_size; + current_machine->maxram_size = maxram_size; + current_machine->ram_slots = ram_slots; /* * Note: uses machine properties such as kernel-irqchip, must run @@ -4320,10 +4323,6 @@ void qemu_init(int argc, char **argv, char **envp) } } - current_machine->ram_size = ram_size; - current_machine->maxram_size = maxram_size; - current_machine->ram_slots = ram_slots; - parse_numa_opts(current_machine); if (machine_class->default_ram_id && current_machine->ram_size && From patchwork Thu Apr 2 19:06:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 058CC14DD for ; Thu, 2 Apr 2020 19:16:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEFEB206F8 for ; Thu, 2 Apr 2020 19:16:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MLk1pIlv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEFEB206F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5KJ-0008F2-08 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:16:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33902) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B2-0002V3-Dn for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B1-0000Rb-Er for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26966 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B1-0000Qf-BB for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5nHVcHcfWe51+/F45Sy6N9CFUeM4/arakR0i0s8GPLo=; b=MLk1pIlvCRo9Ti5x9gPTeRWoxe0A6tdVAQErka2M6Hf+Ki9Gmh3XKLZXKQ1Rnb/CFQiuRU zdO1NY7UkKbnfj7p22wFxXJN3GXJAQLH3O/2gU2kmHBDzW7vsn5GY0UWyJc8FcTH+bXMAe NdAvnPkfwC8kgxyJiqcBSShIL98QQSc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-tRmVu9sEPqSjiFsQbK0i2Q-1; Thu, 02 Apr 2020 15:06:51 -0400 X-MC-Unique: tRmVu9sEPqSjiFsQbK0i2Q-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB1ED107ACCA; Thu, 2 Apr 2020 19:06:49 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6899CDA0F2; Thu, 2 Apr 2020 19:06:49 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/15] i386: hvf: Reset IRQ inhibition after moving RIP Date: Thu, 2 Apr 2020 15:06:34 -0400 Message-Id: <20200402190640.1693-10-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , Cameron Esfahani Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Roman Bolshakov The sequence of instructions exposes an issue: sti hlt Interrupts cannot be delivered to hvf after hlt instruction cpu because HF_INHIBIT_IRQ_MASK is set just before hlt is handled and never reset after moving instruction pointer beyond hlt. So, after hvf_vcpu_exec() returns, CPU thread gets locked up forever in qemu_wait_io_event() (cpu_thread_is_idle() evaluates inhibition flag and considers the CPU idle if the flag is set). Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov Message-Id: <20200328174411.51491-1-r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini --- target/i386/hvf/vmx.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h index 03d2c79b9c..ce2a1532d5 100644 --- a/target/i386/hvf/vmx.h +++ b/target/i386/hvf/vmx.h @@ -167,6 +167,8 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4) static inline void macvm_set_rip(CPUState *cpu, uint64_t rip) { + X86CPU *x86_cpu = X86_CPU(cpu); + CPUX86State *env = &x86_cpu->env; uint64_t val; /* BUG, should take considering overlap.. */ @@ -176,6 +178,7 @@ static inline void macvm_set_rip(CPUState *cpu, uint64_t rip) val = rvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY); if (val & (VMCS_INTERRUPTIBILITY_STI_BLOCKING | VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)) { + env->hflags &= ~HF_INHIBIT_IRQ_MASK; wvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY, val & ~(VMCS_INTERRUPTIBILITY_STI_BLOCKING | VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)); From patchwork Thu Apr 2 19:06:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B780192C for ; Thu, 2 Apr 2020 19:10:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CB6720719 for ; Thu, 2 Apr 2020 19:10:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aq6rg2K3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CB6720719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5ES-0000OI-MP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:10:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33940) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B4-0002b0-BF for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B2-0000Ud-Vk for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:41368 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B2-0000RD-Ra for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UayyH5L3cRZEe5aAN8X8vb46906NYlR3VbPuC43zOEs=; b=aq6rg2K3vqBTi9SthiyY2KM9tgonnyH3mSwxTMPRJuihSERAFaaygQWipyLP9ACnkfAwE6 agHSyGSlxGjU6vYg9/oqMKvlNSi0IIlh6u/Q5EZYyLdRjDRJ1Qa1fa3kdKxH3z8hXQgR2d z8qEsu8QwZ7GvnXZjUVHUW4k9AErf2c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-qwJMkc0FOAWN9nWfuiXXCw-1; Thu, 02 Apr 2020 15:06:51 -0400 X-MC-Unique: qwJMkc0FOAWN9nWfuiXXCw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A6F5100550D for ; Thu, 2 Apr 2020 19:06:50 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D07750BEE; Thu, 2 Apr 2020 19:06:49 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/15] serial: Fix double migration data Date: Thu, 2 Apr 2020 15:06:35 -0400 Message-Id: <20200402190640.1693-11-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" After c9808d60281 we have both an object representing the serial-isa device and a separate object representing the underlying common serial uart. Both of these have vmsd's associated with them and thus the migration stream ends up with two copies of the migration data - the serial-isa includes the vmstate of the core serial. Besides being wrong, it breaks backwards migration compatibility. Fix this by removing the dc->vmsd from the core device, so it only gets migrated by any parent devices including it. Add a vmstate_serial_mm so that any device that uses serial_mm_init rather than creating a device still gets migrated. (That doesn't fix backwards migration for serial_mm_init users, but does seem to work forwards for ppce500). Fixes: c9808d60281 ('serial: realize the serial device') Buglink: https://bugs.launchpad.net/qemu/+bug/1869426 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200330164712.198282-1-dgilbert@redhat.com> Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- hw/char/serial.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 2ab8b69e03..c822a9ae6c 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1043,7 +1043,6 @@ static void serial_class_init(ObjectClass *klass, void* data) dc->user_creatable = false; dc->realize = serial_realize; dc->unrealize = serial_unrealize; - dc->vmsd = &vmstate_serial; device_class_set_props(dc, serial_properties); } @@ -1113,6 +1112,16 @@ static void serial_mm_realize(DeviceState *dev, Error **errp) sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq); } +static const VMStateDescription vmstate_serial_mm = { + .name = "serial", + .version_id = 3, + .minimum_version_id = 2, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(serial, SerialMM, 0, vmstate_serial, SerialState), + VMSTATE_END_OF_LIST() + } +}; + SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, @@ -1162,6 +1171,7 @@ static void serial_mm_class_init(ObjectClass *oc, void *data) device_class_set_props(dc, serial_mm_properties); dc->realize = serial_mm_realize; + dc->vmsd = &vmstate_serial_mm; } static const TypeInfo serial_mm_info = { From patchwork Thu Apr 2 19:06:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471337 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A70E4159A for ; Thu, 2 Apr 2020 19:11:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CDEA20719 for ; Thu, 2 Apr 2020 19:11:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SmV6VPC1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CDEA20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Fn-0002ly-MZ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33863) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B1-0002UT-9p for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B0-0000Pn-1G for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35926 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5Az-0000NA-Pf for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fyIXqJR9CGNVjmUsY7ssf4pvHmvsyrpi0UXASetzHqY=; b=SmV6VPC1caxvQexMLP44rUZ1QIohv8AQjBkMjxYRDqAL8olD63opvTovLRDzalzTLM4Cs7 DJtXV9o/6K8cs7ngQ+jy3MagOc7r+2mkCOJZCgbYwKG5qX79T3YmNUymTWa7GJpRfTpAVa yeXj7sE7K2nP8AKv7mO9odrpd0JeATI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-pbkzwwDtMymCfL4SaJkWFg-1; Thu, 02 Apr 2020 15:06:51 -0400 X-MC-Unique: pbkzwwDtMymCfL4SaJkWFg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB74A8017CE for ; Thu, 2 Apr 2020 19:06:50 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EBEE50BEE; Thu, 2 Apr 2020 19:06:50 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/15] target/i386: do not set unsupported VMX secondary execution controls Date: Thu, 2 Apr 2020 15:06:36 -0400 Message-Id: <20200402190640.1693-12-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vitaly Kuznetsov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vitaly Kuznetsov Commit 048c95163b4 ("target/i386: work around KVM_GET_MSRS bug for secondary execution controls") added a workaround for KVM pre-dating commit 6defc591846d ("KVM: nVMX: include conditional controls in /dev/kvm KVM_GET_MSRS") which wasn't setting certain available controls. The workaround uses generic CPUID feature bits to set missing VMX controls. It was found that in some cases it is possible to observe hosts which have certain CPUID features but lack the corresponding VMX control. In particular, it was reported that Azure VMs have RDSEED but lack VMX_SECONDARY_EXEC_RDSEED_EXITING; attempts to enable this feature bit result in QEMU abort. Resolve the issue but not applying the workaround when we don't have to. As there is no good way to find out if KVM has the fix itself, use 95c5c7c77c ("KVM: nVMX: list VMX MSRs in KVM_GET_MSR_INDEX_LIST") instead as these [are supposed to] come together. Fixes: 048c95163b4 ("target/i386: work around KVM_GET_MSRS bug for secondary execution controls") Suggested-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov Message-Id: <20200331162752.1209928-1-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 69eb43d796..4901c6dd74 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -106,6 +106,7 @@ static bool has_msr_arch_capabs; static bool has_msr_core_capabs; static bool has_msr_vmx_vmfunc; static bool has_msr_ucode_rev; +static bool has_msr_vmx_procbased_ctls2; static uint32_t has_architectural_pmu_version; static uint32_t num_architectural_pmu_gp_counters; @@ -490,21 +491,28 @@ uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index) value = msr_data.entries[0].data; switch (index) { case MSR_IA32_VMX_PROCBASED_CTLS2: - /* KVM forgot to add these bits for some time, do this ourselves. */ - if (kvm_arch_get_supported_cpuid(s, 0xD, 1, R_ECX) & CPUID_XSAVE_XSAVES) { - value |= (uint64_t)VMX_SECONDARY_EXEC_XSAVES << 32; - } - if (kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX) & CPUID_EXT_RDRAND) { - value |= (uint64_t)VMX_SECONDARY_EXEC_RDRAND_EXITING << 32; - } - if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & CPUID_7_0_EBX_INVPCID) { - value |= (uint64_t)VMX_SECONDARY_EXEC_ENABLE_INVPCID << 32; - } - if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & CPUID_7_0_EBX_RDSEED) { - value |= (uint64_t)VMX_SECONDARY_EXEC_RDSEED_EXITING << 32; - } - if (kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX) & CPUID_EXT2_RDTSCP) { - value |= (uint64_t)VMX_SECONDARY_EXEC_RDTSCP << 32; + if (!has_msr_vmx_procbased_ctls2) { + /* KVM forgot to add these bits for some time, do this ourselves. */ + if (kvm_arch_get_supported_cpuid(s, 0xD, 1, R_ECX) & + CPUID_XSAVE_XSAVES) { + value |= (uint64_t)VMX_SECONDARY_EXEC_XSAVES << 32; + } + if (kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX) & + CPUID_EXT_RDRAND) { + value |= (uint64_t)VMX_SECONDARY_EXEC_RDRAND_EXITING << 32; + } + if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & + CPUID_7_0_EBX_INVPCID) { + value |= (uint64_t)VMX_SECONDARY_EXEC_ENABLE_INVPCID << 32; + } + if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & + CPUID_7_0_EBX_RDSEED) { + value |= (uint64_t)VMX_SECONDARY_EXEC_RDSEED_EXITING << 32; + } + if (kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX) & + CPUID_EXT2_RDTSCP) { + value |= (uint64_t)VMX_SECONDARY_EXEC_RDTSCP << 32; + } } /* fall through */ case MSR_IA32_VMX_TRUE_PINBASED_CTLS: @@ -2060,6 +2068,9 @@ static int kvm_get_supported_msrs(KVMState *s) case MSR_IA32_UCODE_REV: has_msr_ucode_rev = true; break; + case MSR_IA32_VMX_PROCBASED_CTLS2: + has_msr_vmx_procbased_ctls2 = true; + break; } } } From patchwork Thu Apr 2 19:06:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471343 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5167492C for ; Thu, 2 Apr 2020 19:14:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2678920719 for ; Thu, 2 Apr 2020 19:14:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MoVqnkF9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2678920719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5I4-0005in-Az for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33884) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B1-0002Ue-VS for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B0-0000QU-Tm for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:44421 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B0-0000QA-PN for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hAHg1jLQ/+hiDQf0/HvgOsrR0/PB04onhEW2w2UkMdw=; b=MoVqnkF92RyvpYD7cVWZ3IobtnqSWoIy69jC5PMRivi/rb4u+IINZjSy4RlvXeAepZ9yCX 0/9tFnpnLbjSNefjEthwC7JBYWFGQpGXqDil/WBaGcVEyFCCgm+ERs3AJCCxHn3Xk0P+Xo oLrNDZO4R9NM80ZZxmOP0e3lHLND89g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-zvC6ni4wNgil-SYfJG3PEg-1; Thu, 02 Apr 2020 15:06:52 -0400 X-MC-Unique: zvC6ni4wNgil-SYfJG3PEg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B0E3100551A for ; Thu, 2 Apr 2020 19:06:51 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D0B550BEE; Thu, 2 Apr 2020 19:06:51 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/15] migration: fix cleanup_bh leak on resume Date: Thu, 2 Apr 2020 15:06:37 -0400 Message-Id: <20200402190640.1693-13-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Since commit 8c6b0356b53977bcfdea5299db07884915425b0c ("util/async: make bh_aio_poll() O(1)"), migration-test reveals a leak: QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 tests/qtest/migration-test -p /x86_64/migration/postcopy/recovery tests/qtest/libqtest.c:140: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) ================================================================= ==2082571==ERROR: LeakSanitizer: detected memory leaks Direct leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f25971dfc58 in __interceptor_malloc (/lib64/libasan.so.5+0x10dc58) #1 0x7f2596d08358 in g_malloc (/lib64/libglib-2.0.so.0+0x57358) #2 0x560970d006f8 in qemu_bh_new /home/elmarco/src/qemu/util/main-loop.c:532 #3 0x5609704afa02 in migrate_fd_connect /home/elmarco/src/qemu/migration/migration.c:3407 #4 0x5609704b6b6f in migration_channel_connect /home/elmarco/src/qemu/migration/channel.c:92 #5 0x5609704b2bfb in socket_outgoing_migration /home/elmarco/src/qemu/migration/socket.c:108 #6 0x560970b9bd6c in qio_task_complete /home/elmarco/src/qemu/io/task.c:196 #7 0x560970b9aa97 in qio_task_thread_result /home/elmarco/src/qemu/io/task.c:111 #8 0x7f2596cfee3a (/lib64/libglib-2.0.so.0+0x4de3a) Signed-off-by: Marc-André Lureau Message-Id: <20200325184723.2029630-2-marcandre.lureau@redhat.com> Reviewed-by: Juan Quintela Signed-off-by: Paolo Bonzini --- migration/migration.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index c4c9aee15e..187ac0410c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3478,7 +3478,12 @@ void migrate_fd_connect(MigrationState *s, Error *error_in) bool resume = s->state == MIGRATION_STATUS_POSTCOPY_PAUSED; s->expected_downtime = s->parameters.downtime_limit; - s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup_bh, s); + if (resume) { + assert(s->cleanup_bh); + } else { + assert(!s->cleanup_bh); + s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup_bh, s); + } if (error_in) { migrate_fd_error(s, error_in); migrate_fd_cleanup(s); From patchwork Thu Apr 2 19:06:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BF1E14DD for ; Thu, 2 Apr 2020 19:15:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01016206F8 for ; Thu, 2 Apr 2020 19:15:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="S9p25/vC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01016206F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5J5-0006ke-4k for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:15:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33895) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B2-0002Ug-4t for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B1-0000Qk-3w for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23211 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B1-0000QI-0J for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NPcScmOeOhS1CNjgYDmco4c2KEYNfVkIUVRESJAays8=; b=S9p25/vCxD5GXSH7AzOq/wvyM3cgs0n8nPM8Q8YNOgBDKRRdbYTAcVwtawiljxOvLqZHjH E7Bfb2Wx1x/zRV8fPTDc+nhgUgMwFkT9YWG5jICjJGx5jM/287tELumQI4vzFAPneAkNT2 D7SgoRg7ET2VNHDLZfO1TL21g46QPQM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-45-tj_EBB23PheOCByAjId5pA-1; Thu, 02 Apr 2020 15:06:52 -0400 X-MC-Unique: tj_EBB23PheOCByAjId5pA-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0797A1050940 for ; Thu, 2 Apr 2020 19:06:52 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E7EADA0F2; Thu, 2 Apr 2020 19:06:51 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/15] qmp: fix leak on callbacks that return both value and error Date: Thu, 2 Apr 2020 15:06:38 -0400 Message-Id: <20200402190640.1693-14-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Direct leak of 4120 byte(s) in 1 object(s) allocated from: #0 0x7fa114931887 in __interceptor_calloc (/lib64/libasan.so.6+0xb0887) #1 0x7fa1144ad8f0 in g_malloc0 (/lib64/libglib-2.0.so.0+0x588f0) #2 0x561e3c9c8897 in qmp_object_add /home/elmarco/src/qemu/qom/qom-qmp-cmds.c:291 #3 0x561e3cf48736 in qmp_dispatch /home/elmarco/src/qemu/qapi/qmp-dispatch.c:155 #4 0x561e3c8efb36 in monitor_qmp_dispatch /home/elmarco/src/qemu/monitor/qmp.c:145 #5 0x561e3c8f09ed in monitor_qmp_bh_dispatcher /home/elmarco/src/qemu/monitor/qmp.c:234 #6 0x561e3d08c993 in aio_bh_call /home/elmarco/src/qemu/util/async.c:136 #7 0x561e3d08d0a5 in aio_bh_poll /home/elmarco/src/qemu/util/async.c:164 #8 0x561e3d0a535a in aio_dispatch /home/elmarco/src/qemu/util/aio-posix.c:380 #9 0x561e3d08e3ca in aio_ctx_dispatch /home/elmarco/src/qemu/util/async.c:298 #10 0x7fa1144a776e in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x5276e) Signed-off-by: Marc-André Lureau Message-Id: <20200325184723.2029630-3-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- qapi/qmp-dispatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index c30c7ff9e1..79347e0864 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -155,6 +155,8 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, cmd->fn(args, &ret, &err); qobject_unref(args); if (err) { + /* or assert(!ret) after reviewing all handlers: */ + qobject_unref(ret); goto out; } From patchwork Thu Apr 2 19:06:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471339 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81A9392C for ; Thu, 2 Apr 2020 19:11:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57A3B20719 for ; Thu, 2 Apr 2020 19:11:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="X8ibEDN0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57A3B20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5Fo-0002od-Gb for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33922) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B3-0002Xh-7A for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B2-0000Su-3R for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:57 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22021 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B1-0000S9-Vz for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cgUCuiQImsO71G7idTK9arqrOSPOAEA79IR0k9B/Lbo=; b=X8ibEDN0T9BUfGnvIzruq8ImgjviqE3CETv5YuMI3+auHMf/Ex7+3Hp8wxs2MJFRmNsr+/ nPyMxYdrdXJ1vKvOJhH2VehCXfkhPej2LIvfnTWDCHKpGEsygrN+m5EBr85SDnaAWN01od qHBesv46NDdmPk6/Bd7Y1Oq2IOvb7Ew= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-8jS2BQlkMKyzO7HfZlNJXg-1; Thu, 02 Apr 2020 15:06:53 -0400 X-MC-Unique: 8jS2BQlkMKyzO7HfZlNJXg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71628108442D for ; Thu, 2 Apr 2020 19:06:52 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D53750BEE for ; Thu, 2 Apr 2020 19:06:52 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/15] object-add: don't create return value if failed Date: Thu, 2 Apr 2020 15:06:39 -0400 Message-Id: <20200402190640.1693-15-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" No need to return an empty value from object-add (it would also leak if the command failed). While at it, remove the "if" around object_unref since object_unref handles NULL arguments just fine. Reported-by: Marc-André Lureau Message-Id: <20200325184723.2029630-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- qom/qom-qmp-cmds.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 435193b036..e47ebe8ed1 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -285,10 +285,7 @@ void qmp_object_add(QDict *qdict, QObject **ret_data, Error **errp) v = qobject_input_visitor_new(QOBJECT(qdict)); obj = user_creatable_add_type(type, id, qdict, v, errp); visit_free(v); - if (obj) { - object_unref(obj); - } - *ret_data = QOBJECT(qdict_new()); + object_unref(obj); } void qmp_object_del(const char *id, Error **errp) From patchwork Thu Apr 2 19:06:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11471349 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4E381668 for ; Thu, 2 Apr 2020 19:17:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAF3920737 for ; Thu, 2 Apr 2020 19:17:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dj9NnzU3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAF3920737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5LI-0000nv-RX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Apr 2020 15:17:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33929) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5B3-0002Ym-H1 for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5B2-0000TF-Bl for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:57 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59942 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5B2-0000Rj-7j for qemu-devel@nongnu.org; Thu, 02 Apr 2020 15:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585854415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zv8TTUduTZlk08NL96V82mVLPiq6S4mbqrii21algvw=; b=dj9NnzU39+hZ5v00hwh4BPPefloXoeHtkxdDp3yJpPOjEfJHrnZomKvpQcBGtaxKgGE2r2 71FgOXHgIIWiLcVFpNCT1t2FbcRz7lOtt3+JHpUnSzQ10NDCNMNmVmhRUZ+klHgFghJY6e DkJVkhS3vVNqsUGAf5HBAbnPXiEjfD0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-mL_1fTygOniWNvDSlg7XWQ-1; Thu, 02 Apr 2020 15:06:53 -0400 X-MC-Unique: mL_1fTygOniWNvDSlg7XWQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2DF410509A0 for ; Thu, 2 Apr 2020 19:06:52 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9890D50BEE; Thu, 2 Apr 2020 19:06:52 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/15] xen: fixup RAM memory region initialization Date: Thu, 2 Apr 2020 15:06:40 -0400 Message-Id: <20200402190640.1693-16-pbonzini@redhat.com> In-Reply-To: <20200402190640.1693-1-pbonzini@redhat.com> References: <20200402190640.1693-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Since bd457782b3b0 ("x86/pc: use memdev for RAM") Xen machine fails to start with: qemu-system-i386: xen: failed to populate ram at 0 The reason is that xen_ram_alloc() which is called by memory_region_init_ram(), compares memory region with statically allocated 'global' ram_memory memory region that it uses for RAM, and does nothing in case it matches. While it's possible feed machine->ram to xen_ram_alloc() in the same manner to keep that hack working, I'd prefer not to keep that circular dependency and try to untangle that. However it doesn't look trivial to fix, so as temporary fixup opt out Xen machine from memdev based RAM allocation, and let xen_ram_alloc() do its trick for now. Reported-by: Anthony PERARD Signed-off-by: Igor Mammedov Message-Id: <20200402145418.5139-1-imammedo@redhat.com> Signed-off-by: Paolo Bonzini --- hw/xen/xen-common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 15650d7f6a..a15070f7f6 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -19,6 +19,7 @@ #include "sysemu/runstate.h" #include "migration/misc.h" #include "migration/global_state.h" +#include "hw/boards.h" //#define DEBUG_XEN @@ -151,6 +152,8 @@ static void xen_setup_post(MachineState *ms, AccelState *accel) static int xen_init(MachineState *ms) { + MachineClass *mc = MACHINE_GET_CLASS(ms); + xen_xc = xc_interface_open(0, 0, 0); if (xen_xc == NULL) { xen_pv_printf(NULL, 0, "can't open xen interface\n"); @@ -170,6 +173,10 @@ static int xen_init(MachineState *ms) return -1; } qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); + /* + * opt out of system RAM being allocated by generic code + */ + mc->default_ram_id = NULL; return 0; }