Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2022 15:50:30 +0000
From:      bugzilla-noreply@freebsd.org
To:        virtualization@FreeBSD.org
Subject:   [Bug 215740] [bhyve] utilizing passthru breaks raw device usage with virtio-blk | ahci-hd
Message-ID:  <bug-215740-27103-Xqdd3X0Btu@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-215740-27103@https.bugs.freebsd.org/bugzilla/>
References:  <bug-215740-27103@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215740

--- Comment #10 from commit-hook@FreeBSD.org ---
A commit in branch releng/13.1 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=3D1c6abf864ecd3bbf07ace2018f9aab45b=
6406ce2

commit 1c6abf864ecd3bbf07ace2018f9aab45b6406ce2
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-03-18 20:39:06 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-03-30 15:33:47 +0000

    bhyve: Do not remove guest physical addresses from IOMMU host domain

    This permits I/O devices on the host to directly access wired memory
    dedicated to guests using passthru devices.  Note that wired memory
    belonging to guests that do not use passthru devices has always been
    accessible by I/O devices on the host.

    bhyve maps guest physical addresses into the user address space of
    the bhyve process by mmap'ing /dev/vmm/<vmname>.  Device models pass
    pointers derived from this mapping directly to system calls such as
    preadv() to minimize copies when emulating DMA.  If the backing store
    for a device model is a raw host device (e.g. when exporting a raw disk
    device such as /dev/ada<n> as a drive in the guest), the host device
    driver (e.g. ahci for /dev/ada<n>) can itself use DMA on the host
    directly to the guest's memory.  However, if the guest's memory is
    not present in the host IOMMU domain, these DMA requests by the host
    device will fail without raising an error visible to the host device
    driver or to the guest resulting in non-working I/O in the guest.

    It is unclear why guest addresses were removed from the IOMMU host doma=
in
    initially, especially only for VM's with a passthru device as the
    host IOMMU domain does not affect the permissions of passthru devices,
    only devices on the host.

    A considered alternative was using bounce buffers instead (D34535
    is a proof of concept), but that adds additional overhead for unclear
    benefit.

    This solves a long-standing problem when using passthru devices and
    physical disks in the same VM.

    Approved by:    re (gjb)
    Thanks to:      grehan (patience and help)
    Thanks to:      jhb (for improving the commit message)
    PR:             260178, 215740
    Reviewed by:    grehan, jhb
    Differential Revision: https://reviews.freebsd.org/D34607

    (cherry picked from commit 246c398145674e4a9337fd933a6e6da7f160118e)
    (cherry picked from commit dd113f67dfb5bdaf5d8b3a87bb19924ad447494c)

 sys/amd64/vmm/vmm.c | 2 --
 1 file changed, 2 deletions(-)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-215740-27103-Xqdd3X0Btu>