Message ID | 6c478515242e3dab419de4080f57010dec5694ba.1697739629.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=iC6HU0TF; 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 4SBGV32YHYz23jP for <incoming@patchwork.ozlabs.org>; Fri, 20 Oct 2023 05:30:03 +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 1qtXhP-0000WQ-5B; Thu, 19 Oct 2023 14:24:47 -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 1qtXfV-0006px-Me for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:22:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.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 1qtXfK-0000n1-6U for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:22:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697739757; 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=iC6HU0TF3OmGvfp3ENJa0q4Qj+6y6JyhDhSfP4kQC34VawZIAiInb+7mbouyXzIExUgWQZ aN2bak72A61UxRtdy/lKRFL9JPzIVy9ehREkU4cZvFdDBLvwTpjTRkoCvorBOwpIgorNtM xLNBLYpGBqDRCBYCwxAmwTTsiP9b0O8= 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_256_GCM_SHA384) id us-mta-639-YT2dHTFJOMicly_01mtu1A-1; Thu, 19 Oct 2023 14:22:36 -0400 X-MC-Unique: YT2dHTFJOMicly_01mtu1A-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083717431eso16708335e9.1 for <qemu-devel@nongnu.org>; Thu, 19 Oct 2023 11:22:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697739754; x=1698344554; 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=p6861LOy8s6wjZppZuYKcJK37bVFnRaen3tO71PxtUgODPKfX9cAiTN+GCx+cET428 mD+QQQYdMzjpkIil0uBtl9OFSJCAOs1emB/DsJ1h/GAuhA0Ep0vCTbrpT47AVgvboyQq 9rkpm4IU2M2EfV7b1V0egoAtksI9KH9nor1/+HshGAtHhOEpWlm8xCa/MCg9ObxMc7cG fIwVTNI0oHeNsVYuBXDnJPwnenZlMEyxKEXkGh83E+7I6pEydD+75p9OtPF/7c+iTS2P 6vdy8uBkDE+nFIFnfO4T3I4froQF34QBO4NqZrGC7ohIC7NUl5ZevZudDz7bOoTzxTy0 QrqA== X-Gm-Message-State: AOJu0Yxo7nKx/6Bm2FH/5ljn2J+lR3AvzI+NmIHWDESCTRqqOeUw4too z3ctdCUZpCi3UwVdXzHODKSJnvKMX2QvHYTwDOkYDawV7hkTd4WpYQ3Gq4ED+x7+09bAsyUJOGo CfOHKU3OnizrDQtk1v2mHy0NvquJz9copn4Lw8EslCcfjmBH2jz3D92j7uel+OcB656pf X-Received: by 2002:a05:600c:3587:b0:408:3a67:f6f5 with SMTP id p7-20020a05600c358700b004083a67f6f5mr2571176wmq.18.1697739753936; Thu, 19 Oct 2023 11:22:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEaB+RGkkKBYgVwXoXJ/11EsuYJ3sRhe60nVn+zT1LRTHudHfPPGvPoJghxAQa0XJ9j2TcG0g== X-Received: by 2002:a05:600c:3587:b0:408:3a67:f6f5 with SMTP id p7-20020a05600c358700b004083a67f6f5mr2571152wmq.18.1697739753400; Thu, 19 Oct 2023 11:22:33 -0700 (PDT) Received: from redhat.com ([2a06:c701:73d2:bf00:e379:826:5137:6b23]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c220600b0040684abb623sm4940395wml.24.2023.10.19.11.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:22:32 -0700 (PDT) Date: Thu, 19 Oct 2023 14:22:31 -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 v2 30/78] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Message-ID: <6c478515242e3dab419de4080f57010dec5694ba.1697739629.git.mst@redhat.com> References: <cover.1697739629.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.1697739629.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.129.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_H4=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,v2,01/78] 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