From nobody Sat Dec 13 17:00:41 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1765462625; cv=none; d=zohomail.com; s=zohoarc; b=Amxn3TKwdDRi7nr+2frlhQUSH0BQmnyiGWFE6kVSY9LVQYIw6Oqs5xLYOhIQev9pfsNj9tRG6xlt+zZnjq1QTCKOQDt6zdxy/UTdLcvUjztGBC3264+jOcUUWkjD8FalcHliwWjOJG8aNnqaCBlPoZ9EPE3xDBFCjoHpjSd/I5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765462625; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aC0QiZKr/3DLPytD5Vsp0YSN+Shd7hwrvtulRp6ZC7g=; b=lk3HbsHLWua4z7gfbjnluJWHKV+22CPfblIjefrNSbAX89URouFot4nfQJqi5jyCV6dd+yt0/tUlnOWi0KuJfhtTHrHQ6lRovxQme6quF3Ig3otW+lq15qWeUwBGYuSdOcKRADiMMRtrrt7bpPWXQ+vWhEAaRyNDvhhu0iBRsm4= 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 1765462625514706.370106880645; Thu, 11 Dec 2025 06:17:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vThT9-0000Ol-1h; Thu, 11 Dec 2025 09:16:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTccU-0005q3-Ay for qemu-devel@nongnu.org; Thu, 11 Dec 2025 04:05:54 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vTccS-0005o6-GU for qemu-devel@nongnu.org; Thu, 11 Dec 2025 04:05:54 -0500 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-4557b865e60so424044b6e.0 for ; Thu, 11 Dec 2025 01:05:51 -0800 (PST) Received: from DESKTOP-M2KV102.localdomain ([66.112.242.31]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3f5d5156631sm1285671fac.19.2025.12.11.01.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 01:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765443951; x=1766048751; darn=nongnu.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=aC0QiZKr/3DLPytD5Vsp0YSN+Shd7hwrvtulRp6ZC7g=; b=Y+Y0Nin8ngx58vri0gcgHleDrOysX79nu4QQSLxylG7XIwmIttTxyv+ORq4slnguVB 74FBoxO+jZQLBIcwfACuOH8brCjCI+NMS2mcPMt5mSZjR1Tk1bwLNizZbnqhpD8fX6Zy PIJU6a7ygx/8oqMAA0GPis6r5AJB2aSCznNdv8xlROBU4eKFtlAUxEgrlgtVwL8XWVNQ knYVtPI4TVLM4H+hbqZ1M8Uh+qTb1BZVGdKcyK1F/JbDJPyx2rgGyUpEXgh3HnbzUxlG CPj4pXzp5eor3BpUedBVYWFIemPjXjjtGrrwfkTuLaQDUSM4jKSrEHPjWm2hTcaSyXEd U2Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765443951; x=1766048751; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aC0QiZKr/3DLPytD5Vsp0YSN+Shd7hwrvtulRp6ZC7g=; b=gkmlG1/kgiAfVsf0eg2/lT1W+KFjvgR8Ey7IXrmU8DxvxwArJxDOZ5dMya5z7uWUyj kKSlGhFpHkRQ1oBiQyYef4StMP+poNyMVLZROrBaxz26HjIoK3cAeH000HsXX45PaKp5 Qmrb58HC0hD21iYn9oIXb/F3cJ1TTBa1fP9Ue2ViS33Z2UXrSEuhyPvCQDD1FP2VPtSL bhW4aa/3Jvro9TWLbAqlev2uLRWscz/ogqONxVwJecTITftV3tx8nDzCYU1uWk2HyHCm W/2bRW21wwG5OXpK9TlNv2M8hIqDCZCj/31nDw1cNxWaZ6lFn9/XH9fDkPzAfq9EL6+j IVdQ== X-Gm-Message-State: AOJu0YzKfiSpRgHptLUNKScjW4lQI5egnZqOEQNRaOD4qD9JugfIdepG mO0oRdOyT95S0ghau6q2YIKON4NVuzpiJRdq7WMZqRYjb8Ggjxc2iYE1 X-Gm-Gg: ASbGncsiaKZiaX4ayE3+LU8JvqNuf6P/KqV7s7hb7fdcMDE2i1Q4nnc1gm7EVk25fRp 7IEEUPZlcscvd7VwXzDtdVcJ+kL6jSrhHYXUZp/fCvk7txwRq8vw4+jp8QGfjR+5nveI20GVo5u DKX/mZHpzhL3TYhK9Ytkmw9Oa8a5sTIru+1C0jyOCxf0jSHMgZxcuOmUDaSt6OHOenChpKnOADb VtIbb1BLAPLQVqTOLjLbNSfYurN+uYBMReP6v9kr1xNaG3KfxWumPTzOv7DNIR8BN0T+WjIQaky A2eoX5Qzi2h25Z4fwyNCS7K7kp9gAhDM8PTbJ5DtJP0MAT3t0T/BrhvP9K1wxOKenzdNyvVmKU9 ljG/ZG1q9GEsH5cQEMyj2IkQsdT+CHg8nAGaEFA7dOv0IiwdJw6QjrjBbCDy1D2ni5TKCATUYqW +WRlavsPIKI6wNEl3xJDwtCyHbCfsZ+8tN X-Google-Smtp-Source: AGHT+IHB/b7LaZBKC5FO1HwvvHgHTr1Zqj7Gshvi/2mtEtRdifon0CHGV9XVt7IpZ3YUOp/70Hew9g== X-Received: by 2002:a05:6808:2189:b0:44f:e3d2:59e3 with SMTP id 5614622812f47-455866f5ea9mr2998679b6e.32.1765443950748; Thu, 11 Dec 2025 01:05:50 -0800 (PST) From: Aaron Lo Date: Thu, 11 Dec 2025 03:05:49 -0600 Subject: [PATCH] virtio-balloon: only create statsq when VIRTIO_BALLOON_F_STATS_VQ exists MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251211-balloon-check-stats-feature-v1-1-ae8951957b80@gmail.com> X-B4-Tracking: v=1; b=H4sIAGyJOmkC/x3MQQqDMBAF0KvIrDtgUqzSq5QupulXh0pSMlEE8 e4NXb7NO8iQFUb35qCMTU1TrHCXhsIscQLru5p86zvnneOXLEtKkcOM8GErUoxHSFkzuIfcugH tdQigOnwzRt3/++N5nj9ZtL9FbQAAAA== To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , David Hildenbrand , qemu-trivial@nongnu.org, Aaron Lo X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1765443949; l=1841; i=aaronlo0929@gmail.com; s=20251211; h=from:subject:message-id; bh=zbYfKIjnxCYX9hf677K+YYy9OUX21TXa8Xc2wOm3EEY=; b=Zh5q2llRkh4wrmuwNmVvf6In6FbRSzr7LsAzJLevx9rntkM2MuNb6bDMq+n7nzVDfGY/nTgeg CFrbMUr8CpID5SFKWIoacfnKVIuofwwl0w0rlEF3s1HtYtOSpD10Gc/ X-Developer-Key: i=aaronlo0929@gmail.com; a=ed25519; pk=8NbKHVJf2P8RqSXZ1l7w/K5TBnYs2yM+kTVDpAi9TP8= 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=2607:f8b0:4864:20::230; envelope-from=aaronlo0929@gmail.com; helo=mail-oi1-x230.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 11 Dec 2025 09:16:08 -0500 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1765462626977158500 The VirtIO specification (section 5.5.2) states that the stats queue is only present if the VIRTIO_BALLOON_F_STATS_VQ feature is negotiated. QEMU currently creates the statsq unconditionally. This patch guards statsq creation so it occurs only when the feature bit is enabled. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3188 Signed-off-by: Aaron Lo --- hw/virtio/virtio-balloon.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 02cdd807d7..f5d4d5f60c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -892,7 +892,10 @@ static void virtio_balloon_device_realize(DeviceState = *dev, Error **errp) =20 s->ivq =3D virtio_add_queue(vdev, 128, virtio_balloon_handle_output); s->dvq =3D virtio_add_queue(vdev, 128, virtio_balloon_handle_output); - s->svq =3D virtio_add_queue(vdev, 128, virtio_balloon_receive_stats); + + if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_STATS_VQ)) { + s->svq =3D virtio_add_queue(vdev, 128, virtio_balloon_receive_stat= s); + } =20 if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_FREE_PAGE_HI= NT)) { s->free_page_vq =3D virtio_add_queue(vdev, VIRTQUEUE_MAX_SIZE, @@ -932,7 +935,9 @@ static void virtio_balloon_device_unrealize(DeviceState= *dev) =20 virtio_delete_queue(s->ivq); virtio_delete_queue(s->dvq); - virtio_delete_queue(s->svq); + if (s->svq) { + virtio_delete_queue(s->svq); + } if (s->free_page_vq) { virtio_delete_queue(s->free_page_vq); } --- base-commit: 9c23f2a7b0b45277693a14074b1aaa827eecdb92 change-id: 20251211-balloon-check-stats-feature-7ea658e038ce Best regards, --=20 Aaron Lo