From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84771C1B0D9 for ; Tue, 8 Dec 2020 07:35:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51EC423A81 for ; Tue, 8 Dec 2020 07:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727290AbgLHHfa (ORCPT ); Tue, 8 Dec 2020 02:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgLHHfa (ORCPT ); Tue, 8 Dec 2020 02:35:30 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF21CC061749 for ; Mon, 7 Dec 2020 23:34:49 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id ga15so23248329ejb.4 for ; Mon, 07 Dec 2020 23:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=Ql2AB5GySJ65IFMHnw4MwFF+6A1fSxUbm0S/QCOsRh1e9K/RdvI9O9Yt/4u9lp/8zU WXpOxpcxkqc0ECWU/gBhCpde+JT2de7S+dnMJ/ThfJ2V2LjxOF40eH+xPBzu+Q/qIrx+ IwJMliL/zNWO3P9FiZ3xRymHceBHcF2+A/XrgHm9IFQRlZCouH6KOsfRn0s5kND6IZsW ogcY6Q8BQynWXyWAzonWHDSrCT8Sypi5HvX/2Vh7p2n6UQ6hmXMEakUREVC0a87Bb0xI dc7Jx8nAnn6wruao79UPpFzmcbZp7kLhkcFlYOKujv5rwvsUxw/3IHEMFG9ts7W0/Zd7 gtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=iQ1HTgoCMIQ6LpmTCyvifQxdyB95nUwZW9YVao1wSMtXkfzctMzcM0HMXSw5eE5dK/ ZnLUgjH1MHDqYt0EVHk5B0PoESADyKXdN4rmJO/buk1ReoYBjxxprDYYPWmXSeOB+7HG qFsiNVzo5p1pt8DcCPlGll+qsINNvPubeVRwEb/o+tsyZWECD22fFWSmT7cZ6ixkUPAz SaKNZnVlR+73ZZ02Q3mrgfNb5NHzmHaOt7IfU8Alt4Aw+e6cZ22CT9ZCZatb9IPvv1z0 TE+wqPrJYS+Q9UmDEqwpcywzbj9y6MNSkxJRq668roeDDxpIJCUb1cRhWk/F5PkbAKcY 5RnQ== X-Gm-Message-State: AOAM532NyBjjDCvgQXpA1Evz3Tdtc3iHr3tyV9GFmlvZq7ihDQU4fp7u dP+7EEZEZthd+87veG9SPE8= X-Google-Smtp-Source: ABdhPJyAJ58CckXILtlZ1T1LSuVkaaFCXE8XFbVwePtP2qOXF2umzTx1ojn2UCAcCz94h+QkAZmFtg== X-Received: by 2002:a17:907:444f:: with SMTP id on23mr22557982ejb.300.1607412888472; Mon, 07 Dec 2020 23:34:48 -0800 (PST) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id mb15sm14605264ejb.9.2020.12.07.23.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 23:34:47 -0800 (PST) Date: Tue, 8 Dec 2020 07:34:46 +0000 From: Stefan Hajnoczi To: Eugenio =?iso-8859-1?Q?P=E9rez?= Cc: qemu-devel@nongnu.org, Lars Ganrot , virtualization@lists.linux-foundation.org, Salil Mehta , "Michael S. Tsirkin" , Liran Alon , Rob Miller , Max Gurtovoy , Alex Barba , Stefan Hajnoczi , Jim Harford , Jason Wang , Harpreet Singh Anand , Christophe Fontaine , vm , Daniel Daly , Michael Lilja , Stefano Garzarella , Nitin Shrivastav , Lee Ballard , Dmytro Kazantsev , Juan Quintela , kvm@vger.kernel.org, Howard Cai , Xiao W Wang , Sean Mooney , Parav Pandit , Eli Cohen , Siwei Liu , Stephen Finucane Subject: Re: [RFC PATCH 09/27] vhost: Route host->guest notification through qemu Message-ID: <20201208073446.GP203660@stefanha-x1.localdomain> References: <20201120185105.279030-1-eperezma@redhat.com> <20201120185105.279030-10-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CKf/2jVYos1l2hij" Content-Disposition: inline In-Reply-To: <20201120185105.279030-10-eperezma@redhat.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org --CKf/2jVYos1l2hij Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 20, 2020 at 07:50:47PM +0100, Eugenio P=E9rez wrote: > Signed-off-by: Eugenio P=E9rez > --- > hw/virtio/vhost-sw-lm-ring.c | 3 +++ > hw/virtio/vhost.c | 20 ++++++++++++++++++++ > 2 files changed, 23 insertions(+) I'm not sure I understand what is going here. The guest notifier masking feature exists to support MSI masking semantics. It looks like this patch repurposes the notifier to decouple the vhost hdev from the virtio device's irqfd? But this breaks MSI masking. I think you need to set up your own eventfd and assign it to the vhost hdev's call fd instead of using the mask notifier. >=20 > diff --git a/hw/virtio/vhost-sw-lm-ring.c b/hw/virtio/vhost-sw-lm-ring.c > index 0192e77831..cbf53965cd 100644 > --- a/hw/virtio/vhost-sw-lm-ring.c > +++ b/hw/virtio/vhost-sw-lm-ring.c > @@ -50,6 +50,9 @@ VhostShadowVirtqueue *vhost_sw_lm_shadow_vq(struct vhos= t_dev *dev, int idx) > r =3D dev->vhost_ops->vhost_set_vring_kick(dev, &file); > assert(r =3D=3D 0); > =20 > + vhost_virtqueue_mask(dev, dev->vdev, idx, true); > + vhost_virtqueue_pending(dev, idx); Why is the mask notifier cleared? Could we lose a guest notification here? > + > return svq; > } > =20 > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 1d55e26d45..9352c56bfa 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -960,12 +960,29 @@ static void handle_sw_lm_vq(VirtIODevice *vdev, Vir= tQueue *vq) > vhost_vring_kick(svq); > } > =20 > +static void vhost_handle_call(EventNotifier *n) > +{ > + struct vhost_virtqueue *hvq =3D container_of(n, > + struct vhost_virtqueue, > + masked_notifier); > + struct vhost_dev *vdev =3D hvq->dev; > + int idx =3D vdev->vq_index + (hvq =3D=3D &vdev->vqs[0] ? 0 : 1); vhost-net-specific hack > + VirtQueue *vq =3D virtio_get_queue(vdev->vdev, idx); > + > + if (event_notifier_test_and_clear(n)) { > + virtio_queue_invalidate_signalled_used(vdev->vdev, idx); > + virtio_notify_irqfd(vdev->vdev, vq); /* TODO push used elements into vq? */ --CKf/2jVYos1l2hij Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl/PLJYACgkQnKSrs4Gr c8j+8gf+OhTHgPK0WzErs2NE4d0Ejs/ALV8z04626r9RXEFYC2Dmt4SiTUraP6EZ P9Y5q2kAblCrBmheQQumXy/5QrGI1I/FCEtxRA1HFtSTfw8rElmzyKKMlv0I+aLY 06411eTjLH7Zcbw0DXBoCq/D34+j3B4s1XZK/sMWOtPofAxgzEAs24h+pmhkmHMz y7vx211Io+dCP1BFJygv99K9fkMz3ZPYP9x9EBd49ySIaaIUQzEO+0knT1hVgd3w 28S8DYYxyu1XIrang6jbi9qxidnxf0VI1AhaibRWbBSYIrZeioGSeVUmJl32LrBR fqt3IvJyBw52U11v0zbmStbzogfVOA== =xYDv -----END PGP SIGNATURE----- --CKf/2jVYos1l2hij-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A62C4361B for ; Tue, 8 Dec 2020 07:36:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD5D723A68 for ; Tue, 8 Dec 2020 07:36:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD5D723A68 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmXY0-0008BE-46 for qemu-devel@archiver.kernel.org; Tue, 08 Dec 2020 02:36:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmXWN-0007UM-SO for qemu-devel@nongnu.org; Tue, 08 Dec 2020 02:34:51 -0500 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:33887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmXWL-0007G0-R4 for qemu-devel@nongnu.org; Tue, 08 Dec 2020 02:34:51 -0500 Received: by mail-ej1-x642.google.com with SMTP id g20so23278829ejb.1 for ; Mon, 07 Dec 2020 23:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=Ql2AB5GySJ65IFMHnw4MwFF+6A1fSxUbm0S/QCOsRh1e9K/RdvI9O9Yt/4u9lp/8zU WXpOxpcxkqc0ECWU/gBhCpde+JT2de7S+dnMJ/ThfJ2V2LjxOF40eH+xPBzu+Q/qIrx+ IwJMliL/zNWO3P9FiZ3xRymHceBHcF2+A/XrgHm9IFQRlZCouH6KOsfRn0s5kND6IZsW ogcY6Q8BQynWXyWAzonWHDSrCT8Sypi5HvX/2Vh7p2n6UQ6hmXMEakUREVC0a87Bb0xI dc7Jx8nAnn6wruao79UPpFzmcbZp7kLhkcFlYOKujv5rwvsUxw/3IHEMFG9ts7W0/Zd7 gtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=KfVQ5kFxlnoTfjjUCAYofS3nMKrOqjmdTx29E4vNYmUpNu6lBWhydx/uca0pmzMeUq +gPwKMkZNCOCBNjecpp35BmaVoH3+dF0Nb+X9YhKI7FEPHB/8S5jUWJrfw7llGVujw94 2EsjfKLESn3ZIG9ueQeQGSgytzwkHFaNioJJuKJ1UGTGItN0KusKSY5UED2kTzFTvLkf QH77dQyutiazvaFfx78nINn1txVK2V5BWaP25sovUtPk+OCNPPtpKDpBR0MhK1hb8KrF eBKGzg13s9o5/3FIU8hS3QgvmAUQmiEcOG94wQ087wTuiM14uazQ8T66qT/z7rFS8fRb i65A== X-Gm-Message-State: AOAM5318DhrYK6ThW0vDu5W0mC11xAfV2zVljW5xByfTcYkgC8lTvKRp siAzhspFWFhicb2TWERjX0Y= X-Google-Smtp-Source: ABdhPJyAJ58CckXILtlZ1T1LSuVkaaFCXE8XFbVwePtP2qOXF2umzTx1ojn2UCAcCz94h+QkAZmFtg== X-Received: by 2002:a17:907:444f:: with SMTP id on23mr22557982ejb.300.1607412888472; Mon, 07 Dec 2020 23:34:48 -0800 (PST) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id mb15sm14605264ejb.9.2020.12.07.23.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 23:34:47 -0800 (PST) Date: Tue, 8 Dec 2020 07:34:46 +0000 From: Stefan Hajnoczi To: Eugenio =?iso-8859-1?Q?P=E9rez?= Subject: Re: [RFC PATCH 09/27] vhost: Route host->guest notification through qemu Message-ID: <20201208073446.GP203660@stefanha-x1.localdomain> References: <20201120185105.279030-1-eperezma@redhat.com> <20201120185105.279030-10-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CKf/2jVYos1l2hij" Content-Disposition: inline In-Reply-To: <20201120185105.279030-10-eperezma@redhat.com> Received-SPF: pass client-ip=2a00:1450:4864:20::642; envelope-from=stefanha@gmail.com; helo=mail-ej1-x642.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-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , qemu-devel@nongnu.org, Daniel Daly , virtualization@lists.linux-foundation.org, Liran Alon , Eli Cohen , Nitin Shrivastav , Alex Barba , Christophe Fontaine , Juan Quintela , Lee Ballard , Lars Ganrot , Rob Miller , Stefano Garzarella , Howard Cai , Parav Pandit , vm , Salil Mehta , Stephen Finucane , Xiao W Wang , Sean Mooney , Stefan Hajnoczi , Jim Harford , Dmytro Kazantsev , Siwei Liu , Harpreet Singh Anand , Michael Lilja , Max Gurtovoy Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --CKf/2jVYos1l2hij Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 20, 2020 at 07:50:47PM +0100, Eugenio P=E9rez wrote: > Signed-off-by: Eugenio P=E9rez > --- > hw/virtio/vhost-sw-lm-ring.c | 3 +++ > hw/virtio/vhost.c | 20 ++++++++++++++++++++ > 2 files changed, 23 insertions(+) I'm not sure I understand what is going here. The guest notifier masking feature exists to support MSI masking semantics. It looks like this patch repurposes the notifier to decouple the vhost hdev from the virtio device's irqfd? But this breaks MSI masking. I think you need to set up your own eventfd and assign it to the vhost hdev's call fd instead of using the mask notifier. >=20 > diff --git a/hw/virtio/vhost-sw-lm-ring.c b/hw/virtio/vhost-sw-lm-ring.c > index 0192e77831..cbf53965cd 100644 > --- a/hw/virtio/vhost-sw-lm-ring.c > +++ b/hw/virtio/vhost-sw-lm-ring.c > @@ -50,6 +50,9 @@ VhostShadowVirtqueue *vhost_sw_lm_shadow_vq(struct vhos= t_dev *dev, int idx) > r =3D dev->vhost_ops->vhost_set_vring_kick(dev, &file); > assert(r =3D=3D 0); > =20 > + vhost_virtqueue_mask(dev, dev->vdev, idx, true); > + vhost_virtqueue_pending(dev, idx); Why is the mask notifier cleared? Could we lose a guest notification here? > + > return svq; > } > =20 > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 1d55e26d45..9352c56bfa 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -960,12 +960,29 @@ static void handle_sw_lm_vq(VirtIODevice *vdev, Vir= tQueue *vq) > vhost_vring_kick(svq); > } > =20 > +static void vhost_handle_call(EventNotifier *n) > +{ > + struct vhost_virtqueue *hvq =3D container_of(n, > + struct vhost_virtqueue, > + masked_notifier); > + struct vhost_dev *vdev =3D hvq->dev; > + int idx =3D vdev->vq_index + (hvq =3D=3D &vdev->vqs[0] ? 0 : 1); vhost-net-specific hack > + VirtQueue *vq =3D virtio_get_queue(vdev->vdev, idx); > + > + if (event_notifier_test_and_clear(n)) { > + virtio_queue_invalidate_signalled_used(vdev->vdev, idx); > + virtio_notify_irqfd(vdev->vdev, vq); /* TODO push used elements into vq? */ --CKf/2jVYos1l2hij Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl/PLJYACgkQnKSrs4Gr c8j+8gf+OhTHgPK0WzErs2NE4d0Ejs/ALV8z04626r9RXEFYC2Dmt4SiTUraP6EZ P9Y5q2kAblCrBmheQQumXy/5QrGI1I/FCEtxRA1HFtSTfw8rElmzyKKMlv0I+aLY 06411eTjLH7Zcbw0DXBoCq/D34+j3B4s1XZK/sMWOtPofAxgzEAs24h+pmhkmHMz y7vx211Io+dCP1BFJygv99K9fkMz3ZPYP9x9EBd49ySIaaIUQzEO+0knT1hVgd3w 28S8DYYxyu1XIrang6jbi9qxidnxf0VI1AhaibRWbBSYIrZeioGSeVUmJl32LrBR fqt3IvJyBw52U11v0zbmStbzogfVOA== =xYDv -----END PGP SIGNATURE----- --CKf/2jVYos1l2hij-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A55DDC4167B for ; Tue, 8 Dec 2020 07:34:54 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DFC323A69 for ; Tue, 8 Dec 2020 07:34:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DFC323A69 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C0B0087AF9; Tue, 8 Dec 2020 07:34:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pH3VRsRpOLgC; Tue, 8 Dec 2020 07:34:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 28F8D87A19; Tue, 8 Dec 2020 07:34:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 068DEC0893; Tue, 8 Dec 2020 07:34:53 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 373E4C013B for ; Tue, 8 Dec 2020 07:34:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1D24220445 for ; Tue, 8 Dec 2020 07:34:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GOXPqvsAmhax for ; Tue, 8 Dec 2020 07:34:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by silver.osuosl.org (Postfix) with ESMTPS id 1AC1B20444 for ; Tue, 8 Dec 2020 07:34:50 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id a16so23245323ejj.5 for ; Mon, 07 Dec 2020 23:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=Ql2AB5GySJ65IFMHnw4MwFF+6A1fSxUbm0S/QCOsRh1e9K/RdvI9O9Yt/4u9lp/8zU WXpOxpcxkqc0ECWU/gBhCpde+JT2de7S+dnMJ/ThfJ2V2LjxOF40eH+xPBzu+Q/qIrx+ IwJMliL/zNWO3P9FiZ3xRymHceBHcF2+A/XrgHm9IFQRlZCouH6KOsfRn0s5kND6IZsW ogcY6Q8BQynWXyWAzonWHDSrCT8Sypi5HvX/2Vh7p2n6UQ6hmXMEakUREVC0a87Bb0xI dc7Jx8nAnn6wruao79UPpFzmcbZp7kLhkcFlYOKujv5rwvsUxw/3IHEMFG9ts7W0/Zd7 gtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KDNQai3ANvzHnuzmpGlNQLHSGL47jHO8xbQVoARcp+Y=; b=UxBt7d8DGIzelatzghLROjQkgQsm+jkwo0VGUjIi1CvN5q6bnul2vubLkrXB4O+07g G8nME+EdtkLI9hhiK49wzTTjwE3/xByaCvT31ThjHJoQ8hK9lbYZq1/KNPUY34fLMaWI Rd8odX6HbE69nqFQCTqp+l0R6kPG0/GVz8dpAoihAgjPtN1BOVYcifNuQcv6DrTm3xzr BLJt6gK1zYJXs1MNiAlU6Jb2uft+0NQ63+PdgJcHaPSWGZC7Y6l7tRj4gQeRaQD5C33d +c90H1YTU7EDDgqoldBPz4tSrPLON1CkezWQ6aGWi9oFkeOQvpTppmIuxgCh8WnHKLz0 Ykhg== X-Gm-Message-State: AOAM5336rgR7oDDaoh0xx3rck+zzMP8sPW2GwJuXvUN4eobrduq4TqlZ W302zOpGqP/bSP+SyzS9/zc= X-Google-Smtp-Source: ABdhPJyAJ58CckXILtlZ1T1LSuVkaaFCXE8XFbVwePtP2qOXF2umzTx1ojn2UCAcCz94h+QkAZmFtg== X-Received: by 2002:a17:907:444f:: with SMTP id on23mr22557982ejb.300.1607412888472; Mon, 07 Dec 2020 23:34:48 -0800 (PST) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id mb15sm14605264ejb.9.2020.12.07.23.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 23:34:47 -0800 (PST) Date: Tue, 8 Dec 2020 07:34:46 +0000 From: Stefan Hajnoczi To: Eugenio =?iso-8859-1?Q?P=E9rez?= Subject: Re: [RFC PATCH 09/27] vhost: Route host->guest notification through qemu Message-ID: <20201208073446.GP203660@stefanha-x1.localdomain> References: <20201120185105.279030-1-eperezma@redhat.com> <20201120185105.279030-10-eperezma@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201120185105.279030-10-eperezma@redhat.com> Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , qemu-devel@nongnu.org, Daniel Daly , virtualization@lists.linux-foundation.org, Liran Alon , Eli Cohen , Nitin Shrivastav , Alex Barba , Christophe Fontaine , Lee Ballard , Lars Ganrot , Rob Miller , Howard Cai , Parav Pandit , vm , Salil Mehta , Stephen Finucane , Xiao W Wang , Sean Mooney , Stefan Hajnoczi , Jim Harford , Dmytro Kazantsev , Siwei Liu , Harpreet Singh Anand , Michael Lilja , Max Gurtovoy X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5318714924304962202==" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" --===============5318714924304962202== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CKf/2jVYos1l2hij" Content-Disposition: inline --CKf/2jVYos1l2hij Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 20, 2020 at 07:50:47PM +0100, Eugenio P=E9rez wrote: > Signed-off-by: Eugenio P=E9rez > --- > hw/virtio/vhost-sw-lm-ring.c | 3 +++ > hw/virtio/vhost.c | 20 ++++++++++++++++++++ > 2 files changed, 23 insertions(+) I'm not sure I understand what is going here. The guest notifier masking feature exists to support MSI masking semantics. It looks like this patch repurposes the notifier to decouple the vhost hdev from the virtio device's irqfd? But this breaks MSI masking. I think you need to set up your own eventfd and assign it to the vhost hdev's call fd instead of using the mask notifier. >=20 > diff --git a/hw/virtio/vhost-sw-lm-ring.c b/hw/virtio/vhost-sw-lm-ring.c > index 0192e77831..cbf53965cd 100644 > --- a/hw/virtio/vhost-sw-lm-ring.c > +++ b/hw/virtio/vhost-sw-lm-ring.c > @@ -50,6 +50,9 @@ VhostShadowVirtqueue *vhost_sw_lm_shadow_vq(struct vhos= t_dev *dev, int idx) > r =3D dev->vhost_ops->vhost_set_vring_kick(dev, &file); > assert(r =3D=3D 0); > =20 > + vhost_virtqueue_mask(dev, dev->vdev, idx, true); > + vhost_virtqueue_pending(dev, idx); Why is the mask notifier cleared? Could we lose a guest notification here? > + > return svq; > } > =20 > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 1d55e26d45..9352c56bfa 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -960,12 +960,29 @@ static void handle_sw_lm_vq(VirtIODevice *vdev, Vir= tQueue *vq) > vhost_vring_kick(svq); > } > =20 > +static void vhost_handle_call(EventNotifier *n) > +{ > + struct vhost_virtqueue *hvq =3D container_of(n, > + struct vhost_virtqueue, > + masked_notifier); > + struct vhost_dev *vdev =3D hvq->dev; > + int idx =3D vdev->vq_index + (hvq =3D=3D &vdev->vqs[0] ? 0 : 1); vhost-net-specific hack > + VirtQueue *vq =3D virtio_get_queue(vdev->vdev, idx); > + > + if (event_notifier_test_and_clear(n)) { > + virtio_queue_invalidate_signalled_used(vdev->vdev, idx); > + virtio_notify_irqfd(vdev->vdev, vq); /* TODO push used elements into vq? */ --CKf/2jVYos1l2hij Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl/PLJYACgkQnKSrs4Gr c8j+8gf+OhTHgPK0WzErs2NE4d0Ejs/ALV8z04626r9RXEFYC2Dmt4SiTUraP6EZ P9Y5q2kAblCrBmheQQumXy/5QrGI1I/FCEtxRA1HFtSTfw8rElmzyKKMlv0I+aLY 06411eTjLH7Zcbw0DXBoCq/D34+j3B4s1XZK/sMWOtPofAxgzEAs24h+pmhkmHMz y7vx211Io+dCP1BFJygv99K9fkMz3ZPYP9x9EBd49ySIaaIUQzEO+0knT1hVgd3w 28S8DYYxyu1XIrang6jbi9qxidnxf0VI1AhaibRWbBSYIrZeioGSeVUmJl32LrBR fqt3IvJyBw52U11v0zbmStbzogfVOA== =xYDv -----END PGP SIGNATURE----- --CKf/2jVYos1l2hij-- --===============5318714924304962202== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization --===============5318714924304962202==--