From nobody Fri Apr 4 05:13:38 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=1739930701; cv=none; d=zohomail.com; s=zohoarc; b=av/l7oqFTOtsPHGvuDuYz2oHTnE30uOB/ejQ0AqPt61tQxboyZUKc9+be3B1AmARdbB/GLb255wFSAKT9/iL8RDEoVjlpcjDnqO5Su7Qw5EiOi0JCHiNiqiII2nfEyaAQCLurVUskzaH31TwTM1UWPHL7HtC8Tlcohup/sar158= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1739930701; h=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=D6LgqpX03QwL6L9d1sOao/5xpDf5ua9wvYOQ+nsrjqA=; b=KqsEAjEZCDidbZCLC5SKKLSAdzUgjco7tggDJuJzu3UpuwWgGsLmqNg2uVQ3VcPoaxJy2SCRqREdY70duvbC1rXi1TTJ7m8CQybavT+TgVgAgUNwUM8/AtPEr02ZQ6tG4vmmiVOfEMhEoumkVYYMqiTzpUBvbSqzPlWWM7Ins2c= 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 1739930701485588.7643338374634; Tue, 18 Feb 2025 18:05:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tkZRj-0005U2-71; Tue, 18 Feb 2025 21:04:19 -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 1tkZHo-00041B-7Q; Tue, 18 Feb 2025 20:54:04 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tkZHm-00035e-Gm; Tue, 18 Feb 2025 20:54:03 -0500 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-21f61b01630so5802625ad.1; Tue, 18 Feb 2025 17:54:01 -0800 (PST) Received: from localhost.localdomain (172-234-80-15.ip.linodeusercontent.com. [172.234.80.15]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-adb5a92d3basm9862675a12.75.2025.02.18.17.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 17:53:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739930040; x=1740534840; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=D6LgqpX03QwL6L9d1sOao/5xpDf5ua9wvYOQ+nsrjqA=; b=OuPCwHlG5qcH0dBMraAwUUDMQo+49ekbCXg/6y795iBJwx9UR5rnB9a8yXoCO3Q3Vp 0kpAXsH+nwsJGr5hhW9n12Y/Bc+C5kv1dfZ3WMIJDeW2sGbpog4rhKC643U7SCyCAeu7 5E/1bz9i266T+rMusL1/+TBD++26LFbZAn2u7xRFiwQPWvmIqUcXI/4dIvANKlY0ZGtK WH9WIUhG895wujYl+ZRePZY1GDEcb6ojFFVyFOeJDVkPMSqI/+3Uym0Pbv7goXp/bc9P WDH9vA+9g4Grafj8Mjo5JNrPeM0LWk8oKpQvZ/Y9sm1jSVYwkIrHzQfHpahvIt/ZYic/ qETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739930040; x=1740534840; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D6LgqpX03QwL6L9d1sOao/5xpDf5ua9wvYOQ+nsrjqA=; b=cg5/KM06Tt3JRJfkL3KPbN4HA/XNDEhJAoAdtL+4vLrVuiABP9KzicExznql3nIwC4 FeJaAntdHBO6c2RfXMoP1LH9AhL7GE8jmfTb1MWLo3OqURZC9JNDgs6XXPl88ru50pIq zQDurjlzS44BDcIrmsAEN6w+44cubRFjoTixtnBIWMr8YgtjgIKEdI8vjlGLp4wKgn44 ewnBZABjrW21Re/9hTaytUvv6BBs8OGxjTBvc+3WHwRo5Wn+nlYw5nWhgG/kaeJlNzXk HaWfFmYT/8OmGsXgaMi1u1R/ZDOsU+S3dRqC8fm7oOgd3cHRgqhom9HYM7bFf2vR2Ikb AakA== X-Forwarded-Encrypted: i=1; AJvYcCW4kkdzjkdXeRCfrUfAqUbYweDKjPiUK+y/D/jVwnDkwhDkt21Zu1J6uGqwJnuLcIb40wUUZo6bpvVIOw==@nongnu.org X-Gm-Message-State: AOJu0YzfwvNqSZBzKy56DpWeL90oeGr5VLFWBDFl5+0VQsvoRSKyHN93 ly0ByeqpLWzY3TdHcavL34SJReqLk+6Tu5L8fYU/mVLMSbHJMGZh X-Gm-Gg: ASbGncv/HJalJGg4+seUL8K3oZBfskO0TzPZJYqXuPdQPre95Go1cf0ObhJApYkPz// SpJBHRJ7LwbDZMtFjXaO/abHmMRy1fdtbkXARdv7V62xnCTX/eO6X1P9L2CVYydxwUGZcSc0YDj WMGICWP8CL8SqxFD0JCJRyCB3UXGTTD+uy0vvuqMynjua7hCxSaV6mp8MC42/Ur3NqxlpbeSywS eoNiEAuCs2+m+775TbmhUVhYvKaJKHg+fSpSYqlwJmeMqWc2Y7fsRXMCFA9esVx+CdnY4LomSaJ BpdnimqDvPazcDzV/R9Z8INj+C0I+LOigiUhcTjwcgEar7ReWTWaovakfuXn7wI/1Pgxnludmw= = X-Google-Smtp-Source: AGHT+IHUdqNI+toHhDdZgO7OpcEjvpW9TqZ5xV5NvHWXOCzLSFuYlTo9ld4Ag8Xu3fo9Cy2J2wTJxA== X-Received: by 2002:a05:6a00:1886:b0:732:6a48:22f6 with SMTP id d2e1a72fcca58-7329cf56ec1mr2978748b3a.9.1739930040471; Tue, 18 Feb 2025 17:54:00 -0800 (PST) From: oenhan@gmail.com X-Google-Original-From: hanht2@chinatelecom.cn To: mst@redhat.com, sgarzare@redhat.com Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org, Huaitong Han , Zhiyuan Yuan Subject: [PATCH v2] vhost: Don't set vring call if guest notifier is disabled Date: Wed, 19 Feb 2025 09:52:35 +0800 Message-ID: <20250219015235.130194-1-hanht2@chinatelecom.cn> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 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=2607:f8b0:4864:20::629; envelope-from=oenhan@gmail.com; helo=mail-pl1-x629.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, 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: Tue, 18 Feb 2025 21:04:14 -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: 1739930704924019100 Content-Type: text/plain; charset="utf-8" From: Huaitong Han The vring call fd is set even when the guest does not use MSIX (e.g., virtio PMD). This results in unnecessary CPU overhead for handling virtio interrup= ts. The previous patch only optimized the condition when query_queue_notifier w= as enabled and the vector was unset. However, if query_queue_notifier is disab= led, the vring call FD should also be unset to avoid this inefficiency. Fixes: 96a3d98d2c ("vhost: don't set vring call if no vector") Reported-by: Zhiyuan Yuan Signed-off-by: Huaitong Han --- v2: - add Fixes tag - cc qemu-stable@nongnu.org hw/virtio/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6aa72fd434..d17e7cc6fe 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1342,8 +1342,8 @@ int vhost_virtqueue_start(struct vhost_dev *dev, } =20 if (k->query_guest_notifiers && - k->query_guest_notifiers(qbus->parent) && - virtio_queue_vector(vdev, idx) =3D=3D VIRTIO_NO_VECTOR) { + (!k->query_guest_notifiers(qbus->parent) || + virtio_queue_vector(vdev, idx) =3D=3D VIRTIO_NO_VECTOR)) { file.fd =3D -1; r =3D dev->vhost_ops->vhost_set_vring_call(dev, &file); if (r) { --=20 2.43.5