From nobody Fri Nov 11 15:04:09 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N826K3sv0z4dtgJ; Fri, 11 Nov 2022 15:04:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N826K3Brmz4Gxj; Fri, 11 Nov 2022 15:04:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oXnWh8H+TLX+LXQH08e3ZefAkGJ6bFjakaXuLbaR/8w=; b=NL16kDdF6/DXURMZqw3IVmDMSdvyrPw9vx3DevXA7Rg+V+bze8RrLEcKDdUPldtz3oyuSs WEkFFZOlkg/RnzsUQmhEp7vX5dWg/k8UHNpEk0kyopxCc8HuqwnHiaf0o8e3TJ3v21jhwz ivVQmzRM5g4vG4udW5r05KNjUZLE9T5Vv60NoNJxxn//tTSnx/LyirVstK7mJzoZS1eH7y 6sCsjUb8vIb1gVLxBTUcOcOTGjFn5fWMfoOV1pSdzfEifWylnKLNuuIAvn1N7l6x2XOu8Z KjYMoIJ1i4QvXSE7i+wq+SUB6VWxdAowpPtCQQKwoSxansbTQ/SGaJOSdd57CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oXnWh8H+TLX+LXQH08e3ZefAkGJ6bFjakaXuLbaR/8w=; b=kJaVM6aYCYiDtcFXODdxkwABKtWQv41yDVf+X8FmyxS63/thlPcF6WIKBUCOUTlJfL92be 4+HebjjQk1PcCK3Kb8v/5iuIC1GPELLMlL3d1x08CYBB7GnocBh4ktnCLnQE6ZGv4jxbww u+M1GKygsrHfAsMaL8Gc5nb1Kuq5XI99CrsbsAxQmGNJ3IcfiM0FjIY5Fb9pAptfYMBXZb u9qFWvJWoH26COJxPf9YH+luo8ggsaHsCgXWJxQfrcRe24ZGMxuWJL0NpW3619Zp0psLS1 b37wqQuKu7OBeDWAgM1y988eGaBRanAkeMcMOyKEsvTl2k1izn3sEmznBQTJQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668179049; a=rsa-sha256; cv=none; b=vtBj+H3R8ELfX85aK9F+KYmTKOm/XJFMk4kRubTCizn2mHrlMWu97aNGmhsO4+N9l72N7p 7QvhOhgw+2VyvLvs2OvHN7WA6u0k5Cehua+PaiwNmrenveBMZzg+tRaY1qbuOjPAboSOZG ptCV8QIwgNZlc1ckhyi9JUozimLW5JoKg6eov/L66ekmO83QqHgMzpkn4Rok+e/Hl/Tq2F g4SGpGui4QLqXcqb/VpO/uw3m5YI0gbKZBXsEnmIH5jlxxs0K93LdFmT+MmdsW5GLj8tpk L9EijxK+GR38zIsq3vOYF5AlQlVGZKYYx/cESDS9Hm+Pm9OZXICSf47Z+j8A+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N826K228xzmb5; Fri, 11 Nov 2022 15:04:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ABF49Jc094188; Fri, 11 Nov 2022 15:04:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABF49ph094187; Fri, 11 Nov 2022 15:04:09 GMT (envelope-from git) Date: Fri, 11 Nov 2022 15:04:09 GMT Message-Id: <202211111504.2ABF49ph094187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 593200c23b57 - main - bhyve: Drop volatile qualifiers from virtio rings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 593200c23b57ea6977bf5084b91fc5c63dacbb80 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=593200c23b57ea6977bf5084b91fc5c63dacbb80 commit 593200c23b57ea6977bf5084b91fc5c63dacbb80 Author: Mark Johnston AuthorDate: 2022-11-11 15:02:10 +0000 Commit: Mark Johnston CommitDate: 2022-11-11 15:02:10 +0000 bhyve: Drop volatile qualifiers from virtio rings The qualifiers are there presumably because these rings are mapped into the guest, but they do not appear to be required for correctness, and bhyve generally doesn't qualify accesses to guest memory this way. Moreover, the qualifiers are discarded by snapshot code, causing clang to emit warnings. Just stop using volatile here. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37291 --- usr.sbin/bhyve/virtio.c | 13 ++++++------- usr.sbin/bhyve/virtio.h | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index 32dd9336c5df..dc3a2d10d5b5 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -214,10 +214,9 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) * descriptor. */ static inline void -_vq_record(int i, volatile struct vring_desc *vd, - struct vmctx *ctx, struct iovec *iov, int n_iov, - struct vi_req *reqp) { - +_vq_record(int i, struct vring_desc *vd, struct vmctx *ctx, struct iovec *iov, + int n_iov, struct vi_req *reqp) +{ if (i >= n_iov) return; iov[i].iov_base = paddr_guest2host(ctx, vd->addr, vd->len); @@ -271,7 +270,7 @@ vq_getchain(struct vqueue_info *vq, struct iovec *iov, int niov, u_int ndesc, n_indir; u_int idx, next; struct vi_req req; - volatile struct vring_desc *vdir, *vindir, *vp; + struct vring_desc *vdir, *vindir, *vp; struct vmctx *ctx; struct virtio_softc *vs; const char *name; @@ -409,8 +408,8 @@ vq_retchains(struct vqueue_info *vq, uint16_t n_chains) void vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) { - volatile struct vring_used *vuh; - volatile struct vring_used_elem *vue; + struct vring_used *vuh; + struct vring_used_elem *vue; uint16_t mask; /* diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index 5300fb5dbef3..7b50969e57a9 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -314,14 +314,14 @@ struct vqueue_info { uint32_t vq_pfn; /* PFN of virt queue (not shifted!) */ - volatile struct vring_desc *vq_desc; /* descriptor array */ - volatile struct vring_avail *vq_avail; /* the "avail" ring */ - volatile struct vring_used *vq_used; /* the "used" ring */ + struct vring_desc *vq_desc; /* descriptor array */ + struct vring_avail *vq_avail; /* the "avail" ring */ + struct vring_used *vq_used; /* the "used" ring */ }; /* as noted above, these are sort of backwards, name-wise */ #define VQ_AVAIL_EVENT_IDX(vq) \ - (*(volatile uint16_t *)&(vq)->vq_used->ring[(vq)->vq_qsize]) + (*(uint16_t *)&(vq)->vq_used->ring[(vq)->vq_qsize]) #define VQ_USED_EVENT_IDX(vq) \ ((vq)->vq_avail->ring[(vq)->vq_qsize])