From nobody Sat May 18 17:15:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659018471; cv=none; d=zohomail.com; s=zohoarc; b=asOmpxA4sWUW/fUUbV8DBLpf5ouulpnC22YORGQj2ZJw8YzMxNpKygDvOyjQq+BAK7LYFoj4X8sVG8bwVDydSdjlCNEUcjuS44ZkgOMKZG/TucfK8FhKWvB9LRDoMwRnP5K3G15K2QzzkVFqK+7Sz+fzhAUOlIbOcLjShlmxOSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659018471; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WTel/fQ7Gj1d2ni3sryAwF0T/iksivK0kIXjy8395Xc=; b=MUKITQtGQoCT3YGY9U/r3ruP7alqXwQ0SbZxD9gjCyJOKRwGTqfFRNn3qutGSwrOJe0lH9VQmtqX8JvI4IgiHLxfGb3fJ0yqMk/Djkl+CxMAxGZnHXsiRb/YLg5FLGu5UGZZwSKIgfp2CTxdJpSP8Czbj82AJc8S54+r4AsEfT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1659018471702185.42232493580218; Thu, 28 Jul 2022 07:27:51 -0700 (PDT) Received: from localhost ([::1]:38114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH4UP-0000M4-Qx for importer@patchew.org; Thu, 28 Jul 2022 10:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH3yy-0003lT-6R for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:21 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:37855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oH3yu-0000Nf-Jm for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:19 -0400 Received: by mail-wr1-x436.google.com with SMTP id u5so2295335wrm.4 for ; Thu, 28 Jul 2022 06:55:07 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id v11-20020a5d43cb000000b0021ec76a0c36sm1005656wrr.106.2022.07.28.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 06:55:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AE7731FFB8; Thu, 28 Jul 2022 14:55:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WTel/fQ7Gj1d2ni3sryAwF0T/iksivK0kIXjy8395Xc=; b=kb1xxsEzQrWgYuE2LMINFYLvrfst53N1FSmkhmBZM5MO1Sf3yZ1DaaNLnIAspPktEr ZowhjUlj2EEvVaCi/L5sEL0LO3caPfxFse0PQ53R1w4MfZdiI6rlb9Vvpz5w42k1t6DC DC+Fzfmvawm3cANMWmAB3W8h4J1TlfmxNfnnwxiVVaB5ec2TGC3OzlBpREUXvyrF4gLQ fcWEapJgh2OkKQBrbLD4R2RecCNbiUAJZGlcfv9wquM3VLE7LXXpbUnG+scdL3x9oeGz gbZs6YLnRZEg309Zrrkt4NyZ5tILOKmitD1WpNoCxm2p3ZRtWtyx/XiskPMvvWrLFD7C TD+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WTel/fQ7Gj1d2ni3sryAwF0T/iksivK0kIXjy8395Xc=; b=BOIDMrGfZ+c/EXX/GnapKpQWV69L+JQZnV26jNFSEWwGLOhYtUaV7s1/NwUJajbGjL PTcklEYMN49Y3Fw7tWh160Rt8TJmFTb8ET9JSyKdnTmfWIa4k6ZD8ky0cAkdeURaHQiQ x+I6RrVy2shL2EPrlytk/UZFZAYf35KIRF1EfQalzlJaMZaYbssPIGWkFy9MiXyYMjuY UY07YIMOTwifQHaOfTTYr4rKrLTKiy3P/MHKGTDawFFnpHTfC/Eop35gGQDKadfmVtuW 02UW2SsnARkBSRFC0FRT4/cbNqdQXW8sXUOGyNCzPL7/2qGjoogLE2R3u9ZHgg25z/Fp yITw== X-Gm-Message-State: AJIora9XG5A3s8PX09EN8s/zAqXy1R619Q7MpApWGx8ra2L3GRhqROX2 QSCfCUvg0VfyOC+v9BpNqmi2/z5txNG81Q== X-Google-Smtp-Source: AGRyM1sgupEzqc0OYq3gkYvgmmiVyjqtMnH8S6U3i8TflFaK4mTTKmwd+eWqZNsclgoSnsgmNoH0CQ== X-Received: by 2002:a05:6000:78b:b0:21e:a0fd:ce with SMTP id bu11-20020a056000078b00b0021ea0fd00cemr8658386wrb.309.1659016506054; Thu, 28 Jul 2022 06:55:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: mst@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 1/4] hw/virtio: incorporate backend features in features Date: Thu, 28 Jul 2022 14:55:00 +0100 Message-Id: <20220728135503.1060062-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220728135503.1060062-1-alex.bennee@linaro.org> References: <20220728135503.1060062-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659018474841100001 There are some extra bits used over a vhost-user connection which are hidden from the device itself. We need to set them here to ensure we enable things like the protocol extensions. Currently net/vhost-user.c has it's own inscrutable way of persisting this data but it really should live in the core vhost_user code. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20220726192150.2435175-7-alex.bennee@linaro.org> --- hw/virtio/vhost-user.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 75b8df21a4..1936a44e82 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1460,7 +1460,14 @@ static int vhost_user_set_features(struct vhost_dev = *dev, */ bool log_enabled =3D features & (0x1ULL << VHOST_F_LOG_ALL); =20 - return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features, + /* + * We need to include any extra backend only feature bits that + * might be needed by our device. Currently this includes the + * VHOST_USER_F_PROTOCOL_FEATURES bit for enabling protocol + * features. + */ + return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, + features | dev->backend_features, log_enabled); } =20 --=20 2.30.2 From nobody Sat May 18 17:15:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659018251; cv=none; d=zohomail.com; s=zohoarc; b=BwyzL1kjJBZ1bceurRQff7LEhkDpl5M0bqf+KHfhMgCZnghHWtNTKu9sG8r8glpiwlT2JeTHYCqUkufjEk2snZDwb3iUT54XhDhYwThtfUifRBmDSx5cOUsAdIWbVMwiU+T4lDi0Km89P40dzDGmKOu2UZPpxYIs0qQJYfcD5Sw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659018251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s3nGxeo53LwaMo+sziN/l2Vq3ARUUV/BFGaJ8lB68So=; b=Y9RqRqnyLtPgEsWRM0PF0XWgCSFlkzNMhdMZyRVum6TpEej6ZRQ/pP9d+nbagB4Im/j7kqKx58koiI1BwTx7Mekz3aJ7wmk5ufnpc19VDgW7d2Kw0Q8JZQ9ISwr31PETy6A3lxxkkFpCXF6TLFnSJY0YLaGGV8C/emcvZaiUFrA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1659018251434302.20594625164233; Thu, 28 Jul 2022 07:24:11 -0700 (PDT) Received: from localhost ([::1]:33128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH4Qr-0005Fv-Uz for importer@patchew.org; Thu, 28 Jul 2022 10:24:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH3yx-0003jg-AO for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:19 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oH3yt-0000O8-Iz for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:18 -0400 Received: by mail-wr1-x434.google.com with SMTP id k8so106401wrd.5 for ; Thu, 28 Jul 2022 06:55:10 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id n65-20020a1c2744000000b0039c54bb28f2sm1397186wmn.36.2022.07.28.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 06:55:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C53761FFBA; Thu, 28 Jul 2022 14:55:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s3nGxeo53LwaMo+sziN/l2Vq3ARUUV/BFGaJ8lB68So=; b=MGrs9tXDlvLXSSn7iB84K2BjzlHGW4MRyLBsDK66IfpiJRcqVGx9gqgLojWQu6ZTmA bIOmPkjmey2DYXMe3Dm/gKxU6v89usiaFqKialqe6kzKeSRVRBqI2OTHwyDWReBqfOB3 yW1yeTsJdPqKaMDkkLdmQkZafyU60uUQ21gtRBzYdIWjweyJX49zsSAkPJ+wH2i2KgZB OQCUwqBRKS/uMUnczv/iYOmjdvkdIRr+sH5Tq0tlxNpBUri7qJO+t29trYN2bekaBBsm FkIA/q18c6fEQ++sBGfq7upoCRz5v60LlU6qOumPtIzyAlUkSp/aVgeO+eUB47m5qVHX L4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s3nGxeo53LwaMo+sziN/l2Vq3ARUUV/BFGaJ8lB68So=; b=kVR7tdVa+z/Dt/rirWA6VN3sR9OhwhWKJqhmvPCxJkwXILFzumFRfwo9lDY3+bqyZt OpzqROSP4zrmXkKb8X1L8gEOJHeTHL4Oja3KCkYegym4U3fBkVixSCqF3v21+NAZ21v+ 1ryLHasvbR709ZwZi9HNmlAJM4SlbwV9K/wUPoFYhyAnwB4Yq/ZijRMyxkUy6aKs/Kl1 Os5napXwz1VDGBV9Wi0BYxxRdftCTS4QFKbYFi+VSUwmcF33daQIRS5m4C0JRX1LbUD9 NO8ArBNEemeKM+PKGqCVD65DaisUssLDCYLktg1OIEakVBLsGa/RphwOQlcK5+CNCgQB QCWA== X-Gm-Message-State: AJIora/9OrDEymwDGPQ37NElHUnJv+mpXD9y7SIvf/fND7jmq55yJ19v +UKu37I6Ih5nNsg9fim9ufG+UrXQ78E15g== X-Google-Smtp-Source: AGRyM1uPlByFFoPv3UiDPJRl1cyE8QuFEcDNHWIxbWL5pQVWEpAKeWK2sO1W6t+VBaGTgkydyOkFQg== X-Received: by 2002:a5d:648c:0:b0:21e:9872:5a38 with SMTP id o12-20020a5d648c000000b0021e98725a38mr10321607wri.556.1659016508197; Thu, 28 Jul 2022 06:55:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: mst@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 2/4] hw/virtio: gracefully handle unset vhost_dev vdev Date: Thu, 28 Jul 2022 14:55:01 +0100 Message-Id: <20220728135503.1060062-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220728135503.1060062-1-alex.bennee@linaro.org> References: <20220728135503.1060062-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659018253232100003 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=C3=A9e Message-Id: <20220726192150.2435175-8-alex.bennee@linaro.org> --- 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_de= v *dev, uint64_t size) dev->log_size =3D size; } =20 -static int vhost_dev_has_iommu(struct vhost_dev *dev) +static bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev =3D dev->vdev; =20 @@ -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; + } } =20 static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, --=20 2.30.2 From nobody Sat May 18 17:15:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659017286; cv=none; d=zohomail.com; s=zohoarc; b=lPxk0zkVTHSjiy+4XYANxV1QBZwroCGoEoChsdm4mK9D6HlhNd1eFcJYCF309hNFvQKSxF66ZojOtqAbIunp4VsX+6uw2AwwmXnJ3Y+RFxGYGYUynkDOCXs0akNth1vfEoWC2Kc+lDXV+eHzIROROPQQjQSR9Wl9G2HFLXHLrTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659017286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=fk+hawf5UsNmvdxGRMHLVx8sD5O4B4gjPzEfVZyLldhaGV1PkW1CdGUjCIAYksD526xHYe9qgq6DZfaageEamBYmlKENIy3AflhrFUyXEhPmfoa8XWt/0b8+4Bw4LKanLWVjuoKCSqSzR7vx/kC5fCiv/6LML+p4whQrkxG4IXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16590172861261000.4706286512875; Thu, 28 Jul 2022 07:08:06 -0700 (PDT) Received: from localhost ([::1]:39370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH4BI-0006Rm-Lz for importer@patchew.org; Thu, 28 Jul 2022 10:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH3zC-00040t-N0 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:35 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oH3yw-0000OI-B6 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:34 -0400 Received: by mail-wr1-x435.google.com with SMTP id k8so106449wrd.5 for ; Thu, 28 Jul 2022 06:55:12 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id l21-20020a05600c1d1500b003a326b84340sm6114560wms.44.2022.07.28.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 06:55:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DB9871FFBB; Thu, 28 Jul 2022 14:55:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=sgPyErciTNQttlWPS4JPv27YVf7tmojFhsZR9M/WZngizsHWCfovQpwMgyaCu3WxyN +ZWRwuKuS4XX1chuuVcV6JTIEVeywSGfzz0iMHQ7+hBO0Uz10nO0wZxtdfuriBZeI3su +WuGzOonIXeVtU4Y1YQmHHXd6NwFNlE0NZs4HBGRSVbCdBSKjKPsYQqHfTYae42/tMcN RRMYRD1sNkK77Vmg5WXBTcOWeT+O9blgS8mWNLbpOqbL94u+RaJiqAK1NBDLduRTjOSI bW+S01sSi2lvy/XJudEcIXf20iGdBa/He+6CG6I2scyT48KHrG1+RD3jZrt8lgUPARd6 mz9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=0hGtfqPMELLiBe8nt6XgaDKdXKDoyVmDtlQG0/y0yR+i1dG9D9ERTvRQa13TL8tQfR QZ0R/JrrirLF5It5u8Lay3zCHIcay5rRM0fhU5c2iSasbNMyxFsYPitpex4SpHzNFsqU 3D3YR4oCMA8bAjfMUS02R/iNyd8Bj+t2baf6zTjoSqOgtvTrmgZxtDd8oJ/ll1geq+EC otsk06DdPxnaUK1Q5gfhgiKRjzFkDGphL+sHH/g6AC8Rf3tOjveixp7LsHh+cvzAYpX+ Emuc7AlnIVEAvRO0+MNLZXuqoq4eLu+OxPm5VOmXdhY7QaY45T7427EJrqKJBGM6vwVH lQpQ== X-Gm-Message-State: AJIora++aRlZ7oK1Pw8NM4Ry4bCLL+eYKAZaANbpnzPqZ2XkCS/GOBeD U9uSY360pC8bhXgmUvoh2zGlxNi+LMuB7w== X-Google-Smtp-Source: AGRyM1sRG6pgvhAHMH0Ny6QKbtFjgT401bL/pV0TdYiDaIfPFDWAPHUnsQZOlG93RyfFVb6YtminMA== X-Received: by 2002:a5d:6642:0:b0:21e:f918:b093 with SMTP id f2-20020a5d6642000000b0021ef918b093mr2098786wrw.173.1659016509030; Thu, 28 Jul 2022 06:55:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: mst@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 3/4] hw/virtio: handle un-configured shutdown in virtio-pci Date: Thu, 28 Jul 2022 14:55:02 +0100 Message-Id: <20220728135503.1060062-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220728135503.1060062-1-alex.bennee@linaro.org> References: <20220728135503.1060062-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659017287200100001 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=C3=A9e Message-Id: <20220726192150.2435175-9-alex.bennee@linaro.org> --- 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) =20 nvqs =3D MIN(nvqs, VIRTIO_QUEUE_MAX); =20 - /* 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 =3D=3D proxy->nvqs_with_notifiers); =20 proxy->nvqs_with_notifiers =3D nvqs; --=20 2.30.2 From nobody Sat May 18 17:15:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659018250; cv=none; d=zohomail.com; s=zohoarc; b=mr2UuUX94opq2vA/sCO16vWe2ilIeqhYtNrErwz736u3l+kr/qeRyneBtrmzM6ctaOa/Koc64nbkE1VoNt53BTW4fnt5p1MIhyfecD/koDAAnXcljJr2WsF5WegL4ku97T2A1f54NOKXFHwubIrCVMe/661uP/q1c0li64eltgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659018250; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5cs2obCibuFrGV6ezAp7TXix+CRt2n51MrtUoaGrvvI=; b=YMjTJZqsmC2foOco6dJ/X6enJAgpHugsE2JSCQAOMVxjX6iMbBsB93lV2nbttvqtEKtL3dgvEzf6dB+poi59fK+lY6qvltrdOywu1X6rR1erKRNcGNYtd44+9PNKRxw0bpeMa3whhDWjcRFpNfuY/0Wellq7kg+Lmxtyf66c6rc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1659018250750742.3768654793541; Thu, 28 Jul 2022 07:24:10 -0700 (PDT) Received: from localhost ([::1]:33142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH4Qp-0005GD-LA for importer@patchew.org; Thu, 28 Jul 2022 10:24:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH3yz-0003lh-9H for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:21 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:33448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oH3yw-0000Of-AU for qemu-devel@nongnu.org; Thu, 28 Jul 2022 09:55:20 -0400 Received: by mail-wm1-x32a.google.com with SMTP id a18-20020a05600c349200b003a30de68697so3399129wmq.0 for ; Thu, 28 Jul 2022 06:55:14 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id y8-20020adfdf08000000b0021e084d9133sm1296133wrl.27.2022.07.28.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 06:55:10 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E789B1FFBC; Thu, 28 Jul 2022 14:55:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5cs2obCibuFrGV6ezAp7TXix+CRt2n51MrtUoaGrvvI=; b=MrnT4XOU2T9Hl+vLx07czaWcVUXSw2LsafTLH/hmjIa1Ea9ftq2AA2jeTte5zxGdz8 ExMYhS6Ws/1l8HsbBsXgmAqXuawDQxNmJqVA9IQFP8SFbIt23lP+WqXqeoLIyGAq7HWv GFecnfQQY+qZgT2NKbjaxO3OFxCAF8vDbSm93slLwYn3lYHWUqaWTGKNMi7hlakqANSz Tjm5Xugeu4NbKbbzFhm6OHSxApun4idvy4ow6aJoo4rWSvKxI7RkJB7sdf6vVFUuOT4p wL9BIr0t+T3D5W4eQd/jLJeprK/c3MbMdXj+vKXjrcvxDwaVZ+HrWYuU+eOS6GOe/Rsr e5qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5cs2obCibuFrGV6ezAp7TXix+CRt2n51MrtUoaGrvvI=; b=44GOUUGcY0xdrcsDjAAMe/i6Hfnlf/y3ykJF6wBzzr2QkvFmxW6ni4XBbgaBFfWV9L Jm1yURH0l10dwzB72VPt30rEwA6GdJbozAvrcQmMqKL0lfBg6UMj/mvy8aj3cOKHzbLc rCnUX+8nhLz+d+MdJPG8++YooBZhteHp1yyts97dNHqw07uizH8edvsFgzyqd9Wji3h3 fi94xkWXYWzyD71GDMdlRnx8zEGWXisBxteYclRlV3sp7Vaw37N1Sb4HNTg9quRMZxbC mRRAynpVoTe5ZpWF8lTPuY1GtHEpfpxMfz0tSfNRbTDr4xZExffBb45pYXdBV54epAeM /p8A== X-Gm-Message-State: AJIora8jlO4TamIqknk9yKWqm9HT1fr2UyknQ1601iHPnyztERfMzq+/ WN0pW/J72leavXi3PyIddigW4w== X-Google-Smtp-Source: AGRyM1tzbg688udxUa8TGpS1SbldNgpcIFJ+YMHqqUGHkwCYmhdmciD6Vlexk8ij4DkU5d3gPjOoMA== X-Received: by 2002:a05:600c:190b:b0:3a3:45c5:9f43 with SMTP id j11-20020a05600c190b00b003a345c59f43mr6661857wmq.130.1659016511371; Thu, 28 Jul 2022 06:55:11 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: mst@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jason Wang Subject: [PATCH v2 4/4] hw/virtio: fix vhost_user_read tracepoint Date: Thu, 28 Jul 2022 14:55:03 +0100 Message-Id: <20220728135503.1060062-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220728135503.1060062-1-alex.bennee@linaro.org> References: <20220728135503.1060062-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659018251437100001 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=C3=A9e Acked-by: Jason Wang Message-Id: <20220726192150.2435175-10-alex.bennee@linaro.org> --- 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 1936a44e82..c0b50deaf2 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; } =20 + trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + return 0; } =20 @@ -544,8 +546,6 @@ static int vhost_user_set_log_base(struct vhost_dev *de= v, uint64_t base, } } =20 - trace_vhost_user_read(msg.hdr.request, msg.hdr.flags); - return 0; } =20 --=20 2.30.2