From patchwork Wed Aug 17 16:14:36 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: 597865 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3399431maz; Wed, 17 Aug 2022 09:39:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WQn/9EKkhD8aVDTQMzA5M1M4GUHOdZpYQGSIAyxwYplczpUwUTmdevLdp4YeT433WXVnp X-Received: by 2002:a05:622a:4c:b0:343:5d26:562f with SMTP id y12-20020a05622a004c00b003435d26562fmr23019451qtw.613.1660754342623; Wed, 17 Aug 2022 09:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660754342; cv=none; d=google.com; s=arc-20160816; b=jmDHYpdKRXfYLkoV3sEi5pfDYtFznxpnCiaRj19NPcsdKHaa4MeXYN9um/pVJOgD+G ic4obK5q1/q4aBGMXh5vb0zznILU/IfmTEGsabYHCb5uCSpstM2oaLWabpcqcWk/pYwP znHhbwCgLpAwLji2L+G0A8RZ3jf6O/FtLlHxkkJIuOntYEfG4SK5bl9MYE5BxaoV5MGg 7a5PGOdDEoZw/7ombd+L/MtosrOAlBprD3/r+Dw8IAB11TWDvwRfWIiHFPt2MbYvF0mF Tr3Lixde9nVPmgzpSIKnxKNGUl1nu+1W8Tg1GTVNAbQtiE2M82FD/dr/WtDOPHLYmKee e8Tw== 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=mpc7wpE8G7WgtlTNFD93PLNCJDA6Ax8GCXcaGdvOW+zIAAWV6oGNeauib3ck4FdYCf YDiAKvsH2IOoMgkDmydlwhdOdmr8nH94ZSoiU1v0zlpIr93okxazDaOx+7H1MTSRClwq W7FE+qELOa23zPVctKD42qxCDk/vvU2W+1BjeVmpyozuUcnJJKsoiO8zQvq6XqW7ZcIw batF29ZpsGJUDCJ/uVgiASIVPKXROF1Cip2DYdOKYItMOMFoPhX9/5OWKhbWItwVXOvx dpvQ9SDLhx1+mw09zlvN60lFL7eRsAXbUekvEzoiR39z4u9+Jvb8NMRPpVfCfIcS2b5d 69OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WwzOgjNh; 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 cn3-20020ad44a63000000b004747289e09esi6719719qvb.3.2022.08.17.09.39.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 09:39: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=WwzOgjNh; 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]:41180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOM4M-0001z6-0A for patch@linaro.org; Wed, 17 Aug 2022 12:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgt-0007sB-Pl for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgr-0001QO-D3 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752884; 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=WwzOgjNhrosGvTZz5DdpAYvxvWa11FYTMMjdM2T4E0ewn7fou8ELwLVmwFgvhtBhSFzZ9j CURb+XRqTVeeCElg2MILvu3HfLq7auku849WipHm+lIx3EPH91V4MUegVyuaISWyJu7Rhx cFTBzhyNHR0r3g36ppbWKNgm9yrZVIU= 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-446-B27zF3UkNxeGpoxaOGaKLg-1; Wed, 17 Aug 2022 12:14:41 -0400 X-MC-Unique: B27zF3UkNxeGpoxaOGaKLg-1 Received: by mail-wm1-f72.google.com with SMTP id r67-20020a1c4446000000b003a5fa79008bso1268540wma.5 for ; Wed, 17 Aug 2022 09:14:40 -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=IXtQd27a8fErJuf1EJNHZj33FOWek34l3/4yFg+T+gIXxt6asI8apLCk7hVqc3R3HH 4J2HPvqFkswy4jG4qBwS6FZuoiwJNA/L9/6skL5ondmswzsq0EkO5Q+u57bWLS0ftIPN 29hgH75kaNzcWjb6PkGnyhKh4cRl4Ic65RRf7w6etvh3yd1ufhrvw5sQ0E94OyGoK8Fe 17uIHjWdBVQA7OCMtOlbU3sYBiRhj4l3suoz0GPIb4bjyJpr+TNb8/lltRF9YvioZK5m GuJnt8k31Hso0EoHP/lLGbDxfPfejdpeQu3++9MG6T9V5AenPYygm/V/8IbWG0zmnIH7 Djow== X-Gm-Message-State: ACgBeo2iGfmjrIPzckZXmzMLtmN3Z3F1aijKX24iKOduGdhBWkbEvMAT egCdIqX/Mx3Xul+AU5vbRjR8VFv+dKVEeY9V72Ih5WpTtOCOMnVTglIrk2f4JoOjj0J5DSQ8JH7 jhhmZgEF5TLFO9Cn67KA+JNuoQwq4yYtNW2tdA3diznVNJlqAp/MgBnWQs7Ky X-Received: by 2002:a05:600c:5022:b0:3a6:ad4:1c6 with SMTP id n34-20020a05600c502200b003a60ad401c6mr2617282wmr.177.1660752879692; Wed, 17 Aug 2022 09:14:39 -0700 (PDT) X-Received: by 2002:a05:600c:5022:b0:3a6:ad4:1c6 with SMTP id n34-20020a05600c502200b003a60ad401c6mr2617270wmr.177.1660752879332; Wed, 17 Aug 2022 09:14:39 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id bt22-20020a056000081600b002251e86241csm4079931wrb.48.2022.08.17.09.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:38 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 02/10] hw/virtio: gracefully handle unset vhost_dev vdev Message-ID: <20220817161342.240674-3-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-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 16:14:39 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: 597863 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3383647maz; Wed, 17 Aug 2022 09:17:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR76CfHi4tmY0o/1VGFzCEuyqyYORb1I3hy3xLswfvVMzxN7gXtAcJMKjLewWschKf9lTuCq X-Received: by 2002:a05:6214:27c6:b0:476:779d:f691 with SMTP id ge6-20020a05621427c600b00476779df691mr22870643qvb.63.1660753025122; Wed, 17 Aug 2022 09:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660753025; cv=none; d=google.com; s=arc-20160816; b=SUFNMqajghJn2ehAKzE2rVl6x6PxVar5v1IHL8uFNFOlWlyFym5oBeOhRMYjZ8NFUi DN3oXczcl3GqOyiyS5RD8rBHTe1e9+iRp+vV8xQ5CUQl5eaQnPAyB+4B5ijWk3KUItHe M7osN93kVk/AKVajSQKrwY6I86bTcnu43c9ztKcH6kD3JhzodH1+0F93M/JdyWummpmQ c8Rdpr604oQ/s0eCDsYiiCPiAK+Og0oMSm8L8mGoYX93BHc3sugdOR6A3nYR4SuISWZ5 pQ8cWeJVB2RjbJ1IsCVn4CkeM0wR/Jus8W0qRocRiPwph1BflApyxKGILqtBnvXvscan G7rA== 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=rEl8mx/s45Iw5CTlEzIYS5u5HH47Sciv5Fx/QUMbPZE+RNIYMWxxCbCeIz/X9OrWCY U9rVRZP9cKPL6LleCF5DLz3Av5I/j/aQAOVO8grHqAaL/zXle2TrViat6nVuVlB/Vtd5 xJH0o/H16ShO5njTbEXSsWidAKb9aHwbO1xe6lVs0cWq/nSKCT3LhTylY9MIKM4fcZQq Ius6h6oSTPpxs607lU2hmVMG+C4gW2O/DupSSHjkG3CqVH+guC14jPeUvQTyUXMlvZme dtBoEbgqDxEvzvGQDw7KxX9lswDNP9o3+8MtFP9N9ukdE7KHJlQoxTMbnv+vMruhpvbR fXng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JkGI0SIz; 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 7-20020ad45b87000000b0047391cb103dsi8428165qvp.225.2022.08.17.09.17.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 09:17:05 -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=JkGI0SIz; 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]:37270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLj6-0007sf-Ls for patch@linaro.org; Wed, 17 Aug 2022 12:17:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgs-0007p9-Rt for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgr-0001QM-Cz for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752884; 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=JkGI0SIzf/7z5qMaVRKEM6fWysxmW44+ZQQJ7SeVHnGqMyqzkWzdbvxKvCYXPIxkLleT6o 0aNDU4hPRXHxJN+wCElqT2lb7DKc3+R+4lzg1FrDeUGT+Yl9egl1sGtRq/VpUy8u/28/4u ZbvrwWVwQs/V8Hlp17K8JzpO/qI8Nsg= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-548-yWomPahsPSq-epQI6Oy1Bw-1; Wed, 17 Aug 2022 12:14:43 -0400 X-MC-Unique: yWomPahsPSq-epQI6Oy1Bw-1 Received: by mail-wr1-f72.google.com with SMTP id m7-20020adfa3c7000000b002251ddd0e05so1023417wrb.10 for ; Wed, 17 Aug 2022 09:14:43 -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=dZi+v9a3jzY8WRxjA8H6Z1qYAbIghTm3IBjLVX0pyRVvdR/jUCUzPLQbV70Cqe5Kpl rIbQGM1dJhqhREb33zjqM2CjD7Rq3N7k0AyFuGj16p0+7Ts1jZ7PDU53A3uZX8s69V+X PE1Iu3U1ovDgk+RdRZLyxJVC0Hh0hdgye6G8zTuC0kyRK+NGdQPbeDJlNGB5lISaKxxv L5siGU/A/ia95W7y+i3nZou3yeTNruLf16mFt7ChJAGFbjznHizW1oSIlvZ0HrINYIMg Ngzz1DQTUvBnCsW1OTd17cW06YyDpz8mEl0FJiqh8BsC7Ob3GJhwv4TqsA20V0M+Zr9V W93A== X-Gm-Message-State: ACgBeo3L41Feg8WsUsy2mwIoVvmfWI9Ybzy6bxe4SWRLMXMIWv6p6VVe 0xYahgfdAMiSSO553xGtQJcrOzCB0l3bXjC/pTdmUz/S/RGWuO1fa7qoGJ/Zy2LNCGUSFyewwUF IUS5iFidc15lqSDPwJ7K8D2mDyg2BiWWyEyGuF4g8A9zv7a2lg27H+Anqqdsh X-Received: by 2002:adf:fc88:0:b0:220:61dc:d297 with SMTP id g8-20020adffc88000000b0022061dcd297mr14235067wrr.660.1660752882239; Wed, 17 Aug 2022 09:14:42 -0700 (PDT) X-Received: by 2002:adf:fc88:0:b0:220:61dc:d297 with SMTP id g8-20020adffc88000000b0022061dcd297mr14235047wrr.660.1660752881921; Wed, 17 Aug 2022 09:14:41 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id f16-20020adfb610000000b002237fd66585sm13148998wre.92.2022.08.17.09.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:41 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 03/10] hw/virtio: handle un-configured shutdown in virtio-pci Message-ID: <20220817161342.240674-4-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-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 16:14:42 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: 597864 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp3386959maz; Wed, 17 Aug 2022 09:21:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4yaweYtTVoCywew43QoVsWkB3pGXp8Bl/od/gWSEyh+RGaRMI8etGoO2nHa9A9fzZKEban X-Received: by 2002:a05:6214:3009:b0:482:5a89:c09b with SMTP id ke9-20020a056214300900b004825a89c09bmr23062674qvb.71.1660753313135; Wed, 17 Aug 2022 09:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660753313; cv=none; d=google.com; s=arc-20160816; b=eCdpsGs8SNZN2LfwiMrh4qlrXj1dEtqxvq0gBYeL0THblHGlxisQOx+/TPZmb5Xyao ssl1Gd/HtFYLP+bFKSatt8pQP01Lds7O4OGAWdgElzkfTVGp1wXC2Q00GpQn/BS6YuYs spjWFfHOUjaW1JMgoMgRctaaF3MUuaBPW2/TE87bIuHgsMreGf++jj70M8+1S76/UiQU X3wC0XT3dBDTOuY9JFefFRaEObn6vPDw+Vb1uH4lP+krS8mJQrQYmun6Lx+UZv9e3Ipb CjS32TDTpUOux7yTxX7xW0JkVYTcVucWXJHbacKzrEgFlQowl11vAFgvnpxTxR7txQzY 1kJQ== 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=EWpHSGb8jMYppSuyYTTAc5Uj+TfUo3LnszHjKbHS9Ye3cc/S8dSrWMz86K4YYyJVMY MjpCuFXCgMv6E7fo+QZTHicBx8OBJnDBy1vA8BOGkHTo79UQMYH4ptUIabCdqrwPf+Hw cNFEdLNHMAj+v8yltgkfwtLjXftd8PeMLGebBkNU6YhY5kvCakuCxGT+m7eps+JwHwTB 6NXy4ZsugD9ms4GXjiU+jb98uBryFhyWNET5UUjuHg5IbKPTO1wkBoJcmZ+HayPlU+3E GxHe1VhdfwCn8ZNTdjtOolyZ0Bsb1SCfbwr3vX9FnuN4mT/h/KlLmpzZsEKepT8iQIJs fF/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jAkyFJBU; 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 l17-20020a056214029100b004957b1a3733si1797185qvv.77.2022.08.17.09.21.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Aug 2022 09:21:53 -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=jAkyFJBU; 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]:41118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLnk-0005qZ-Mz for patch@linaro.org; Wed, 17 Aug 2022 12:21:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgw-0007zI-GV for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgu-0001Qy-L9 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752887; 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=jAkyFJBUXzEpN26MBWwJh6LSiAdsYZ7GQCoEVIylLUNw8zignhWj/Jui869vX5G7qjlxPu VXX02SjxIRkHwno7F8rBNvM1G/E2q4Ump9cCL2ZohncMSJuRywCwtmoAXerMkmxl3/yZwD zbOVdPueRHmZPqMXrAiIA20M4PDdB6Q= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-627-BVGuruKvNHuOyivTz1szHg-1; Wed, 17 Aug 2022 12:14:46 -0400 X-MC-Unique: BVGuruKvNHuOyivTz1szHg-1 Received: by mail-wm1-f70.google.com with SMTP id b16-20020a05600c4e1000b003a5a47762c3so6475757wmq.9 for ; Wed, 17 Aug 2022 09:14:46 -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=QLHtx5diusUFyHR3ZtYyYpNEKBOoZUEIE0Oa/EzIfS8DC+DU4waRTaEUWBiNhYhM22 uEerYg4Ck55YDXsbEjT7fDCMtglQnT5F2Wf8X9Z3FX6wdCoOgilrQha6KrCyrnTDOIqB rzjcFWGqDSZPYuXhm7OJuM08QyMaYm82n6vxlIq+XX11CVlEZiINXVcYsAhL3XUCdr6s 0aiflBxuJGnU8JoOKF8YJdiYnSU31vrA95gyApYn2odAMtEWxvissMsojIxAXNe0QEtN IDOqWJO1W6DeUFAX8zcKq5Igv/igwOhNV9dDQUYAI2nLfUGJXbApt8XqOm5YYd829mJ5 F45g== X-Gm-Message-State: ACgBeo3RouYDJ9c4WUJFd7onrYjcYGQyruz9tmnQgJ2LqH40yaSaJECE JvGPPf0dHG3AOU31dtAqlyPTo8ruzlnYkBtaMQio1ug/9L3DWinEYAe3eXhh6bgGYTS33kdPYFl 4Ujd/WiWR+P/NlQbjj83c44hH4WvGx2PPbNzIA4+e2q0IvzJj9IZfSprbyog1 X-Received: by 2002:a05:6000:1092:b0:21f:13e7:3cc with SMTP id y18-20020a056000109200b0021f13e703ccmr15590631wrw.671.1660752885412; Wed, 17 Aug 2022 09:14:45 -0700 (PDT) X-Received: by 2002:a05:6000:1092:b0:21f:13e7:3cc with SMTP id y18-20020a056000109200b0021f13e703ccmr15590613wrw.671.1660752885168; Wed, 17 Aug 2022 09:14:45 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id o12-20020a05600c4fcc00b003a5f2cc2f1dsm2537184wmq.42.2022.08.17.09.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:44 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:42 -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/10] hw/virtio: fix vhost_user_read tracepoint Message-ID: <20220817161342.240674-5-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-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; }