From nobody Fri May 22 22:27:55 2026 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 4gMfzx3dHYz6ddp7; Fri, 22 May 2026 22:27:57 +0000 (UTC) (envelope-from markj@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gMfzx2Wxtz3qt9; Fri, 22 May 2026 22:27:57 +0000 (UTC) (envelope-from markj@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779488877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UToU7gFyzkOgKOdKyOnrB3WhtuXhIRapg2m46mX3qeY=; b=WokES+648uzo2bWi48ES1JoQdUZOOCi7H4OAr9jnOUrEo5NTdpBNBi7YruSMZQkURZLOlF KW3/hbJzy3CmoUPijrkZ4iIclvtyRK3sEZoEEWgV6Ci99TEzpYjqDU6ZkWBOBPVsbJWrhS e1Y+iikgtIydZh9OUHFPGbIXCnbGb9O+7XTU4+I3S6KtOz7JJDtgUosjbJaFZdwBbnuy1X MMpCQgAkRf/VhUrfaPQaffzCoCPrfxxVQLRj2NhmsxAcITxhLSIGX5rEHmYNo8ecT2NQiq CxFaDqutju6ZaX6eAuKASma5RagHHOfCKKW2Lz/irWl8sr7fbFzr4lL/uMHBEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779488877; a=rsa-sha256; cv=none; b=fSpFNvx72CME4LtpqOnjxoDsACAP0tEPS75OyPhOtH1fOVeAm25OXBx6Es/G8y3Dq4CnWK S9nAu1GyY9gXOrlJQv9GhCGwcrJKIUS43YAfT20/pfVFWkjJ8Qf2oACy18LrqeB1gIFDQ8 SjS53cx2dlbhQiNjWRxRlTnaP9GsGw6xo0j+pAVoEnW0fg6xnpcELa349pwEHa66VvDrr0 Y1NggNC0A2vp3v/0WRgGwARPpOd364EFeyLNPYqazxoDjEHP+YfS1gzcHtQvgtE3k5tAD5 Fr/p5ewDSDU7S6FFmKqLFnu1dVqEf+S1Cb+WWOgMX4C+pu8/OeDeYQLyJ1Mgag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779488877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UToU7gFyzkOgKOdKyOnrB3WhtuXhIRapg2m46mX3qeY=; b=T/dl8JZBOs453gWSalXtzjo6IGHWC0Kb1GF3AJ3u2kawFzR4NJjppSXc6v3A5Fvci2Qa5q SbSdGCDOMSW3+uA6EWb9B+33eS9dZN7FIVxslqfOxRJscQKQZSpM6DcofK45phEU28lTQs ZnUZkiP9+H23KyxzFx5IStZhtRXYnsE4PkEDaNOS37hgS6zykYbOL+BuifAoFgKtljy3Sl Rgcv6FCkdjFU04+bEp4zBk/mFZd9uVye7e8u61hz13zLMN6DWbPXxVEpjnv9Y1+1/ecShV pVlZOqf1g0hf3MjmcFTmATQ1HvUxRSDcF6GjgWDjE7m9wyawE6JFr0vlo78bhg== Received: from nuc (192-0-220-237.cpe.teksavvy.com [192.0.220.237]) (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) (Authenticated sender: markj) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gMfzx0b4Hz3Ph; Fri, 22 May 2026 22:27:57 +0000 (UTC) (envelope-from markj@freebsd.org) Date: Fri, 22 May 2026 18:27:55 -0400 From: Mark Johnston To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 36b855f18925 - main - amd64/vmm: Lock global PCI passthrough structures Message-ID: References: <69860b30.3f83f.acb567e@gitrepo.freebsd.org> <21416977-p363-rs27-90n6-qq2o931r4ps5@mnoonqbm.arg> 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21416977-p363-rs27-90n6-qq2o931r4ps5@mnoonqbm.arg> On Fri, May 22, 2026 at 10:13:38PM +0000, Bjoern A. Zeeb wrote: > On Fri, 6 Feb 2026, Mark Johnston wrote: > > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=36b855f1892575cbfe1cd5455b989bfc8ae07502 > > > > commit 36b855f1892575cbfe1cd5455b989bfc8ae07502 > > Author: Mark Johnston > > AuthorDate: 2026-02-06 15:29:22 +0000 > > Commit: Mark Johnston > > CommitDate: 2026-02-06 15:38:51 +0000 > > > > amd64/vmm: Lock global PCI passthrough structures > > > > There is a global list of ppt-claimed devices, accessed via several > > vmm ioctls. The ioctls are locked by per-VM locks, but this isn't > > sufficient to prevent multiple VMs from trying to bind a given device. > > > > Add a sleepable lock and use that to synchronize all access to ppt > > devices. > > > > Reviewed by: corvink, jhb > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D55065 > > --- > > sys/amd64/vmm/io/ppt.c | 162 +++++++++++++++++++++++++++++++++---------------- > > 1 file changed, 111 insertions(+), 51 deletions(-) > > > > diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c > > index 6feac5dcbbed..b522e18e3b24 100644 > > --- a/sys/amd64/vmm/io/ppt.c > > +++ b/sys/amd64/vmm/io/ppt.c > ... > > int > > @@ -529,10 +558,12 @@ ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, > > struct pptseg *seg; > > struct pptdev *ppt; > > > > + PPT_LOCK(); > > error = ppt_find(vm, bus, slot, func, &ppt); > > if (error) > > - return (error); > > + goto out; > > > > + error = ENOENT; > > for (i = 0; i < MAX_MMIOSEGS; i++) { > > seg = &ppt->mmio[i]; > > if (seg->gpa == gpa && seg->len == len) { > > @@ -541,9 +572,11 @@ ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, > > seg->gpa = 0; > > seg->len = 0; > > } > > - return (error); > > + break; > > } > > } > > +out: > > + PPT_UNLOCK(); > > return (ENOENT); > > } > > There's a bug here. That should be return (error). That's been breaking > pci passthru since February. I cannot imagine how no one noticed this in > 3 months? Fixed in commit b13335331092, thanks. If I'm reading the bhyve code correctly, this is "cosmetic": the libvmmapi wrapper for this operation is vm_unmap_pptdev_mmio(), called in bhyve's passthru_mmio_map(). When the ioctl fails, passthru_mmio_map() prints that warning and returns an error to the caller... and all callers ignore it. I think that was true even before my refactoring in commit 86150ed98b790. How exactly is passthru broken for you?