From patchwork Wed Aug 17 20:05:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 597866 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3537864maz; Wed, 17 Aug 2022 13:09:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7jh+sRC3BqFJkywYO8z6zrhDePvJ9fkPbFiMBKPykQNaEkFeWyWD3Unt9dUgQYFYLCAsqn X-Received: by 2002:a05:620a:bc9:b0:6b6:66b2:d417 with SMTP id s9-20020a05620a0bc900b006b666b2d417mr19650768qki.3.1660766942959; Wed, 17 Aug 2022 13:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660766942; cv=none; d=google.com; s=arc-20160816; b=bjz6ZHxI3NrgAcmtGCB2i+s9G9FDprCIz9anJvxyKMoRlFEwgDmCpp/gzX0faaUTyQ X7Zguxm0DAJBog8Rx+4oOzbvzYyjtqhEZhs/svQ1nSfPpOf5PlERNRyxrf6XOkUI8yLZ Y/HTncMvwShyULlhlzsyQK+gvjbfKFs46RdbG1N9JGT42I1ZvKRwThv0ZodDhinwMge6 h0kUtsJvgwNswSugJR8WlnKmooi+dbm3aWXTk2yZtc4sH3yQWcgpSe0vp4/hlMQ9K0yY iJVdDOTUfOK5yCWvly0lJKUXsT1Zfl5s7oswlK4avVhYx+xd34B0Y+h1bGEtE5SE2nHP S8zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=vvtrQLpXZrZfw0pSWvx7UkUR3sksnEz/OUfswm2CgLmQ8x7C6KR8gy5U9+SpEWdRiT l2nVxXqnvKUu0cM+b59lZ3lvCxq22fs5blF+momzm7TT1pLbHCjXR4f3B5nnhkAsWtTe 4HRzbxyfRat+apEGS+d8+BfPZa2iRSem8ANb2q57nVIBS3YA7gFNLF15PoDr4DK9n+I+ Hd6vcZ0vUFcpz8FEEa3YCb3l177eAdeGoVd6RN/eo0XWvAqnjaMMil8yI4e5z3Xq8uZA Iu/OHA+t2QV8kTORNm6acx6NGRCR4SVf3n6FjYtifjPZDEKXweLTvMwoul5TsLgMdvXq k9Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bd9lb73+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dv25-20020a05620a1b9900b006bb4e956a73si4301686qkb.256.2022.08.17.13.09.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 13:09:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bd9lb73+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:54462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPLa-0003tQ-H8 for patch@linaro.org; Wed, 17 Aug 2022 16:09:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIi-0002tG-Jm for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIf-0000E6-Vu for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=bd9lb73+sWzYFP92gYK4P74XVsqYYSAo6h+ZB4SH0rugJsdou++oFmO/dRB9/ZHD8sNkX5 vMfurZm3hBBba0LrZJdxbbJVHjmcay5x5AanwY4znaLgztVSY1QXkcZHqJG9LwHCedrGBs aJiX329LQY5wM8zr9d+IjC1wmbmo7b0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-286-JDqFfRhWPVeeLT6RoARiwQ-1; Wed, 17 Aug 2022 16:05:59 -0400 X-MC-Unique: JDqFfRhWPVeeLT6RoARiwQ-1 Received: by mail-wm1-f69.google.com with SMTP id j22-20020a05600c485600b003a5e4420552so1533567wmo.8 for ; Wed, 17 Aug 2022 13:05:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=ozctaTGrGQ5LQRIWk0B/C1392INCQSMAXN2eILD1/6hGbeTWAGTMBKF8qepaOea02L HqLBv2QrSm5fTOVfsQjPEjtEtJOS0ctJ4PFFg+oUFy28AbkaMr3CaqOr4ETExPd1BsP2 w1+1JFkjFkV0ygtLAUAKWwMQgUxB53SznSEmVq9MHP1HvMOxN+/SviE/eXTKedOtXIk8 +5OIY8Ax8DS4PBX893jLPr9W7+6VWqNtjze/nPrJnOsLokiZJpEU9v3UcThQ6+1VaeIp /yEv8Lsz7I6usWN+b/oesSr6cOdtOvAAbr/+kRZFe6zOxATr7HSi6BN9g0IvHs+HKoe8 u96g== X-Gm-Message-State: ACgBeo0gvgfGFHnCm/FYpBZCo4iE1D1SULwyMGdWX4Hfvnf/La1B6IBy GZHaxOrAXTd11xMERBm7shS1818A4xwrLbuJ6dL/5RXveKGCW4SkHjK+C6FNLW1oYBul7VLt8Tp o27I13dnme1csNL5Wh3Ir1Wa4phTfxX34AHB9B+o6DBecKQM7TQuZ4fPkol9j X-Received: by 2002:adf:ecce:0:b0:225:2c58:246f with SMTP id s14-20020adfecce000000b002252c58246fmr660139wro.460.1660766758201; Wed, 17 Aug 2022 13:05:58 -0700 (PDT) X-Received: by 2002:adf:ecce:0:b0:225:2c58:246f with SMTP id s14-20020adfecce000000b002252c58246fmr660133wro.460.1660766757923; Wed, 17 Aug 2022 13:05:57 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id u26-20020a05600c00da00b003a4f1385f0asm3061151wmm.24.2022.08.17.13.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:05:57 -0700 (PDT) Date: Wed, 17 Aug 2022 16:05:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 02/12] hw/virtio: gracefully handle unset vhost_dev vdev Message-ID: <20220817200536.350795-3-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée I've noticed asserts firing because we query the status of vdev after a vhost connection is closed down. Rather than faulting on the NULL indirect just quietly reply false. Signed-off-by: Alex Bennée Message-Id: <20220728135503.1060062-3-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 0827d631c0..f758f177bb 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -306,7 +306,7 @@ static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size) dev->log_size = size; } -static int vhost_dev_has_iommu(struct vhost_dev *dev) +static bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev = dev->vdev; @@ -316,8 +316,12 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev) * does not have IOMMU, there's no need to enable this feature * which may cause unnecessary IOTLB miss/update transactions. */ - return virtio_bus_device_iommu_enabled(vdev) && - virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + if (vdev) { + return virtio_bus_device_iommu_enabled(vdev) && + virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + } else { + return false; + } } static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, From patchwork Wed Aug 17 20:05:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 597867 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3537872maz; Wed, 17 Aug 2022 13:09:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6K4/NzUpOm2xBAoKsdmXDW/vpUtN1yoKUAe52ckQpyognv9ylt9R605Z77BZcBaUvJv5cr X-Received: by 2002:a05:620a:2214:b0:6bb:b250:1b92 with SMTP id m20-20020a05620a221400b006bbb2501b92mr269073qkh.571.1660766943468; Wed, 17 Aug 2022 13:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660766943; cv=none; d=google.com; s=arc-20160816; b=wgLBfQxYqc8oSB6PKJ60aPbCqbl2mj6MwVVoQDBM7fGGklPe17OjcozHXIt8rZlMzB LyEpJn7yKlAoTxIlYNWEFKsA8PAokY2Yzk913sZPywinJlGmP8EglBAbcyaM3NJoAHHz byE+A4tVHQ4I2UWmxU69ZEyD2MJXkMJsTes5Q2CGHpI+8RXi5LBw0C3GbFbLqbY0i3Ya N1JFLH5eQmM6PLjBTQJt2SAYLntjn06kG1KEKssOpSesWpxluVU6YW7AOjAjft/1AXoF El5XZWg1Dqu5jvdm11BZKfnVnS69y668FyAAlpcp4HvEFpQrKGkBRID/nZX6ozLH1qKz dNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=IgeSL3ms0nZT9uws20DDhmWT0ZC/3tt0kHsUZlhhu/x0w+0V0qmS48NuamE1lwXlAq Kqbore+0+5oPRi7ii8X/4cKXIxEZYeKloBvxnzicAzho9a40/ppQ0IaxLVOgzQDocdMc H0UWNjSe/EkpT8O+82ZeYqoP7G/QdsP+E2OGvNCm+nVEnxLaEAmOm+3qT1D/UMyiuKQR y01wXrpvHR4ijvYifZx0vyFjJS2ZGGKxkuuVVbT5NHnf4AmF7bUN+KfLbRZoXpV3DXQR h1F9asQtk7q9oM/ZB9+VesIlraO8h35187Ihw+uK2FffWZZOAukNGzZmHKfMbfBDTPMI QnYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PmmGa4UK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t12-20020ac8530c000000b00304b825a7c6si9340707qtn.66.2022.08.17.13.09.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 13:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PmmGa4UK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:54464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPLa-0003wk-Qb for patch@linaro.org; Wed, 17 Aug 2022 16:09:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIk-0002wh-V7 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIj-0000FC-He for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=PmmGa4UKa6cXwpfvuOA5MjWz0AzNt9a9JzO0L+1sxmHNpswhQ8fyuSpz0a1RPeCrx/FYWn rhTisiFVqqh5uFoMyFCfjXqgZhARXyCTI5QMj0Bln9nI2ynxV5D6jYiMC8vDWMdUdlPJAV X+o3c70gmcJjQ8cQasnKY7scJ8oW/BY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-586-adLoEtLSPf2rIJ3Lp-ETaA-1; Wed, 17 Aug 2022 16:06:03 -0400 X-MC-Unique: adLoEtLSPf2rIJ3Lp-ETaA-1 Received: by mail-wm1-f72.google.com with SMTP id f5-20020a1cc905000000b003a60ef7ec71so601491wmb.4 for ; Wed, 17 Aug 2022 13:06:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=g9Mi6+Nl8sbGS3tZYK3i11mGyje6qFBLQdLlyCZTtcqrdXtsAz3zRHk8KJ5VxdKO3U DMFjyL8qk+3clIDvbwJFBvzlOQjsN1Xhdf3b05xDchhgoLUH2RxO3W4BMdpQDUAtU0/E yYSlExMDY6mWJro/MP2LcUkhe1VCho3Urw7V/8JtiLqGFKQJ7aH20biNUyRj7JUwAreZ PcQq0HtM2kSfsZaoW6QlBoTQ2+NFEUgl6iznj0y6NMsqe0cIdfzZ32dvEvMxneAGKiMi 6O4o+8kmkzbDKU7Hfp3TZcZF2qW24zvUJbTsTCWHDaiuWP7vnL3lNrjI4AOHaNdyJlnb 6JpQ== X-Gm-Message-State: ACgBeo3kq5AELIZfYuhn7aGZY1QlnGlL6dGv2WbJVBgvhoW/gzCRdZdi 0eAzPHbcl6kZF840y2+5P+jWml5g/4E0TFE0GK+isuJNhEemguQVe6gLHRdAV1xtqJmktvmii2d Rb1tlm8LRjV0Ou37vxNxFIrILd25o31QzdNiKttaDh5GuoSwl/qr4cvw0wJqg X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr15289068wrb.345.1660766761602; Wed, 17 Aug 2022 13:06:01 -0700 (PDT) X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr15289050wrb.345.1660766761329; Wed, 17 Aug 2022 13:06:01 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id n4-20020a05600c3b8400b003a54fffa809sm2829643wms.17.2022.08.17.13.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:00 -0700 (PDT) Date: Wed, 17 Aug 2022 16:05:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 03/12] hw/virtio: handle un-configured shutdown in virtio-pci Message-ID: <20220817200536.350795-4-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée The assert() protecting against leakage is a little aggressive and causes needless crashes if a device is shutdown without having been configured. In this case no descriptors are lost because none have been assigned. Signed-off-by: Alex Bennée Message-Id: <20220728135503.1060062-4-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 45327f0b31..5ce61f9b45 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,9 +996,14 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign) nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX); - /* When deassigning, pass a consistent nvqs value - * to avoid leaking notifiers. + /* + * When deassigning, pass a consistent nvqs value to avoid leaking + * notifiers. But first check we've actually been configured, exit + * early if we haven't. */ + if (!assign && !proxy->nvqs_with_notifiers) { + return 0; + } assert(assign || nvqs == proxy->nvqs_with_notifiers); proxy->nvqs_with_notifiers = nvqs; From patchwork Wed Aug 17 20:06:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 597868 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3539615maz; Wed, 17 Aug 2022 13:11:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5URcmjaFIHNon/h2NcjG+IiRzFozuniXp3d1vuk+zdGoK9h5+zDXlH7WfmUBaxcHPRBwFg X-Received: by 2002:a05:620a:b4a:b0:6bb:93ba:275c with SMTP id x10-20020a05620a0b4a00b006bb93ba275cmr2923472qkg.270.1660767104166; Wed, 17 Aug 2022 13:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660767104; cv=none; d=google.com; s=arc-20160816; b=AoslV1cKWkIOgtNzGuf5HD1UhURteYaulPhsJqjondgUWyqLdjnvIvuNU5MP+iI3aB j3B/FlZdbGiJ2dCOt8+TNLrVOJA55Bc2SM+Bhc8pir4wqrFsV3CBSDjKxZT4RRYpiL2E QYB/H7AA/FU0UkZEBAA/SbiKRlndjZCmbvEDzeW/xpwzXbrjmMkpWVBy0fngiyifpoBJ hrgOIT3MphSK8kuOLchYB5agz1E8oewf1nrdl4oUG3xLjAVaGg2IDXDirNZqqSq+W35a Quu44DYH1QGYCRNby2ZngOruClsDZYpgbsAu0oXWbWt8o/0cNQUkKblpWYVgnH+2Ptpb p0Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=hAfSfcoxwk0BpuE3z6ypRquI0wEH9g0jV4xlaXSf/EBIUVdKK6evqSLubmWT2TrbCz Xt1YLvIRwerd8ddSlVMKjDw0a8fBoxtX7mgYOLEYzTIndnkHkmzs+HkcxQI951gkN0Bv mgSmHpcWqcTl+a32A07PoSIuupuRMg4c6rOo3m2I6EmuXTTMq5QBd4gQrFPKFDETlO9+ mNnxNU/At8e1kXVc6k0oqSUhPHyBuIaFIOrYvtZfHZh4RYW0lylVxr+YAPS09FkmLJGR zN1l3pPYkiYsrT6X08boxOg0hWc3BI0l/PG/XzAfIjH+G6x7rBdXW3d7Pk4ywZ2r+C59 CVpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NliMa2iM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f4-20020a05622a114400b00342f75dde13si9092816qty.754.2022.08.17.13.11.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 13:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NliMa2iM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:34976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPOB-0001To-M5 for patch@linaro.org; Wed, 17 Aug 2022 16:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIo-0002z0-UG for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIn-0000FT-KK for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=NliMa2iMB23DfIEWKngjfUO7wM4IDkp/ZvQMXt5/K32OmXID4NAv4JtwgWoDDZVQQydfxM gRmOkBEKUGW9Fdq9qqChyEL/CWHiKUjhFhRFc33D2BNgZL6FZk3yT2tZPB4pFU6/nuTBNv Tg8i4dMfzNXNroplVhnOA2I9LSobGbo= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-389-8IEXyy0rM5WOAnmWuCWBsw-1; Wed, 17 Aug 2022 16:06:06 -0400 X-MC-Unique: 8IEXyy0rM5WOAnmWuCWBsw-1 Received: by mail-wm1-f69.google.com with SMTP id f5-20020a1cc905000000b003a60ef7ec71so601560wmb.4 for ; Wed, 17 Aug 2022 13:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=XvP5IxLInow/SIsyMVhCXW97rKA1lkgPxmicTXKAplmB/S1N20CsSvW8soM3mc8Qyg czalNQnme2w4I2t3oaLIN9oVDnx+IYT7aolPJhAYPUtshsjG4O66lE6JdRHB83gQnGP2 FPPskVKWeRCJtGY2rvU711UnmPV9HgB1VaNRDN3eQV+wv7/0BX3gjMnxRDcoN9R7TlxR t3B8pxRMpMWiGV+DcTsEtENwZffX83F7yc566Z/h408XnETzZCm+n4mTnb7mqyTpg0Rb LfbusGAlok8qug8phTRvE5DmBcJs/g5CdFLa+XoC46Ad7iGW4f70UZ2xM4cUabN4Cd2H N8Nw== X-Gm-Message-State: ACgBeo2xM88C2da5o8sJuDNGoR2ZaOtEjAdf7UUydK/l9+ELXzwlfPIb vyEgSRwHJxT84vEAOoMVqIZoSToL4MKhqbt0RsL7LaS1p2mrMMmmdPxC1jLVJhLo6iZMuOYZaj3 q8utGH2BIt5vBUJJGVT1Rt1jH9hPDz9uKTZQ0QjREdxzkmhiX0mLdCP0+Rbsj X-Received: by 2002:a05:600c:206:b0:3a5:abe9:8a91 with SMTP id 6-20020a05600c020600b003a5abe98a91mr3066595wmi.155.1660766765156; Wed, 17 Aug 2022 13:06:05 -0700 (PDT) X-Received: by 2002:a05:600c:206:b0:3a5:abe9:8a91 with SMTP id 6-20020a05600c020600b003a5abe98a91mr3066583wmi.155.1660766764835; Wed, 17 Aug 2022 13:06:04 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id r15-20020a5d52cf000000b0021f73c66198sm13813537wrv.1.2022.08.17.13.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:04 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Jason Wang Subject: [PULL 04/12] hw/virtio: fix vhost_user_read tracepoint Message-ID: <20220817200536.350795-5-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée As reads happen in the callback we were never seeing them. We only really care about the header so move the tracepoint to when the header is complete. Fixes: 6ca6d8ee9d (hw/virtio: add vhost_user_[read|write] trace points) Signed-off-by: Alex Bennée Acked-by: Jason Wang Message-Id: <20220728135503.1060062-5-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 75b8df21a4..bd24741be8 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -295,6 +295,8 @@ static int vhost_user_read_header(struct vhost_dev *dev, VhostUserMsg *msg) return -EPROTO; } + trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + return 0; } @@ -544,8 +546,6 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, } } - trace_vhost_user_read(msg.hdr.request, msg.hdr.flags); - return 0; }