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--