Message ID | 77b9150c60b3f26ea235cb7058b9b24bca6234f8.1697644299.git.mst@redhat.com |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=X9yKe+F4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cly3Qx5z20Pd for <incoming@patchwork.ozlabs.org>; Thu, 19 Oct 2023 04:09:50 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1qt8vK-0005wu-Hl; Wed, 18 Oct 2023 11:57:30 -0400 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 <mst@redhat.com>) id 1qt8u0-0003Di-St for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mst@redhat.com>) id 1qt8ty-0006vL-A9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644565; 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=ySJRsoNBBcgqyKONkpVDvYCkflnLmxrOPirjci4NdfM=; b=X9yKe+F4jBaALb1HZAe7APAX8RbY0MpBZg4FqMJgm4oV2s+K/nf7zDQd2AboqjuCLZqxA5 jqZ8KOofk67DsgJBBoI9HDyNdQirwqXgeA2uA5Bz/k6mV6y9YNZXzsDZ1BzLVoXdfo5ks+ IycxHixr8Ps5nlljiDW/N859+dfXBgc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-386-PPKDzwwSP2agZjUcacNYdQ-1; Wed, 18 Oct 2023 11:56:04 -0400 X-MC-Unique: PPKDzwwSP2agZjUcacNYdQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32d83fd3765so4284056f8f.3 for <qemu-devel@nongnu.org>; Wed, 18 Oct 2023 08:56:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644562; x=1698249362; 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:subject:date:message-id:reply-to; bh=ySJRsoNBBcgqyKONkpVDvYCkflnLmxrOPirjci4NdfM=; b=V6bUmaFhx/RazfB4NNdzGKFEnEYctxRZAS38y95H1QghINpMK1+t1otqQaaTTUBOv9 YjnfVzVd5wzz/DREVrEI+Sxnk45tSVFpUKelvvKqx/iCuKy94heFvJkRW83unNxgbf3i CvEGsh9bn5meCyuHV2yc9MlT6w3eV9hygS88qN7gMEetwVSA/mj68ZDt26SSKlELn8x8 OXHAdO6vof+kBBhI2WKkGfXKLRhj6ljqUfPiwXVz18gC6q8+En/ypkze9aF3n70uUhng cg27YE248UMZTHVQjYbiQrTAJvZcR8ZBHsyxtjsufkeI2uNt4LaFePmw8o/sudzch5i1 /NZA== X-Gm-Message-State: AOJu0YxV67cYopgwvCassUYv12c5jVcZ4l0n8lMYVfBNNxCYlVkaVKoW peOqkZGBcgbuJNKOikJG5cKxXd3UaM8H+RJ9PTIAwJSs+VW/6FL5lljxLh3WgrR7BvKI9ep1T80 4JOLw6KyVv1Ce6qOdK1zt4uVcNZDtfAeB6F8G5QeSc/gZDsLptWQWkpE5++DfrxlQ0zpRIeQ= X-Received: by 2002:adf:e387:0:b0:32d:9391:b3ac with SMTP id e7-20020adfe387000000b0032d9391b3acmr4517540wrm.60.1697644562075; Wed, 18 Oct 2023 08:56:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEy21dC1Fia4eHdmGNTNpqRhVdk4v6akZ2USc4SPpkw5jcBZdQS/2hzcBmIGgPScHIWo72cIg== X-Received: by 2002:adf:e387:0:b0:32d:9391:b3ac with SMTP id e7-20020adfe387000000b0032d9391b3acmr4517516wrm.60.1697644561664; Wed, 18 Oct 2023 08:56:01 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d14-20020a056000114e00b003232380ffd5sm2363989wrx.106.2023.10.18.08.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:01 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:55 -0400 From: "Michael S. Tsirkin" <mst@redhat.com> To: qemu-devel@nongnu.org Cc: Peter Maydell <peter.maydell@linaro.org>, Laszlo Ersek <lersek@redhat.com>, Eugenio Perez Martin <eperezma@redhat.com>, German Maglione <gmaglione@redhat.com>, Liu Jiang <gerry@linux.alibaba.com>, Sergio Lopez Pascual <slp@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Albert Esteve <aesteve@redhat.com> Subject: [PULL 35/83] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Message-ID: <77b9150c60b3f26ea235cb7058b9b24bca6234f8.1697644299.git.mst@redhat.com> References: <cover.1697644299.git.mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <cover.1697644299.git.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org |
Series |
[PULL,01/83] vdpa: Use iovec for vhost_vdpa_net_cvq_add()
|
expand
|
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 7e452849fa..427ee0ebfb 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1225,7 +1225,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state, false); + /* + * SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / + * control plane thread via unix domain socket. Virtio requests travel + * from guest to vhost-user backend / data plane thread via eventfd. + * Even if the guest enables the ring first, and pushes its first virtio + * request second (conforming to the virtio spec), the data plane thread + * in the backend may see the virtio request before the control plane + * thread sees the queue enablement. This causes (in fact, requires) the + * data plane thread to discard the virtio request (it arrived on a + * seemingly disabled queue). To prevent this out-of-order delivery, + * don't let the guest proceed to pushing the virtio request until the + * backend control plane acknowledges enabling the queue -- IOW, pass + * wait_for_reply=true below. + */ + ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state, true); if (ret < 0) { /* * Restoring the previous state is likely infeasible, as well as