From nobody Sun Mar 27 20:15:14 2022 X-Original-To: virtualization@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 A68621A56741 for ; Sun, 27 Mar 2022 20:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@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 4KRRrz2081z4pcW for ; Sun, 27 Mar 2022 20:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 D84D01BBFC for ; Sun, 27 Mar 2022 20:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 22RKFE9W046831 for ; Sun, 27 Mar 2022 20:15:14 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 22RKFEbU046830 for virtualization@FreeBSD.org; Sun, 27 Mar 2022 20:15:14 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 215740] [bhyve] utilizing passthru breaks raw device usage with virtio-blk | ahci-hd Date: Sun, 27 Mar 2022 20:15:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 11.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412115; 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: in-reply-to:in-reply-to:references:references; bh=nmT/A9veFwLE7r6F1RuwtfyuM32ZzY0ntdoPPS8h7wU=; b=dtnv0K5s36InnqO5LZMZZ2MhwU9cLKKdLN6mJUX/Jo5CR9s1nj1VVmSdr0Bepoug/rs4bX +uEhiQ/cDydASsr64+sDwgdlGr232BTpHRRo1SU1s7hn91a+2Nwep7iFh3pV0rjlxtp+kK LSUOZFtxCLKX1TIbRvfE6CChcDykDmtufnJ92zPx7rlUV83c8RK/c4uR7OR5YiVO46aWh0 Vk9w/KibeqXlDRLsXgzs7aUIPLgE7VjF9NSgTEV9dWULp2bfKU61F1CyfA2qfvMhAf0kcs m9Cz0ae64JNyLqwwYZD9Ykougi0xd0G3VnkbE36Tz/516GqcunvSysFwEOIG7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412115; a=rsa-sha256; cv=none; b=EHrfykwgBaIASrdTbS75K+VkHWa9lj+jcMX/agsIiogrGd0GCRCeLSuIP6aiTcai2jS5R1 Ma2Yzx7RjAe3EcrsxAlCC354OdvSxBnYIIWuGIiHm1vO4JvZUtR4xLERW65ClXxfUxQmQ3 XKcTF15wapn5BO2lCvmLm/+xLMmyVQBsV5IXE1tNMh82wYYlAvQupdZLEPZ9E2h2tSbog5 a17llRf5hbAK8oCa2P7/opdc89zMvFb1jUPqanZrIfVgjgIC4Q7D7g6sZvfFHn4X+C3Nyh 3jZVnTcn66IACa7h5zeecAbWLW85cnbrq0PRiq3Dbs6sHRZBo5kF2wM1m2MSWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215740 --- Comment #9 from commit-hook@FreeBSD.org --- A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3Ddd113f67dfb5bdaf5d8b3a87bb19924ad= 447494c commit dd113f67dfb5bdaf5d8b3a87bb19924ad447494c Author: Bjoern A. Zeeb AuthorDate: 2022-03-18 20:39:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 17:57:28 +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/. 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 as a drive in the guest), the host device driver (e.g. ahci for /dev/ada) 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. 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) 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.=