From patchwork Mon Mar 26 13:36:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UKAy2uxi"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wJS72Qcz9s32 for ; Tue, 27 Mar 2018 00:40:36 +1100 (AEDT) Received: from localhost ([::1]:56810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SMU-0000yP-F1 for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:40:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIw-0006UJ-E0 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIr-0006rJ-Ey for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:54 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:46543) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIr-0006r0-81 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:49 -0400 Received: by mail-wr0-x22f.google.com with SMTP id d1so6939212wrj.13 for ; Mon, 26 Mar 2018 06:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=VHUt9S1BX01kEGXKbhiG/gc2MO2GLXfPnTZEgdvmnXY=; b=UKAy2uxiVT6RG1E2FCsDQIg4KJIudHS3JzFsPS7cc2HJZsT9zr4zwD61XYCZa6X9SI atPUWti4I1tfxFMedmZds0anlX7tLzlSzlmlvl6MlKI6KBN9nnWlKRJSdL1Efa7Zi9jG icaRHW4r3c9esX25GwliIuJqFK5lzLLkmPewnVnmz596pfwxE22LZ7S3L+2YBadA1cCc nNcp0hS0IRdP6Vc7Izro9yFxoZixk9ziSBhPBGBmaOQZpWSa4tdrFsB5mRu8JibExSLw n1TGDJb8VEuXG8s/Ygm5yBszYePaWz9gPHN0IjAyna5z+tV9aaZMgtYOHHCL2gKYoFyt SvOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=VHUt9S1BX01kEGXKbhiG/gc2MO2GLXfPnTZEgdvmnXY=; b=MZAw0QYXtsZ0dOC7s+2CpjVoCI43gPZswr2e3QHIbQ+NrAD1s2BvNZNRu15Kn1I0Jv dv6Nak8OepdEB3p1IYBsG0AiwIVgIVRUldIBLqd7pG4MO/lN8jMsFFGAXxUGMNwS4K3D J7BAhgqWbfESKXeWRtCrHie0LYLmENVg0/1jH3lDzlboBcYU6yj9voVwVlppeuZA1W/P b54XxIibRnR/kCqP+ha7j4HnpGxjCegIX4sEu6DiIrThYrdt7tp+Tx/H+PFT7hD/+52N eHlBkWOxJ2/4sPh7qsfRY4qitADef57Yup2ySNdry66gauQYKxkPB6ZjKD9L38E3Y0eh uixw== X-Gm-Message-State: AElRT7F+F4LW6qAB+HokyAWY3WQmVJBn142UUk73laHtx2C2TDfz2pd2 hkPe8tCvOfS6lggn5+VbsUOCHnHv X-Google-Smtp-Source: AG47ELuB9eGmiwjE+bWWR4MxlwfmDtFxW46gK6l/fXLsV3YTc+JUwRYOP8kBZALtU5xat4Fx72wivw== X-Received: by 10.223.173.197 with SMTP id w63mr33326555wrc.83.1522071407673; Mon, 26 Mar 2018 06:36:47 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:28 +0200 Message-Id: <1522071403-52486-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22f Subject: [Qemu-devel] [PULL 01/16] scripts/get_maintainer.pl: Print proper error message for missing $file 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: Anthony PERARD , Thomas Huth , Stefano Stabellini , Ian Jackson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Ian Jackson If you pass scripts/get_maintainer.pl the name of a FIFO or other exciting object (/dev/stdin, for example), it would falsely print "file not found". Instead: stat the object rather than using -f so that we do not mind if the object is not a file; and print the errno value in the error message. Signed-off-by: Ian Jackson CC: Thomas Huth CC: Paolo Bonzini CC: Stefano Stabellini CC: Anthony PERARD Message-Id: <1520535787-6223-13-git-send-email-ian.jackson@eu.citrix.com> Signed-off-by: Paolo Bonzini Signed-off-by: Ian Jackson --- scripts/get_maintainer.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 07369aa..43fb5f5 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -381,8 +381,8 @@ foreach my $file (@ARGV) { ##if $file is a directory and it lacks a trailing slash, add one if ((-d $file)) { $file =~ s@([^/])$@$1/@; - } elsif (!(-f $file)) { - die "$P: file '${file}' not found\n"; + } elsif (!(stat $file)) { + die "$P: file '${file}' not found: $!\n"; } } if ($from_filename) { From patchwork Mon Mar 26 13:36:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ne5Haylm"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wFD1bQQz9s25 for ; Tue, 27 Mar 2018 00:37:50 +1100 (AEDT) Received: from localhost ([::1]:56797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJl-0006XP-RR for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:37:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIx-0006V5-CL for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIs-0006ru-Nk for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:55 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36589) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIs-0006rX-Ft for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:50 -0400 Received: by mail-wr0-x242.google.com with SMTP id d10so18956564wrf.3 for ; Mon, 26 Mar 2018 06:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3swAcFIlAUMChLIFP9bXEez25iDId2wjKpNdd+dyksE=; b=ne5Haylm2r9C+YpJPSpAg6x36OJukRDu0kq43JvkIqnwSlnsGjBMEfDTrWbCyVM+5z EmNN4tPncVNtGUc3Od/SPC+7hufaswL2oG3D89o3f+01GxdQmTnYRIq08rPdJvGljfSQ fapBjGCyw2hWvh5AH0zKXNR4wiqP/pakirplGmsZuflt1S03FyU9hnbZQn0t9NZKh5wd eT7I0iSPhj4zGCH+CsofUdyli4riLKDWeCioFzbNWKL9Nb4o1s402PZJe5WNdPSUsiRj 2OQPiuNyg/22PfdVj8HkOdWKrjEkvVkKcgafge1MmU4/onmKUQRsqrEQ2YD5GHMQG4Ll FPgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3swAcFIlAUMChLIFP9bXEez25iDId2wjKpNdd+dyksE=; b=kkCLT6deKJS/TgReLCJtCZbcnrMzv5GHcraFuM6WO2CYrHgsuIzvXbEkO+hW0WhewJ 9kgmbAt/2fQRNktKep7Iunk7sKZoz2J4Cn3qD/3v6XIfxWBFZ8SV4mylAia95Cj1U9eG r/Uc7cxAixNl7Ih3LAZ5SzsNqkF/iuzY4cxmLkjS5mLJmBnUkWLtRehuHES2gwu//Luc DMfVbZo6umNG7eVistUXOBsX2pwK4akDpmmFpgClVW7QR2F3lj74shZa1SPZSAURbq0b LonW+RLBJY449vC+1nTkUkmr+mA2UrSqk43wFV4OKGWBM4hA3Epy1XqEDPATocdYIRRO Lv3w== X-Gm-Message-State: AElRT7EvdUHE89mvh2amneft1NbKzBd8P4jF+CMo3/gLusGnmPCHDePG E26EJz12pOJrB4obMRRD2IEEa3nf X-Google-Smtp-Source: AG47ELvNGxhYnEAa4wLfgzA5S5D/Zrh2pfcgXpuI9lX55a8/tCJy27KfvJOAYKadxEqMgcdeBqeKFA== X-Received: by 10.223.141.162 with SMTP id o31mr32236384wrb.167.1522071409017; Mon, 26 Mar 2018 06:36:49 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:29 +0200 Message-Id: <1522071403-52486-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 02/16] WHPX fix WHvGetCapability out WrittenSizeInBytes 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: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Justin Terry (VM)" This fixes a breaking change to WHvGetCapability to include the 'out' WrittenSizeInBytes introduced in Windows Insider SDK 17110. This specifies on return the safe length to read into the WHV_CAPABILITY structure passed to the call. Signed-off-by: Justin Terry (VM) Message-Id: <1521039163-138-2-git-send-email-juterry@microsoft.com> Signed-off-by: Paolo Bonzini --- configure | 4 +++- target/i386/whpx-all.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 8376cb1..4d0e92c 100755 --- a/configure +++ b/configure @@ -2496,7 +2496,9 @@ if test "$whpx" != "no" ; then #include int main(void) { WHV_CAPABILITY whpx_cap; - WHvGetCapability(WHvCapabilityCodeFeatures, &whpx_cap, sizeof(whpx_cap)); + UINT32 writtenSize; + WHvGetCapability(WHvCapabilityCodeFeatures, &whpx_cap, sizeof(whpx_cap), + &writtenSize); return 0; } EOF diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 940bbe5..2080d58 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -1254,6 +1254,7 @@ static int whpx_accel_init(MachineState *ms) int ret; HRESULT hr; WHV_CAPABILITY whpx_cap; + UINT32 whpx_cap_size; WHV_PARTITION_PROPERTY prop; whpx = &whpx_global; @@ -1262,7 +1263,7 @@ static int whpx_accel_init(MachineState *ms) whpx->mem_quota = ms->ram_size; hr = WHvGetCapability(WHvCapabilityCodeHypervisorPresent, &whpx_cap, - sizeof(whpx_cap)); + sizeof(whpx_cap), &whpx_cap_size); if (FAILED(hr) || !whpx_cap.HypervisorPresent) { error_report("WHPX: No accelerator found, hr=%08lx", hr); ret = -ENOSPC; From patchwork Mon Mar 26 13:36:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XgFKoDTd"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wGC4tb3z9s25 for ; Tue, 27 Mar 2018 00:38:43 +1100 (AEDT) Received: from localhost ([::1]:56803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SKf-0007RN-6l for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:38:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIv-0006TD-9u for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIt-0006tS-Sf for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:53 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIt-0006s4-Ly for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:51 -0400 Received: by mail-wr0-x244.google.com with SMTP id z73so18974107wrb.0 for ; Mon, 26 Mar 2018 06:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Re3Io6EBGAuZii2NendGL6XdvSDYjEf6+aFU27H5YGs=; b=XgFKoDTdLPYNAcjQ52rZC+BFn3u9mkafzQoT+zkD4yoaG4kt5akfmeZkg3kDNt1sCp 2p+VGpkG3cjV0So1V3VHFSAdlNQkQF17fdFmezCELZCq+Kyr/koLhfKLtl8hWu7tVyV3 v9TDikPGGGOpzciaOrfWBw6ZL+bCSJ/U0e+cnraba/9SUwuQiNmMglGfLupz5Wc8S0+u 2eFTdOdh06xUOd+cIyxG1ha4jss7mGWEOraT00JhiJQhSeFkGARzvuiHvulo5Xcn+K1G +pt57UYdfYJoMzTkGIYrcVZoWaXn/Iz8SlKTXrEoOYHIB8ANOLP7LjyMwfk7YpS5X/uM xDUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Re3Io6EBGAuZii2NendGL6XdvSDYjEf6+aFU27H5YGs=; b=NCjomAJI+zYa3iNeQYRlwXVE4fWgCr/AfB0E9MqL0UabsludpbDIGHJ8uzzeUKnGjF oinz4oEsw/C4Lfd+O3bEMYPFuDohZ9xfJdH+ZLWP4U9dIX9X3V/CtBV8rFb3JMz5Sl/1 rWDXTa4H05MBiHtExewFtQbE4fJ60vW1vbdWSMFOQCFtN4+GyRYajCQ8N0CfQgafskeS KhaAYek24ODabDBmi9dXMkbROx2kYKZqxCkgwK31ytU3H8UkzYfv0kF+GEQBQ4zcR5gt 0FJtuB8UPrjcHyxUV41hbsjj4f+hF8n400DDzpfPJYZnmJ7FGR485nQutpvw2j5ma6j4 GprA== X-Gm-Message-State: AElRT7F5O6tNob0tdspxtrX5f7GSBuZWkMLRaTJhOGZFP97la/i9SMYj 9t48Lc/1Kdvl9aDZR1t8Yj2bxCpW X-Google-Smtp-Source: AG47ELvvBPrg8V95qTRWTNBd3T0E6s65YDn0WDvKvgXfYTNLWaFjzWK/Fdu1oENme7IDSaCzZ/ksSQ== X-Received: by 10.223.195.124 with SMTP id e57mr28990175wrg.135.1522071410200; Mon, 26 Mar 2018 06:36:50 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:30 +0200 Message-Id: <1522071403-52486-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 03/16] WHPX fix WHvSetPartitionProperty in PropertyCode 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: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Justin Terry (VM)" This fixes a breaking change to WHvSetPartitionProperty to pass the 'in' PropertyCode on function invocation introduced in Windows Insider SDK 17110. Usage of this indicates the PropertyCode of the opaque PropertyBuffer passed in on function invocation. Also fixes the removal of the PropertyCode parameter from the WHV_PARTITION_PROPERTY struct as it is now passed to the function directly. Signed-off-by: Justin Terry (VM) Message-Id: <1521039163-138-3-git-send-email-juterry@microsoft.com> Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 2080d58..63e6e1b 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -1278,9 +1278,9 @@ static int whpx_accel_init(MachineState *ms) } memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); - prop.PropertyCode = WHvPartitionPropertyCodeProcessorCount; prop.ProcessorCount = smp_cpus; hr = WHvSetPartitionProperty(whpx->partition, + WHvPartitionPropertyCodeProcessorCount, &prop, sizeof(WHV_PARTITION_PROPERTY)); From patchwork Mon Mar 26 13:36:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GxCIZJH+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wKW4zMmz9s02 for ; Tue, 27 Mar 2018 00:41:35 +1100 (AEDT) Received: from localhost ([::1]:56820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SNQ-0001rv-UQ for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:41:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIw-0006U6-95 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIu-0006us-U6 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:54 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIu-0006tl-NZ for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:52 -0400 Received: by mail-wr0-x241.google.com with SMTP id u11so6644474wri.12 for ; Mon, 26 Mar 2018 06:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4ELb+We8NVDSV4gdoXiNpvFWWTtOg/ieCG6QkY/NApc=; b=GxCIZJH+YVy5J0wjLj2EMELrg/dwI3bAvYk1chfBT3AWZTC6uteQg9fswKI7blhmnz kSBy3tbnXtEMXoDHzqWhdqk+XhBuDyhEFQEuvUMPS1B7qqmz2oQYyjWbAT0rs9rvU9lj +CY+1wzC6CBCLNWCaZnAdobKxQv9Glo0/T/pkF8MjcwIgTdRbQiowvRIa+YRTbKDW2pi 6K859H77d+Nx7JSSr4RXMkzd6RBRwZFJA+1BbbaFrFo7ufCYS9YzV5U5qbWE/KvkV5q+ oWmSSMh9bPM/ICB/aOdZVl5CUb5obS06a98x3KmueksztghZK40wUPB7vhULhgp5Qlku Y3sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4ELb+We8NVDSV4gdoXiNpvFWWTtOg/ieCG6QkY/NApc=; b=awhBAbyZrcl/yF0ZMRjEqlyPcAWFKs8fsq0Heuh8fNowksKZNQOQQzti56HJ9mHq+p pTVQ/bWpNyC+ErDEvRzSY/OrdHWnO2JIkjbKOu52/PxYxmH7U0W2UYNrnUixYFDS4s/R YqpwORy124+T5/DFKh0NB3AE8AE3yWmyak/wfZtKHF8xutEfyl9taMmosFgZxp4U6MGC ZY6vFF3z1Q6x5wGt7KQfy57mJ5QFUeKHAqXeNaKRgZWFYkHX05ettqIQaCPYNz8KtP/k 0iwuXGl47HQf9laHazYyQkIsmLIAAYYyEJUSDs1P5rxSVFs9dX/co7IDCJ/5AM2x6g0Z Xi7g== X-Gm-Message-State: AElRT7HA6QrPC73XIM1b00lsKEjjsd3qw8ANFJ5B4nZiZP3Gp84RT0ES 4UNPp+Pnn26CYIeCZxygeG/K+i8m X-Google-Smtp-Source: AG47ELvVJn+trjZWN9OpPmkqhc+9C9XynANz9/+NXoubhgNAMcDZmWodL3LGMHm8SSBrIp0Ya3mCgA== X-Received: by 10.223.181.149 with SMTP id c21mr17621875wre.233.1522071411273; Mon, 26 Mar 2018 06:36:51 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:31 +0200 Message-Id: <1522071403-52486-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 04/16] WHPX improve vcpu_post_run perf 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: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Justin Terry (VM)" This removes the additional call to WHvGetVirtualProcessorRegisters in whpx_vcpu_post_run now that the WHV_VP_EXIT_CONTEXT is returned in all WHV_RUN_VP_EXIT_CONTEXT structures. Signed-off-by: Justin Terry (VM) Message-Id: <1521039163-138-4-git-send-email-juterry@microsoft.com> Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 63e6e1b..bf33d32 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -153,7 +153,7 @@ struct whpx_vcpu { bool interruptable; uint64_t tpr; uint64_t apic_base; - WHV_X64_PENDING_INTERRUPTION_REGISTER interrupt_in_flight; + bool interruption_pending; /* Must be the last field as it may have a tail */ WHV_RUN_VP_EXIT_CONTEXT exit_ctx; @@ -695,7 +695,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); /* Inject NMI */ - if (!vcpu->interrupt_in_flight.InterruptionPending && + if (!vcpu->interruption_pending && cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; @@ -724,7 +724,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) } /* Get pending hard interruption or replay one that was overwritten */ - if (!vcpu->interrupt_in_flight.InterruptionPending && + if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { @@ -781,44 +781,25 @@ static void whpx_vcpu_pre_run(CPUState *cpu) static void whpx_vcpu_post_run(CPUState *cpu) { - HRESULT hr; - struct whpx_state *whpx = &whpx_global; struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); - WHV_REGISTER_VALUE reg_values[4]; - const WHV_REGISTER_NAME reg_names[4] = { - WHvX64RegisterRflags, - WHvX64RegisterCr8, - WHvRegisterPendingInterruption, - WHvRegisterInterruptState, - }; - hr = WHvGetVirtualProcessorRegisters(whpx->partition, cpu->cpu_index, - reg_names, 4, reg_values); - if (FAILED(hr)) { - error_report("WHPX: Failed to get interrupt state regusters," - " hr=%08lx", hr); - vcpu->interruptable = false; - return; - } + env->eflags = vcpu->exit_ctx.VpContext.Rflags; - assert(reg_names[0] == WHvX64RegisterRflags); - env->eflags = reg_values[0].Reg64; - - assert(reg_names[1] == WHvX64RegisterCr8); - if (vcpu->tpr != reg_values[1].Reg64) { - vcpu->tpr = reg_values[1].Reg64; + uint64_t tpr = vcpu->exit_ctx.VpContext.Cr8; + if (vcpu->tpr != tpr) { + vcpu->tpr = tpr; qemu_mutex_lock_iothread(); cpu_set_apic_tpr(x86_cpu->apic_state, vcpu->tpr); qemu_mutex_unlock_iothread(); } - assert(reg_names[2] == WHvRegisterPendingInterruption); - vcpu->interrupt_in_flight = reg_values[2].PendingInterruption; + vcpu->interruption_pending = + vcpu->exit_ctx.VpContext.ExecutionState.InterruptionPending; - assert(reg_names[3] == WHvRegisterInterruptState); - vcpu->interruptable = !reg_values[3].InterruptState.InterruptShadow; + vcpu->interruptable = + !vcpu->exit_ctx.VpContext.ExecutionState.InterruptShadow; return; } From patchwork Mon Mar 26 13:36:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KXqdjeF0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wKM0d9Tz9s34 for ; Tue, 27 Mar 2018 00:41:27 +1100 (AEDT) Received: from localhost ([::1]:56818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SNI-0001jh-Gi for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:41:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIx-0006Uv-8N for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIw-0006vY-3o for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:55 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:46793) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIv-0006v9-Sw for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:54 -0400 Received: by mail-wr0-x244.google.com with SMTP id d1so6939529wrj.13 for ; Mon, 26 Mar 2018 06:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=03HdpYWU6TXOnjjraCOYhYdMrrkMP5wuUKnwGJ5TQ/w=; b=KXqdjeF0OiSHp7vfm96KFocM0UaTe76N1cZpugJJ3I8aZrvKxOm3WsKN1UCkYu92Ea a4BZjWvQVgTL3I+QRvng16WXTBO/tczl5lYROxBR6hb/11kkQwzYuHV4nHTpV0dHSyby Ozf1xIKj/o/7GVtsX1L+Ri4P8E60atRPXdyVCNdRZGSiXsYWGrIXhmHaLvPmjpdrZTIK zmMj162sFpduEoGux6+Rufecu+rbjsWgTbaQzi/X+6xZbsdVlJkuctK2mld+/I8SnEOB AhmAwdztZmaN38MqSvol3Awdh8eXXxkbtKQLVMZYKbH0gnPq8Tnc1bWXtoGI7iJZO06T XZUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=03HdpYWU6TXOnjjraCOYhYdMrrkMP5wuUKnwGJ5TQ/w=; b=HyVxhtXVA3RNlX9vsCZpeZJHujOSyHqv6Y3cY+1gP6EPHEDeBNdu8VdtMudF4CcP1k hFs+EeW7IBqyLLkPJM1hDJtH4QNZ8UbtWzbnMxw9QPomeHNSSrV69Q0ismfcjVYLHJ4C ZxmCJN3bGcXsLuvpgFXLr3mQK7uQbrNmH7+OKCTdLMsurk68HMIHOZlVGyN8GmuHDbdP aDukSBWh42MHBux81ZpK6QhpN0k0/Asz0rQIy0qIvIceNbv/yCow0ftsTftYluen6yKw UI3i1b02JG9wR5CEDyWVyMIK38WdWxSeT7MeM68QC59CJIw9Fkqo9DiL6jRYFBfVSEJM Htfg== X-Gm-Message-State: AElRT7GVtK4qUQlHmi3T/xZlr1p1PvPleuXEkJs/YmR+x6r00DF9ZCE0 /+R4QdvajJ9IQSXN7SL8AtiVJoVV X-Google-Smtp-Source: AG47ELsHjt0syH8B51oTaDJ/B15kbf9q9DJ7zMvANtTzBVcH3PCBCaW5WfJ0ZOtwmDTOSAwbtKJjOg== X-Received: by 10.223.157.194 with SMTP id q2mr15833328wre.125.1522071412481; Mon, 26 Mar 2018 06:36:52 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:32 +0200 Message-Id: <1522071403-52486-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 05/16] hw/net/can: Fix segfaults when using the devices without bus 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: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth The CAN devices can currently be used to crash QEMU, e.g.: $ x86_64-softmmu/qemu-system-x86_64 -device kvaser_pci Segmentation fault (core dumped) So we've got to add a proper check here that the corresponding bus is available. Signed-off-by: Thomas Huth Message-Id: <1521193892-15552-2-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/net/can/can_sja1000.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 6293233..9a85038 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -866,6 +866,10 @@ int can_sja_connect_to_bus(CanSJA1000State *s, CanBusState *bus) { s->bus_client.info = &can_sja_bus_client_info; + if (!bus) { + return -EINVAL; + } + if (can_bus_insert_client(bus, &s->bus_client) < 0) { return -1; } From patchwork Mon Mar 26 13:36:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iwz20/gX"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wMg2d5Nz9s37 for ; Tue, 27 Mar 2018 00:43:25 +1100 (AEDT) Received: from localhost ([::1]:56827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SPB-0003Tk-DZ for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:43:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIy-0006WC-FQ for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIx-0006wJ-Eb for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:56 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:37959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIx-0006vx-8A for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:55 -0400 Received: by mail-wr0-x230.google.com with SMTP id m13so5631663wrj.5 for ; Mon, 26 Mar 2018 06:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xF4OXRE97Bekf3LqRamsuiecYwEwgwQPpx4n1FOH+io=; b=iwz20/gXYOysCOg7bVwxI+xbp+MXu0Z3MWnLf8g6qvuy+VLDC7q0KiyPi6q9pw90JO LIwzRGh3X+GhyWTo59XE4WEXFBPNk/7oDzkfqcRDmXFdWBUDwjbRQ6Q6bcNiF/2hQ4d5 XV8A3BwYC5kUoL1+rWygZihHizRs8PeUBljX8yUC/18i03FWA8nx3XfnVTpO823ch2Vm 2pieP5yz8Yko+8Za5W83I+szYk/gKmYVHeB68wvrdRXXvucVaCZeo3fnrFcbsJLkCiI5 ba0R8nc26awbKiOPX3KZnos/BDGqlXU93hR0Sm80bMCym7bUHGjzOSWaA+2Hl2TmZ3J3 2xQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xF4OXRE97Bekf3LqRamsuiecYwEwgwQPpx4n1FOH+io=; b=GpFC4c0eZA3z2m3npcK6QluaSG8eak6KWrMqAsQpgqanTO5YRFfPuh21h8XHT3YGxd SEDfpd3L6H/IJn2BGZv1WIPaHZy5wW3kYxwQMQNzWrQV3UB8UMycUrvQjisGFjtRKEga rtRiyP82KyVKK2oIge2OudKhmr+1wDr3WtxOEm2GIeXFIVWAjeIl/umAawrdESqVCNtI VM5mjq/kxZzUPWi+UR1PCuuIPFu5Xn/ibAw4NoNOskaFa+TcOFMRvAHCxeyBj5dwmdg9 8XBqQeQsN+8e2cmpafcCZUzsUsmIIWL/D7M/uJMfS7atP3g8XSN4smbrWsACWm3rFFb1 s5eA== X-Gm-Message-State: AElRT7GBKfzJFAA9/Z8IZivkYnksiCCTVlMu1yw3wYmh6FU1Ll7z4Fap /cLRXLVP+s7KTebxlnqFp7xucvj5 X-Google-Smtp-Source: AG47ELsnVd2B1eqZ0tv34HlAYdQTz0fAt2h75tjsyMHSmCr9khK7B+EEpxm0wiWhFJARrybyWGxi1Q== X-Received: by 10.223.153.177 with SMTP id y46mr29872334wrb.215.1522071413790; Mon, 26 Mar 2018 06:36:53 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:33 +0200 Message-Id: <1522071403-52486-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::230 Subject: [Qemu-devel] [PULL 06/16] fdc: Exit if ISA controller does not support DMA 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: Alexey Kardashevskiy , Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Alexey Kardashevskiy A "powernv" machine type defines an ISA bus but it does not add any DMA controller to it so it is possible to hit assert(fdctrl->dma) by adding "-machine powernv -device isa-fdc". This replaces assert() with an error message. Signed-off-by: Alexey Kardashevskiy [thuth: Slightly adjusted error message and updated scripts/device-crash-test] Signed-off-by: Thomas Huth Message-Id: <1521193892-15552-3-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/block/fdc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 7b7dd41..cd29e27 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2695,7 +2695,10 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp) fdctrl->dma_chann = isa->dma; if (fdctrl->dma_chann != -1) { fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma); - assert(fdctrl->dma); + if (!fdctrl->dma) { + error_setg(errp, "ISA controller does not support DMA"); + return; + } } qdev_set_legacy_instance_id(dev, isa->iobase, 2); From patchwork Mon Mar 26 13:36:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Wvt8QfwH"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wKX2dDLz9s2S for ; Tue, 27 Mar 2018 00:41:36 +1100 (AEDT) Received: from localhost ([::1]:56821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SNR-0001tO-NU for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:41:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ0-0006Xu-5N for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIy-0006x4-Rk for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:58 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:43527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIy-0006wg-Ha for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:56 -0400 Received: by mail-wr0-x243.google.com with SMTP id p53so11428468wrc.10 for ; Mon, 26 Mar 2018 06:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=TIQFbuBHF9W+q4sdZrhh18lOuYxxO6Y/bpkZr26XGiE=; b=Wvt8QfwHQUFtkqphyEKQ8xpbcRJPlyDEMdpAQ9Eh/SanNNOKvCrvcrJ3A/rfPvV/Ih l1I955qMkVWnrzG5A8m2HdqM3UDRyXTHjWkVdAF9Zc/9l/5aewUiAspnflMuhQltw2gB DmpJXG7jfue9Mcl6Z6RbzrtvbJ1eKCBa04BqsNEc7H/aWHGeWERYL8yLrJjcmuUXdm3N cEHhVzDTXTVOhlWG/DJ0arXL2mdUBREAno0htw4X085nNiV6k9rlaEjQUqtpdGKRAclL rLE9OTq+feVG/LmUuDbJT81DVF8dOqtfKtL+cZSJPpoHpirBznrxZJAQ0vsNQJdL+6V3 7KQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=TIQFbuBHF9W+q4sdZrhh18lOuYxxO6Y/bpkZr26XGiE=; b=t1HZBEWAPRT4MQOXN6S7mvJH9eLLD8WPPlLREf8Il4dSg/WQCkBdqTqwmRkIodu9h7 jZbD27KAf+I7XE5HTnumXGCvP4Jd11kQu7DeATjkbZPW3pVQIYW7GzU9hFYkyItK5gPK hbhtbBqBudK2u/cnJGSI2+XzldvPW1lYFPpa6kaedccZNdjDTodwkZjmjeAKHGz8hw6S yuIqhcjqSFhLExvCQZyVOc6YuZz/807m5YVDUjtvGCOzR1NRD0+dwmw7aIv3NoJttB8k JHKwd0ZEGUk9zlXU9czvfx0tEo6SQuSKGnqiEPjbEWvEzkZlbrVXtAuXJKxcJCuinEjz GNMA== X-Gm-Message-State: AElRT7FiteAqWKuvN2I6F/fw/Q1HLEPv/ILqs9IRVOU8CdT/bHBV2cLe xl84gez2zsJ0QFecAN14DkqcO+Av X-Google-Smtp-Source: AG47ELtm8R+Y4rdS46TSQuVgEcp0NPXtY3MXTTZNp57s6ohZaS3KrMclVrM1j2glqhbkyVBKK21MHw== X-Received: by 10.223.128.98 with SMTP id 89mr30719515wrk.141.1522071415097; Mon, 26 Mar 2018 06:36:55 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:34 +0200 Message-Id: <1522071403-52486-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 07/16] hw/audio: Fix crashes when devices are used on ISA bus without DMA 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: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth The cs4231a, gus and sb16 sound cards crash QEMU when the user tries to instantiate them on a machine with DMA-less ISA bus (for example with "qemu-system-mips64el -M mips -device sb16"). Add proper checks to the realize functions to avoid the crashes. Signed-off-by: Thomas Huth Message-Id: <1521193892-15552-4-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/audio/cs4231a.c | 8 +++++++- hw/audio/gus.c | 7 ++++++- hw/audio/sb16.c | 9 +++++++-- scripts/device-crash-test | 3 --- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 096e8e9..aaebec1 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -28,6 +28,7 @@ #include "hw/isa/isa.h" #include "hw/qdev.h" #include "qemu/timer.h" +#include "qapi/error.h" /* Missing features: @@ -663,8 +664,13 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp) CSState *s = CS4231A (dev); IsaDmaClass *k; - isa_init_irq (d, &s->pic, s->irq); s->isa_dma = isa_get_dma(isa_bus_from_device(d), s->dma); + if (!s->isa_dma) { + error_setg(errp, "ISA controller does not support DMA"); + return; + } + + isa_init_irq(d, &s->pic, s->irq); k = ISADMA_GET_CLASS(s->isa_dma); k->register_channel(s->isa_dma, s->dma, cs_dma_read, s); diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 3e864cd..8e0b27e 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -241,6 +241,12 @@ static void gus_realizefn (DeviceState *dev, Error **errp) IsaDmaClass *k; struct audsettings as; + s->isa_dma = isa_get_dma(isa_bus_from_device(d), s->emu.gusdma); + if (!s->isa_dma) { + error_setg(errp, "ISA controller does not support DMA"); + return; + } + AUD_register_card ("gus", &s->card); as.freq = s->freq; @@ -272,7 +278,6 @@ static void gus_realizefn (DeviceState *dev, Error **errp) isa_register_portio_list(d, &s->portio_list2, (s->port + 0x100) & 0xf00, gus_portio_list2, s, "gus"); - s->isa_dma = isa_get_dma(isa_bus_from_device(d), s->emu.gusdma); k = ISADMA_GET_CLASS(s->isa_dma); k->register_channel(s->isa_dma, s->emu.gusdma, GUS_read_DMA, s); s->emu.himemaddr = s->himem; diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 31de264..5a4d323 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1371,6 +1371,13 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) SB16State *s = SB16 (dev); IsaDmaClass *k; + s->isa_hdma = isa_get_dma(isa_bus_from_device(isadev), s->hdma); + s->isa_dma = isa_get_dma(isa_bus_from_device(isadev), s->dma); + if (!s->isa_dma || !s->isa_hdma) { + error_setg(errp, "ISA controller does not support DMA"); + return; + } + isa_init_irq (isadev, &s->pic, s->irq); s->mixer_regs[0x80] = magic_of_irq (s->irq); @@ -1389,11 +1396,9 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) isa_register_portio_list(isadev, &s->portio_list, s->port, sb16_ioport_list, s, "sb16"); - s->isa_hdma = isa_get_dma(isa_bus_from_device(isadev), s->hdma); k = ISADMA_GET_CLASS(s->isa_hdma); k->register_channel(s->isa_hdma, s->hdma, SB_read_DMA, s); - s->isa_dma = isa_get_dma(isa_bus_from_device(isadev), s->dma); k = ISADMA_GET_CLASS(s->isa_dma); k->register_channel(s->isa_dma, s->dma, SB_read_DMA, s); diff --git a/scripts/device-crash-test b/scripts/device-crash-test index f04f349..c1b2c78 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -218,10 +218,7 @@ ERROR_WHITELIST = [ {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'gus', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'sb16', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'cs4231a', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'machine':'isapc', 'device':'.*-iommu', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'mioe3680_pci', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'pcm3680_pci', 'loglevel':logging.ERROR, 'expected':True}, From patchwork Mon Mar 26 13:36:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="g9aPwQme"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wNW3Zy4z9s2S for ; Tue, 27 Mar 2018 00:44:11 +1100 (AEDT) Received: from localhost ([::1]:56830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SPx-0004Bb-0o for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:44:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ0-0006YU-KZ for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIz-0006xt-RL for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:58 -0400 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:36581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIz-0006x8-LJ for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:57 -0400 Received: by mail-wr0-x22d.google.com with SMTP id d10so18957035wrf.3 for ; Mon, 26 Mar 2018 06:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=O686HhgpWEvL06eoqpojHMBdgUK3mUIw00Ny7tH8pCI=; b=g9aPwQme9AE99cFpoazye+ogDkx0C1g/3riqrdIvkms6cKNMjORqKQgBXaBnjTnQFm 4jz22PPa4wbGL4eR98jZ9lDFSLrC8VMcM4xhUGIADxQZz8uVkAeaJgDnBUPpNLEOsiPe bujIOx+qh5ZLrOHQMXkiLKWwp5bS7iCEDp8nrCnLTjbEL9nobjDY69pfFmWZjUkhZ2hr cs+z/q9BiH/Q/Ny1ApBtS1YHJe6+ofH7lUv6xfYy95NuOWJAEk5Xvolm0iIJk6qkuJIH T23f4bstmC4OJDwDI2l1anI205jGm7vQlQYQ4fMYfF0UdpN+FBd6/eT9jjfNO4c03M0y Szig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=O686HhgpWEvL06eoqpojHMBdgUK3mUIw00Ny7tH8pCI=; b=sjz9ky5xvmR+LmDjWraK5IkUVs8nkS2afape/TTJnXGQ6FYiT8ikQtGq68co2bgzOV pIZ9tMhtyPuwZCKuTT58DbWsTUhXd+5AQOgUjaQoykxxj6esNaxCDB1+j9uH9Sp5e2O8 GTGzEMfbTHZAbhy6Gybs+Dc8KgcEq8hSRKPA3GS879Kw5krYRePWxJT/XtOaPbcM+/JI ibfBoXX6xMhD7NwqEa/NPPRa82+0+lLkvvSboUUEzdyb9+EtxkkFs7gHzk7+r64FzGiQ +EO5LuDNDvWRK5l+3a/Kj4GFSbvK2DiBikJYDh/NDPpMVF7co7kxSInjgooafM914DnC LPbQ== X-Gm-Message-State: AElRT7E4H/8OBxLn2NtxidKcde2TkKMKSl91iDBpLHIpqnyg5P48LfYB E4y+1tozmg6vfk+P/wjd4UqWZEN9 X-Google-Smtp-Source: AG47ELvlEaAdmhasD2rD0BZ9PiWPEe/oU0FwSpXyfc9dcOha59MZYJo0EeQcgGYmLuZjuZWbaW7bww== X-Received: by 10.223.181.149 with SMTP id c21mr17622171wre.233.1522071416186; Mon, 26 Mar 2018 06:36:56 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:35 +0200 Message-Id: <1522071403-52486-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22d Subject: [Qemu-devel] [PULL 08/16] scripts/device-crash-test: Remove fixed isapc-with-iommu entry 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: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Fixed in a0c167a18470831e359f0538c3cf67907808f13e ("x86_iommu: check if machine has PCI bus"). Signed-off-by: Thomas Huth Message-Id: <1521193892-15552-5-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/device-crash-test | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/device-crash-test b/scripts/device-crash-test index c1b2c78..24c7bf5 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -219,7 +219,6 @@ ERROR_WHITELIST = [ {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'machine':'isapc', 'device':'.*-iommu', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'mioe3680_pci', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'pcm3680_pci', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'kvaser_pci', 'loglevel':logging.ERROR, 'expected':True}, From patchwork Mon Mar 26 13:36:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="X1PqXpCI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wRq18xTz9s3C for ; Tue, 27 Mar 2018 00:47:03 +1100 (AEDT) Received: from localhost ([::1]:56849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SSi-000730-JT for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:47:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ6-0006eH-3z for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ1-0006yj-2u for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:04 -0400 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:35308) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ0-0006yC-Ru for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:59 -0400 Received: by mail-wr0-x22d.google.com with SMTP id 80so17868393wrb.2 for ; Mon, 26 Mar 2018 06:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qfu6ohp9V5N+EXDJQvXxDMVLheLeknDB4u2J6RAdeR8=; b=X1PqXpCIgs7hX3yGqmLcbsg/I7mW35wqY3eytiShI5VVbFCf/JjFax6Cl8H0xP3uRy mmNCQgyDSbLj1f+horRoRok8BCUN0dntQUZxCfixLkr7H/czDAkuZ8nImGrMOswoSxGx c61gKqBv/AtgO4r5/IbMeJtiK9hjHZYsKBBMdapVGEEE/2aKgFAItKx95yzfOYfVi8/s Fks2J4N6IiG7P7pj7ZTDC5HBl5eECyn6ZAKxZUosYYboKdnVMQ9g9A9hgCSQC/R3O8ji SZwnW5aKV7C9jz9+DyzUnKvaPlQ1KKW/gD7ZyDw4q54LuKWFW6cAED6BcEMvfzR+a3vn xJgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qfu6ohp9V5N+EXDJQvXxDMVLheLeknDB4u2J6RAdeR8=; b=G+RwV39art+m86a8g7wUQn2+oTJGVPaENtwjpm/vJIqbbZEPwHHqDHKPuQU5/+DsCA iHxV5LnEyzjgb20iXukMuccya4SEIpqv7R/PsB3NRBdoMEgZLxr0MNhT7hFwS+5IDAhq uR3bDeiRVVzTqT0jNKESdc5K+JXlNHP0QTx0UmU/XNio4WLLUkOJ6fj0jljgYSbOoepA SA4hoQ7EAiW/RCM4u/RLNbbrjNmXpFRxsLzVR7SHGK6SO6Ibzx3tgPFUar950ps/+KFN pV+yDMXDNcObw609DfX2fdMdQX63LvZ7QamSxOsKQnvDImm729Akh0YHdt++OHx8wMxp g0xg== X-Gm-Message-State: AElRT7Hp3sPwjs5PG5+3VreMkHnlJjNJ1fOp1iSxuYQHfTmuxr0bUaJM 0/6PfJbWtpeBMIm3lH6TVF6VethK X-Google-Smtp-Source: AG47ELuBAjhBrknIUXTg1cKXvDS99FGFQrzOzz76NxwPXZwKnZTQFZQx6f/H3hCzSp5qmdCZwtyzOg== X-Received: by 10.223.156.210 with SMTP id h18mr8508817wre.109.1522071417468; Mon, 26 Mar 2018 06:36:57 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:36 +0200 Message-Id: <1522071403-52486-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22d Subject: [Qemu-devel] [PULL 09/16] vhost-user-test: do not hang if chardev creation failed 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Before the chardev name fix, the following error may happen: "attempt to add duplicate property 'chr-test' to object (type 'container')", due to races. Sadly, error_vprintf() uses g_test_message(), so you have to use read the cryptic --debug-log to see it. Later, it would make sense to use g_critical() instead, and catch errors with g_test_expect_message() (in glib 2.34). Signed-off-by: Marc-André Lureau Message-Id: <20180215212552.26997-5-marcandre.lureau@redhat.com> Acked-by: Maxime Coquelin Signed-off-by: Paolo Bonzini --- tests/vhost-user-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 22e9202..f87afee 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -494,6 +494,7 @@ static void test_server_create_chr(TestServer *server, const gchar *opt) chr = qemu_chr_new(server->chr_name, chr_path); g_free(chr_path); + g_assert_nonnull(chr); qemu_chr_fe_init(&server->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&server->chr, chr_can_read, chr_read, chr_event, NULL, server, NULL, true); From patchwork Mon Mar 26 13:36:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YrBdBM0+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wbS2Vznz9s32 for ; Tue, 27 Mar 2018 00:53:38 +1100 (AEDT) Received: from localhost ([::1]:56898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SZ5-0004AK-23 for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:53:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ8-0006gl-Hw for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ2-0006zh-Do for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:06 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35029) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ2-0006yz-4b for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:00 -0400 Received: by mail-wm0-x242.google.com with SMTP id r82so15632134wme.0 for ; Mon, 26 Mar 2018 06:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qEQ+rSZ6SKo8Kg4igBsc8Gyi3/AT/KO68RVHiErHA2o=; b=YrBdBM0+062PnTiSMjJOeRhHrnMJHfRV5FI47arP4edb8DdOIWpHKp3zErze24utJK vxk4HRLdrzOupszDlJh/RchTvaiKr4xqR2/yGYUJcCHLRJGeKHAmB0T78pqyIzt4dB1Z jMir+9UfD7bxcw5eZLLNsgS/ASOALI5pDqJwJ/JKueSj0ikR7g3NRpk8qcrUTVlrlf25 AcTulZmJh5+yZ6ECr2NAAB59aLx7z544rFVUKsDeET6OmXcoMcoZmUGDI91YJHBeSdBJ 4oQ678J6is0NaCeicF4AEzNT1zjffdIdSvjy5YWOR9ITo86GLAgiY/2dh4EGDVDy9RKk Tmhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qEQ+rSZ6SKo8Kg4igBsc8Gyi3/AT/KO68RVHiErHA2o=; b=kcUFnOhO/tuiTQoFl72APQZIk1LhtiuCJZZjg6L0VECpyCrJPzMABhvSAhfTpKuhFV IVppuvd9tJqQ0TTeACnRC8Dc9veLJ5rBNA7Z9zTcY+tozbwsJj13s8OTdxMxeqB7hFZu CbCnFSXquoklvFZsV6Dq1CGCm6f9STsNpwCWnF/RpWvPbH9c1PWGJPfgv3aIJBCUq/Wm yWHKideD4ZLMkCTDxcocOdQw4wwqN/o4Is1XdU0EWEExb8em1XL9uAaRnQphZm1u52fe wHkRpjBE1xLpjuHyhvGVvY1126b2eO4ImyPEAg+xhEvkWGW6oS5dk3zv4oZoktiuq9G7 T+NA== X-Gm-Message-State: AElRT7FqzJrJ8T2l6YRBK2eVP75A5EkwqCeY4qVjbjgmpREyB39Wz+ZU 2/uOM+56it2MOyTbgRQRbMFbmGEl X-Google-Smtp-Source: AG47ELux1aS4wabuqqhjQDJDeoBYnwVUZWQtGo3JRxnA5qXYlT6P38R8aQVCC5ZBZQR3uhs9mRhgUQ== X-Received: by 10.28.135.9 with SMTP id j9mr9437306wmd.68.1522071418551; Mon, 26 Mar 2018 06:36:58 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:37 +0200 Message-Id: <1522071403-52486-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 10/16] vhost-user-test: add back memfd check 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau This revert commit fb68096da3d35e64c88cd610c1fa42766c58e92a, and modify test_read_guest_mem() to use different chardev names, when using memfd (_test_server_free(), where the chardev is removed, runs in idle). Signed-off-by: Marc-André Lureau Message-Id: <20180215212552.26997-4-marcandre.lureau@redhat.com> Acked-by: Maxime Coquelin Signed-off-by: Paolo Bonzini --- tests/vhost-user-test.c | 93 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 27 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index f87afee..61d9972 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -18,6 +18,7 @@ #include "qemu/range.h" #include "qemu/sockets.h" #include "chardev/char-fe.h" +#include "qemu/memfd.h" #include "sysemu/sysemu.h" #include "libqos/libqos.h" #include "libqos/pci-pc.h" @@ -40,23 +41,14 @@ #define HAVE_MONOTONIC_TIME #endif -#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM,"\ +#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM," \ "mem-path=%s,share=on -numa node,memdev=mem" +#define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM," \ + " -numa node,memdev=mem" #define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=%s,vhostforce" #define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0" -#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \ - QEMU_CMD_NETDEV QEMU_CMD_NET - -#define GET_QEMU_CMD(s) \ - g_strdup_printf(QEMU_CMD, 512, 512, (root), (s)->chr_name, \ - (s)->socket_path, "", (s)->chr_name) - -#define GET_QEMU_CMDE(s, mem, chr_opts, extra, ...) \ - g_strdup_printf(QEMU_CMD extra, (mem), (mem), (root), (s)->chr_name, \ - (s)->socket_path, (chr_opts), (s)->chr_name, ##__VA_ARGS__) - #define HUGETLBFS_MAGIC 0x958458f6 /*********** FROM hw/virtio/vhost-user.c *************************************/ @@ -175,6 +167,33 @@ static void test_server_listen(TestServer *server); static const char *tmpfs; static const char *root; +enum test_memfd { + TEST_MEMFD_AUTO, + TEST_MEMFD_YES, + TEST_MEMFD_NO, +}; + +static char *get_qemu_cmd(TestServer *s, + int mem, enum test_memfd memfd, const char *mem_path, + const char *chr_opts, const char *extra) +{ + if (memfd == TEST_MEMFD_AUTO && qemu_memfd_check()) { + memfd = TEST_MEMFD_YES; + } + + if (memfd == TEST_MEMFD_YES) { + return g_strdup_printf(QEMU_CMD_MEMFD QEMU_CMD_CHR + QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, + s->chr_name, s->socket_path, + chr_opts, s->chr_name, extra); + } else { + return g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR + QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, + mem_path, s->chr_name, s->socket_path, + chr_opts, s->chr_name, extra); + } +} + static void init_virtio_dev(TestServer *s, uint32_t features_mask) { uint32_t features; @@ -641,16 +660,18 @@ GSourceFuncs test_migrate_source_funcs = { .check = test_migrate_source_check, }; -static void test_read_guest_mem(void) +static void test_read_guest_mem(const void *arg) { + enum test_memfd memfd = GPOINTER_TO_INT(arg); TestServer *server = NULL; char *qemu_cmd = NULL; QTestState *s = NULL; - server = test_server_new("test"); + server = test_server_new(memfd == TEST_MEMFD_YES ? + "read-guest-memfd" : "read-guest-mem"); test_server_listen(server); - qemu_cmd = GET_QEMU_CMD(server); + qemu_cmd = get_qemu_cmd(server, 512, memfd, root, "", ""); s = qtest_start(qemu_cmd); g_free(qemu_cmd); @@ -672,7 +693,7 @@ static void test_migrate(void) char *uri = g_strdup_printf("%s%s", "unix:", dest->mig_path); QTestState *global = global_qtest, *from, *to; GSource *source; - gchar *cmd; + gchar *cmd, *tmp; QDict *rsp; guint8 *log; guint64 size; @@ -680,7 +701,7 @@ static void test_migrate(void) test_server_listen(s); test_server_listen(dest); - cmd = GET_QEMU_CMDE(s, 2, "", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, "", ""); from = qtest_start(cmd); g_free(cmd); @@ -689,7 +710,9 @@ static void test_migrate(void) size = get_log_size(s); g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)); - cmd = GET_QEMU_CMDE(dest, 2, "", " -incoming %s", uri); + tmp = g_strdup_printf(" -incoming %s", uri); + cmd = get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, root, "", tmp); + g_free(tmp); to = qtest_init(cmd); g_free(cmd); @@ -802,7 +825,7 @@ static void test_reconnect_subprocess(void) char *cmd; g_thread_new("connect", connect_thread, s); - cmd = GET_QEMU_CMDE(s, 2, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -840,7 +863,7 @@ static void test_connect_fail_subprocess(void) s->test_fail = true; g_thread_new("connect", connect_thread, s); - cmd = GET_QEMU_CMDE(s, 2, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -870,7 +893,7 @@ static void test_flags_mismatch_subprocess(void) s->test_flags = TEST_FLAGS_DISCONNECT; g_thread_new("connect", connect_thread, s); - cmd = GET_QEMU_CMDE(s, 2, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -905,11 +928,21 @@ static void test_multiqueue(void) s->queues = 2; test_server_listen(s); - cmd = g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d " - "-device virtio-net-pci,netdev=net0,mq=on,vectors=%d", - 512, 512, root, s->chr_name, - s->socket_path, "", s->chr_name, - s->queues, s->queues * 2 + 2); + if (qemu_memfd_check()) { + cmd = g_strdup_printf( + QEMU_CMD_MEMFD QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d " + "-device virtio-net-pci,netdev=net0,mq=on,vectors=%d", + 512, 512, s->chr_name, + s->socket_path, "", s->chr_name, + s->queues, s->queues * 2 + 2); + } else { + cmd = g_strdup_printf( + QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d " + "-device virtio-net-pci,netdev=net0,mq=on,vectors=%d", + 512, 512, root, s->chr_name, + s->socket_path, "", s->chr_name, + s->queues, s->queues * 2 + 2); + } qtest_start(cmd); g_free(cmd); @@ -955,7 +988,13 @@ int main(int argc, char **argv) /* run the main loop thread so the chardev may operate */ thread = g_thread_new(NULL, thread_function, loop); - qtest_add_func("/vhost-user/read-guest-mem", test_read_guest_mem); + if (qemu_memfd_check()) { + qtest_add_data_func("/vhost-user/read-guest-mem/memfd", + GINT_TO_POINTER(TEST_MEMFD_YES), + test_read_guest_mem); + } + qtest_add_data_func("/vhost-user/read-guest-mem/memfile", + GINT_TO_POINTER(TEST_MEMFD_NO), test_read_guest_mem); qtest_add_func("/vhost-user/migrate", test_migrate); qtest_add_func("/vhost-user/multiqueue", test_multiqueue); From patchwork Mon Mar 26 13:36:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="n6ls8pmd"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wNg3PYSz9s2S for ; Tue, 27 Mar 2018 00:44:19 +1100 (AEDT) Received: from localhost ([::1]:56833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SQ4-0004Kq-WA for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:44:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ6-0006eF-3G for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ3-00070R-Ce for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:04 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:42063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ3-0006zw-5g for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:01 -0400 Received: by mail-wr0-x22f.google.com with SMTP id s18so18939419wrg.9 for ; Mon, 26 Mar 2018 06:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=qL2bgJJbnk3TW1qAwN/FJhCE59hJkf/wNPD7z2Wp0EU=; b=n6ls8pmdrBe8qB78YLccMLzD/C8abC8XUNIR7783RoQRH6+Lk2/ZJttWLpQBt092Vk ifUtmuW7FrFsVkFV3UxYkDUTAcAzhGKossolRZBZ1DErkWk6x28FdGpnDmQEXDbzPF9G UW5FPrnJz6pIcg39hBkQ8A2PqcbxE/fRJR0Fc5c0juv+w0xLEhjfFJ/rLNx6nUkTTgWb wnkFkE7N9ABAkfexvw1U3l7m0Rdp7oGbOy8wj80hWlZSfaWlL1iYSECTvfoUy5kYdrfU t/bg8j366Habf/SwX/tHdBR5hw3A6fE2AHQ4U+oveTlGGcZaq6Fb/g8l4yypv4dk/vtM 7STw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qL2bgJJbnk3TW1qAwN/FJhCE59hJkf/wNPD7z2Wp0EU=; b=KNzzuXw1EPRFfqi9/WmP/tzPPoEzhLj+kbMK5PrAqBYPSPSg2FB2KKaT/lTDE4/U+D N5MtyveBKEEwAVObjuHc31qjwtLZKw3jNX1Q8ZhiaykojmDpZpwQ7C4v34O61h4suCtC 8WLgKAzXU9d92icg/Ljz0Jakv0UC3Rxm1ABOEWXWR5fPPovHzhpuhTuqsNcmqFvvyE0o qWVB6v//2Y1fcqZm+c8L9Ayw7r9omYg/YNMmgf0ldPgOQV5SSyeakH8MTUOEBzpKJNXr s/ojIL9sW5NHc0d9F8vNK6D3P7xQAjhbgYy4jDIYRwdgPH6dPj2S3AB6k1r3J3HI5isX gp9g== X-Gm-Message-State: AElRT7EHOpFGeKQm8fBv/mUTQ8LZgPOOYrm8Bq4w+AOxPY3gsIux/9I7 Ee47+PIPpWwXx8w8P79eQk4xg090 X-Google-Smtp-Source: AG47ELs61AwogIaY3gdehHPrgVfKdYb5IeKtUqFRPvigxF3UJQN2plR8jJwEM+afpIVvx3SL+vY87Q== X-Received: by 10.223.176.7 with SMTP id f7mr30161240wra.257.1522071419662; Mon, 26 Mar 2018 06:36:59 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:38 +0200 Message-Id: <1522071403-52486-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22f Subject: [Qemu-devel] [PULL 11/16] tcg: Really fix cpu_io_recompile 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: Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We have confused the number of instructions that have been executed in the TB with the number of instructions needed to repeat the I/O instruction. We have used cpu_restore_state_from_tb, which means that the guest pc is pointing to the I/O instruction. The only time the answer to the later question is not 1 is when MIPS or SH4 need to re-execute the branch for the delay slot as well. We must rely on cpu->cflags_next_tb to generate the next TB, as otherwise we have a race condition with other guest cpus within the TB cache. Fixes: 0790f86861079b1932679d0f011e431aaf4ee9e2 Signed-off-by: Richard Henderson Message-Id: <20180319031545.29359-1-richard.henderson@linaro.org> Tested-by: Pavel Dovgalyuk Signed-off-by: Paolo Bonzini --- accel/tcg/translate-all.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5ad1b91..d419060 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1728,8 +1728,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) CPUArchState *env = cpu->env_ptr; #endif TranslationBlock *tb; - uint32_t n, flags; - target_ulong pc, cs_base; + uint32_t n; tb_lock(); tb = tb_find_pc(retaddr); @@ -1737,44 +1736,33 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_abort(cpu, "cpu_io_recompile: could not find TB for pc=%p", (void *)retaddr); } - n = cpu->icount_decr.u16.low + tb->icount; cpu_restore_state_from_tb(cpu, tb, retaddr); - /* Calculate how many instructions had been executed before the fault - occurred. */ - n = n - cpu->icount_decr.u16.low; - /* Generate a new TB ending on the I/O insn. */ - n++; + /* On MIPS and SH, delay slot instructions can only be restarted if they were already the first instruction in the TB. If this is not the first instruction in a TB then re-execute the preceding branch. */ + n = 1; #if defined(TARGET_MIPS) - if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) { + if ((env->hflags & MIPS_HFLAG_BMASK) != 0 + && env->active_tc.PC != tb->pc) { env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); cpu->icount_decr.u16.low++; env->hflags &= ~MIPS_HFLAG_BMASK; + n = 2; } #elif defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 - && n > 1) { + && env->pc != tb->pc) { env->pc -= 2; cpu->icount_decr.u16.low++; env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); + n = 2; } #endif - /* This should never happen. */ - if (n > CF_COUNT_MASK) { - cpu_abort(cpu, "TB too big during recompile"); - } - pc = tb->pc; - cs_base = tb->cs_base; - flags = tb->flags; - tb_phys_invalidate(tb, -1); - - /* Execute one IO instruction without caching - instead of creating large TB. */ - cpu->cflags_next_tb = curr_cflags() | CF_LAST_IO | CF_NOCACHE | 1; + /* Generate a new TB executing the I/O insn. */ + cpu->cflags_next_tb = curr_cflags() | CF_LAST_IO | n; if (tb->cflags & CF_NOCACHE) { if (tb->orig_tb) { @@ -1785,11 +1773,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) tb_remove(tb); } - /* Generate new TB instead of the current one. */ - /* FIXME: In theory this could raise an exception. In practice - we have already translated the block once so it's probably ok. */ - tb_gen_code(cpu, pc, cs_base, flags, curr_cflags() | CF_LAST_IO | n); - /* TODO: If env->pc != tb->pc (i.e. the faulting instruction was not * the first in the TB) then we end up generating a whole new TB and * repeating the fault, which is horribly inefficient. From patchwork Mon Mar 26 13:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HXySBJE8"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wQk1LCRz9s2S for ; Tue, 27 Mar 2018 00:46:06 +1100 (AEDT) Received: from localhost ([::1]:56847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SRn-0006JS-MH for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:46:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ6-0006eG-3I for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ4-000717-Dv for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:04 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ4-00070Z-6z for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:02 -0400 Received: by mail-wr0-x244.google.com with SMTP id z73so18974742wrb.0 for ; Mon, 26 Mar 2018 06:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7KJolCclQXwqcr6uM4TeqD0TaBMUGaqXmpwkslGS+ek=; b=HXySBJE83xJHUKKnRVI0hP2d7t2+ebbxVrc4hPL58+1nvya5qCTwTiubLe5KVHY3Se Vz72iyyyju8QcAzAvN/41v8odDzX/kxSA7NwygepX+osqTQRt5w1yG+lXSj7ohF6NdHf tJN/NhbzuiG57C9zXmfVDLmRjoICV+dw66Txfa1LUqpGEkKcrtNsk1RuUZrI5YBrvCaO KfPb0O7WPvSITwxpjOUvpBHOKHaVVnmtn69fosPTu1EWrcvTkK0pHs8g8c8fWR/lL8ie qGCkaluLDxfVsCag5FVUciJ0S6OEnLyS9lfYGP6YQVYh8Y9TP6E2uoAcgqksjO5dtH/o hPLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7KJolCclQXwqcr6uM4TeqD0TaBMUGaqXmpwkslGS+ek=; b=T+BmRMbw1T60Rj7cguLrTEfzhLUhS2vI9ds2WEOgtB5nEuqGNpG0rIoNy7dO7HuEqU wbZ0g1hIVgCAbPs2Qzf+uParoDHASPNRVOou76S4CO3+lAOIUy5L3BATJeCqzF8FulWR HlZhsw0ESsDAsuiRrW23ugBtB2Ewg4DQWBU+K0mK/U1p+E4eODP3shiioJZUzIwtz7WL U03Ur++r6nkVKnk6TH/h/tXPnCLMLfLqiHjFjNqbySfiP5vzx8W9jbkkCWM/C2+lk6EQ FgT+zQIjU4mX1zhl92/UkyylEZJhj7L5WMvfxiWQQiWZfzKK28o9K8G14K5tygyrqXCp mu9A== X-Gm-Message-State: AElRT7GaaTnWSAYAL3B1sMDt8/yhSizTdbMxqMxyvPp11yaagZQCTzep JFvVyvPP0YFHAKrP5xGVZxS/R22/ X-Google-Smtp-Source: AG47ELtP7tRfN1TBA7jySKtLe+bgvQlbLmqBeh/NGQxa3Ordn+beB9IwDaE4E509kJoG7hUi6syYgg== X-Received: by 10.223.128.98 with SMTP id 89mr30719826wrk.141.1522071420856; Mon, 26 Mar 2018 06:37:00 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:39 +0200 Message-Id: <1522071403-52486-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 12/16] chardev-socket: remove useless if 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This trips Coverity, which believes the subsequent qio_channel_create_watch can dereference a NULL pointer. In reality, tcp_chr_connect's callers all have s->ioc properly initialized, since they are all rooted at tcp_chr_new_client. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index d057192..159e69c 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -550,12 +550,10 @@ static void tcp_chr_connect(void *opaque) s->is_listen, s->is_telnet); s->connected = 1; - if (s->ioc) { - chr->gsource = io_add_watch_poll(chr, s->ioc, - tcp_chr_read_poll, - tcp_chr_read, - chr, chr->gcontext); - } + chr->gsource = io_add_watch_poll(chr, s->ioc, + tcp_chr_read_poll, + tcp_chr_read, + chr, chr->gcontext); s->hup_source = qio_channel_create_watch(s->ioc, G_IO_HUP); g_source_set_callback(s->hup_source, (GSourceFunc)tcp_chr_hup, From patchwork Mon Mar 26 13:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OjbXSl+4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wS22lnZz9s2S for ; Tue, 27 Mar 2018 00:47:14 +1100 (AEDT) Received: from localhost ([::1]:56852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SSt-0007EC-Np for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:47:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ6-0006ee-FO for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ5-00071e-IV for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:04 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:45504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ5-00071I-C1 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:03 -0400 Received: by mail-wr0-x22b.google.com with SMTP id u11so6645037wri.12 for ; Mon, 26 Mar 2018 06:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=KHzjZWRFoeyCQvdnh45DI5gmS63JZJCa6vUxT1Aa1vg=; b=OjbXSl+4vuE86vddgSFxoeDezmoSWawoQVf3OUxGZuoMXC2MGOqskZZxIBe48fChnX kaSIoxmz5WM8UngQYBngAqL34V07vROJK2rB9gYwdDmaBAcgqhNzjNtF5uWba4dSQRL4 sfaAI2oWbu4g5ND7jKfrw8mGeSnTVK9mEVyYE6Y7ETD76ncd05LIdBmeLEVad4LGAgsc iWdcHE8TJZF+NaQpXdObfj4OIy0dsMl1LYXyY/qQTi8i3kT3UB6OCpwel/ByteMNJTG5 ot5/+ddCEjbekAG/e2FY8vDZtPT1lZXEdJWky3Yr/JCmXsSMJVJreY/ketg7IgkPUoee Ls1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=KHzjZWRFoeyCQvdnh45DI5gmS63JZJCa6vUxT1Aa1vg=; b=LsslCZmCnZH79i0OPdvNDXImii9wcbr+0+HqNMr0yNFPy1mYH96fyHmpNRB0148Uj9 aLIxHTAQAz+Oo/989P4AbA4NXO1VFjv8Zsi1I2aCMUHZQd1dM3bZFaJH9OT3qwIHhRQS OETwQSIoX12/+y2PTclKImcy1OqI1I6tZ+8axXUiVdpsKjObxUyd/JiFTLscKmtdy6zH KTDP7FPIhIU8ohwlaSb7Tp0Rae6Ak62gG33oGUWj9t8qQXAdujQT+TPS9VWgjxaaHRm1 aqzEBusS2rIaIP5ZHVGljFKUWtvPt1StNrAneWMA0CNpGXTTbgO41S4wfxBVfCNO40jE /qgA== X-Gm-Message-State: AElRT7Ffa2Vo7XtjTHN2CxePDcHdCNTxZXHoaCvUaZDY8GrppDoiP+VW voLOtJCbBHJAqOhE32M/tEvHv6o4 X-Google-Smtp-Source: AG47ELslLBfv8Qb9lESAlg0d8/ijIw4qjhR0ojLeO7NfvLqoG0AAhvbU8CORt7r8Sqfu7No6la4ePg== X-Received: by 10.223.195.124 with SMTP id e57mr28990794wrg.135.1522071421898; Mon, 26 Mar 2018 06:37:01 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.37.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:37:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:40 +0200 Message-Id: <1522071403-52486-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [PULL 13/16] scsi: turn "is this a SCSI device?" into a conditional hint 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If the user does not have permissions to send ioctls to the device (due to SELinux or cgroups, for example), the output can look like qemu-kvm: -device scsi-block,drive=disk: cannot get SG_IO version number: Operation not permitted. Is this a SCSI device? but this is confusing because the ioctl was blocked _before_ the device even received the SG_GET_VERSION_NUM ioctl. Therefore, for EPERM errors the suggestion should be eliminated. To make that simpler, change the code to use error_append_hint. Reported-by: Ala Hino Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 7 ++++--- hw/scsi/scsi-generic.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 5b7a48f..f5ab767 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2607,9 +2607,10 @@ static void scsi_block_realize(SCSIDevice *dev, Error **errp) /* check we are using a driver managing SG_IO (version 3 and after) */ rc = blk_ioctl(s->qdev.conf.blk, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { - error_setg(errp, "cannot get SG_IO version number: %s. " - "Is this a SCSI device?", - strerror(-rc)); + error_setg_errno(errp, -rc, "cannot get SG_IO version number"); + if (rc != -EPERM) { + error_append_hint(errp, "Is this a SCSI device?\n"); + } return; } if (sg_version < 30000) { diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 7414fe2..4753f87 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -500,9 +500,10 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp) /* check we are using a driver managing SG_IO (version 3 and after */ rc = blk_ioctl(s->conf.blk, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { - error_setg(errp, "cannot get SG_IO version number: %s. " - "Is this a SCSI device?", - strerror(-rc)); + error_setg_errno(errp, -rc, "cannot get SG_IO version number"); + if (rc != -EPERM) { + error_append_hint(errp, "Is this a SCSI device?\n"); + } return; } if (sg_version < 30000) { From patchwork Mon Mar 26 13:36:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890966 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GyuX5VX5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wWj2QYsz9s32 for ; Tue, 27 Mar 2018 00:50:25 +1100 (AEDT) Received: from localhost ([::1]:56868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SVy-0001dr-Mr for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:50:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ7-0006g1-Kt for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ6-00072T-Lf for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:54857) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ6-00071s-FU for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:04 -0400 Received: by mail-wm0-x242.google.com with SMTP id h76so15483410wme.4 for ; Mon, 26 Mar 2018 06:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KqIuQlrgW+2eeDFrk7JAgxVXL95ZDVypVRSTS7TnwFE=; b=GyuX5VX5lDrrMaTomWmAB5m1TtXoB5nPLhM8iEfFR66VmwpwbgXimxy+ZCQDC+GD2O N4mcB7H6Ca+cnfkAsZApIKlJkFu2KgQ2WTYNz0VIaUs7SN+LE/xmDhXKRhr3yKputF2H fRHZc96hxSAuWl+l5MUxp5ktm4W4ESvcN2tD+OfMWvtY3x9qnENRncfyMrM0Zp0MVJQs RJ1mYaWePelqdVzFCYeidZu7bZwDCFOj1uypdZrdoEiT4i+QYzDniFW8ZjgdvEkqgs4+ OBvu8bOilvA4juqxvDEGL4tUKtPYzO2dDuzAtGtUiu3VJBLK2vs6OkKQpEr40uEzjZDx VrDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KqIuQlrgW+2eeDFrk7JAgxVXL95ZDVypVRSTS7TnwFE=; b=FIgXRJkmHZWxHu6gv5AYTXv0NKba9l/d3TObi5KBF6N7opJPpLWnq6v6OrEkScizmO hnP+nuOrJ8DmypPF5qS4aBNj47YvtVvGNNROPNN20kmsj1VAZfbVoFZ6B726NbfrBUw3 32m3P/1042aSNYlGMFf49yV7ytb4qQyThr2gB2IEHJ9RlhZMOz9NrE52UJSzfiVLidHC n7+DXFavZbG2gK4sx22K6/M3kgYL/1XStCIXBzvdMMyBXZUQSKpinIgw4BtxJ1tgHCIO yuKNxDvOGswGbT39xUQP/4CXQbkPKZbQulCn9vIMhMxDd2/kLsR7wdegpdg6XsvGNZRa fcpg== X-Gm-Message-State: AElRT7G/mqUx6t4nRJ3xLjZ2N8XVewZILzcmLP74nUxU1B7WBrO7D5Ee kBvtwIAy+wQdYo8v8+L2BsVmaihj X-Google-Smtp-Source: AIpwx4+pyOHubjzqzjSqcS4RZ6IEAihxQCIN3UqZc/QooJPR1JAF9n/nIv3p7Q22aws0jSWPvakCbQ== X-Received: by 10.28.24.17 with SMTP id 17mr3906027wmy.128.1522071423095; Mon, 26 Mar 2018 06:37:03 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.37.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:37:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:41 +0200 Message-Id: <1522071403-52486-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 14/16] iothread: fix breakage on windows 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: Peter Xu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu OOB can enable iothread for parsing even on Windows. We need some tunes to enable that on Windows otherwise it'll break Windows users. This patch fixes the breakage on Windows with qemu-system-ppc.exe. Reported-by: Howard Spoelstra Tested-by: Howard Spoelstra Suggested-by: Paolo Bonzini Signed-off-by: Peter Xu Message-Id: <20180322085630.23654-1-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- iothread.c | 4 ++++ util/aio-win32.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iothread.c b/iothread.c index 1b3463c..e675c38 100644 --- a/iothread.c +++ b/iothread.c @@ -31,11 +31,15 @@ typedef ObjectClass IOThreadClass; #define IOTHREAD_CLASS(klass) \ OBJECT_CLASS_CHECK(IOThreadClass, klass, TYPE_IOTHREAD) +#ifdef CONFIG_POSIX /* Benchmark results from 2016 on NVMe SSD drives show max polling times around * 16-32 microseconds yield IOPS improvements for both iodepth=1 and iodepth=32 * workloads. */ #define IOTHREAD_POLL_MAX_NS_DEFAULT 32768ULL +#else +#define IOTHREAD_POLL_MAX_NS_DEFAULT 0ULL +#endif static __thread IOThread *my_iothread; diff --git a/util/aio-win32.c b/util/aio-win32.c index d6d5e02..a67b00c 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -410,5 +410,7 @@ void aio_context_setup(AioContext *ctx) void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns, int64_t grow, int64_t shrink, Error **errp) { - error_setg(errp, "AioContext polling is not implemented on Windows"); + if (max_ns) { + error_setg(errp, "AioContext polling is not implemented on Windows"); + } } From patchwork Mon Mar 26 13:36:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vU1aV6I0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wYn4MqJz9s32 for ; Tue, 27 Mar 2018 00:52:13 +1100 (AEDT) Received: from localhost ([::1]:56894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SXj-0003PQ-36 for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:52:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJ8-0006h8-UL for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ7-000734-Sc for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:06 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ7-00072g-MD for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:05 -0400 Received: by mail-wr0-x242.google.com with SMTP id d10so18957559wrf.3 for ; Mon, 26 Mar 2018 06:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+hgofuNV++q5u2zYKD/0sMYy6lcXdBuKp8VlhdHHqPU=; b=vU1aV6I0Evpm1s/Bo+ZNoJJnNJdR/nGXA/H+xTuF/xKYPwDVRmwgRjgMDiBSULc1/K TEwltiJhYuJ8WRsPMM6vkXfXKLoAJtVLZnCr4VFz33qUPMURQq0xcYwVZDywn4+7nle8 GV1S+gO3kNPOJ+9TWAW6sUwbFFRGHj/nHmuqQgd9LPGClOBBPdIrp3vx2eowBrIUV/rV eRJW11+ZoulMXdR78AGTlcj53aaeAvd0eIyfCDG2w68Wn50IFqu+suyOZ09Pbuv8eYWY sWx+7jevdHAvi56RnjXu7EEeqnbbzHcLpDNlEWh54LfwIwe5vToHQ3oaehE5G3hP7WsE vrCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+hgofuNV++q5u2zYKD/0sMYy6lcXdBuKp8VlhdHHqPU=; b=XshJnJQLMt8TF8v78nDbUf9Dsn8/3SCa9hWRjAI/FWKAsNVt3lQ00/2ou5WRGjW59E H0RE2iPJCznVkqoNz6mnANuTdyaRP7d8fuHstCWKzfxeYIwApRvTjC2y1pBjHb6t3dnn jbZtKHN1OZzRRMQ/srH/Wnyr00VHzj/HxKDe32Ur9sz4hZACndEu4En5U2/+4ayQMvXx Vh4seMmVDbPPULV81MYMabnLSf2q9IgNc0gp3LqUxqahHHvgm7rfmZA9nO9h8R8xPF6R /iZOJWhPq5YsSdb6cyigFQymIdMHBsZINO9byY6y5+di9bAuGs3lxcFmBgJuYu5uMmpG FX0A== X-Gm-Message-State: AElRT7EcSclWdRK+7TMuLpMTuYam8fKIt12jfIa9/WCWle5/skh/428A tgJIuNC8f5MVflqFtaIzKNbQhjr2 X-Google-Smtp-Source: AG47ELtf5bjnvbeAe/XOkdSZ47T7cV26QRv7jJqsuIuUSWWbP8yI0n40/Zb2Vpb9OEIBtLR8xT6rnA== X-Received: by 10.223.142.164 with SMTP id q33mr30172991wrb.72.1522071424338; Mon, 26 Mar 2018 06:37:04 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:37:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:42 +0200 Message-Id: <1522071403-52486-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 15/16] chardev/char-fe: Allow NULL chardev in qemu_chr_fe_init() 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: Peter Maydell Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell All the functions in char-fe.c handle the CharBackend having a NULL Chardev pointer, which means that the backend exists but is not connected to anything. The exception is qemu_chr_fe_init(), which will crash if passed a NULL Chardev pointer argument. This can happen for various boards if they're started with 'nodefaults': arm-softmmu/qemu-system-arm -S -nodefaults -M cubieboard riscv32-softmmu/qemu-system-riscv32 -nodefaults -M sifive_e Make qemu_chr_fe_init() accept a NULL chardev. This allows UART models to handle NULL chardev properties without generally needing to special case them or to manually create a NullChardev. Reported-by: Thomas Huth Signed-off-by: Peter Maydell Message-Id: <20180323152948.27048-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- chardev/char-fe.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/chardev/char-fe.c b/chardev/char-fe.c index 392db78..b1f228e 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -198,19 +198,21 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp) { int tag = 0; - if (CHARDEV_IS_MUX(s)) { - MuxChardev *d = MUX_CHARDEV(s); + if (s) { + if (CHARDEV_IS_MUX(s)) { + MuxChardev *d = MUX_CHARDEV(s); + + if (d->mux_cnt >= MAX_MUX) { + goto unavailable; + } - if (d->mux_cnt >= MAX_MUX) { + d->backends[d->mux_cnt] = b; + tag = d->mux_cnt++; + } else if (s->be) { goto unavailable; + } else { + s->be = b; } - - d->backends[d->mux_cnt] = b; - tag = d->mux_cnt++; - } else if (s->be) { - goto unavailable; - } else { - s->be = b; } b->fe_open = false; From patchwork Mon Mar 26 13:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 890961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="euh/+0d+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408wNl5lV3z9s2S for ; Tue, 27 Mar 2018 00:44:23 +1100 (AEDT) Received: from localhost ([::1]:56834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SQ8-0004Nn-K8 for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2018 09:44:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJD-0006kx-2a for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ8-00073c-Uu for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:11 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:38089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ8-00073B-Oz; Mon, 26 Mar 2018 09:37:06 -0400 Received: by mail-wr0-x241.google.com with SMTP id m13so5632368wrj.5; Mon, 26 Mar 2018 06:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=87W+1XV4WhTBQljBRjW3lG2KJXw2mmtgXGjXv0rTyp4=; b=euh/+0d+RZyI0S6gAEwwZsUHBfbsoFalAYqXfm+GLqYgyT3yO69dMqh8ioQ93B9eSa 58RUL8O5GRJ/RnZdGpQJ2xndpYuMbBO2v+VcVNpMYRqTk4viC9b5bCZRxJtpVxDtNYhU UVhQpZHYqmq2QWrmAbMiT7UXt/zBwODlQd8OASZPKjLLWdyIsD5YiJ1E1isK3SE45Jt3 7cpai+YFm5NZ1CPKeHox9CQL/Erht7VniDTCYdH3qtzKLbwdrIJcW1PMFFexurrKWJdh rGjrIhbJVkqkgZaRdE7Y00GG4ElaFR1sikDFWjoF7+15dwIivFDgRrFhamw+uuBdEoyM Y64A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=87W+1XV4WhTBQljBRjW3lG2KJXw2mmtgXGjXv0rTyp4=; b=rQSd9i/0VxWLxHKpq8fm25I8U2g7eSLPEoI8gjbZ86Hfsd97m4qkfyFW4j3+4bbJpy xNqW4LQuoENHmj7hdFSQIysSapBLgLkUJqi6/Ujd5yQ7b5GBV1ThRuQ6Q5SW2sJJMKlF XDTv9DkuYRkAgg1HR7rkA4v/bOAXenB/7LrIU9PGeL/wa1Cm1wX8oNxHixu5tahbxDmX Upw5Vi5dk/IB9drYQMJx3vgTg1M20brll3louiJBNgdEAXaaxaWys6jFA2yanobQL7Wo FIDvzGKYxmTnzNN9TyFsJVmUJEOhz4tbl5m9aDSjgx1XEIC+KUqwhMlv2EkpVYhNRxXU UAXA== X-Gm-Message-State: AElRT7E20WK2zzUcuSyOGXGGza1WMs09JzCgMijKMGEzAiylL78eQsYb OpNw/4wAGX2NbhErhiNH5DqFxu4p X-Google-Smtp-Source: AG47ELub2kIl12vcwuPE0y7zdScPnrkn9vRM3Kg5HRSrRP1pT5IMNqr2BDGkcxi+dV9RjQcrUDjyBw== X-Received: by 10.223.153.177 with SMTP id y46mr29872950wrb.215.1522071425361; Mon, 26 Mar 2018 06:37:05 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:37:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:43 +0200 Message-Id: <1522071403-52486-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 16/16] qemu-pr-helper: Actually allow users to specify pidfile 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: Michal Privoznik , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michal Privoznik Due to wrong specification of arguments to getopt_long() any attempt to set pidfile resulted in: 1) the default to be leaked 2) the @pidfile variable to be set to NULL (because optarg is NULL without this patch). Signed-off-by: Michal Privoznik Message-Id: <6f10cd53d361a395aa0e85a9311ec4e9a8fc11e5.1521868451.git.mprivozn@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- scsi/qemu-pr-helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 3facbba..21e1b8e 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -903,12 +903,12 @@ static int drop_privileges(void) int main(int argc, char **argv) { - const char *sopt = "hVk:fdT:u:g:vq"; + const char *sopt = "hVk:f:dT:u:g:vq"; struct option lopt[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { "socket", required_argument, NULL, 'k' }, - { "pidfile", no_argument, NULL, 'f' }, + { "pidfile", required_argument, NULL, 'f' }, { "daemon", no_argument, NULL, 'd' }, { "trace", required_argument, NULL, 'T' }, { "user", required_argument, NULL, 'u' }, @@ -952,7 +952,8 @@ int main(int argc, char **argv) } break; case 'f': - pidfile = optarg; + g_free(pidfile); + pidfile = g_strdup(optarg); break; #ifdef CONFIG_LIBCAP case 'u': {