From nobody Wed Jun 05 03:16:41 2024 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 4VvCL25bk1z5LGl4; Wed, 05 Jun 2024 03:16:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VvCL24g40z4jcg; Wed, 5 Jun 2024 03:16:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717557402; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zfNWfpVzmA6XKd0QpMLm6jyfM66J41fA+2AjHnHF4z4=; b=b0CWo/2g8aEKT5YK+hmJx5MU3V4MMKmkpNFRP8WUi85Sy3Z6vZdNFFWTtoY5+JusYTomgY k/aAOyBZndGJVtJ+hZHX9tiFMBxiMNi/q7f/a1VO6nOgMZ5fDo/tUKmqij92odGMAPsHsG GC2d6r4h+Byu395RaIYYtv7r9t43DiQXy4ZS3Hpw7C565zdochO1IGdwQbY3F8n1XGb7gX vlTNAkiYXM8cmheSTQVBzMJ6y+j8LDRCWzAoG7y4E4JAs4vwUd6y7CcOwaefu8X9+twMd+ ac4ow9abTGu1zrjDRKLELijCx8SUKXPgXpG0iaYf6+zM6z/1nR72unvcwSrXcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717557402; a=rsa-sha256; cv=none; b=N3aKS+NphrRVC4obJcKoypyRjrkjZ1fjPD5XrviqCHYVhH9n8pgsaOn7Q9ok/QuwEFoag7 EFxJfFPjoNbkElVnW5RQ1qDR3OvqoIJlYQyOs7i4hgrZuKHQRJH5Ova8QmoAlPShiuVWTm AdeUtonPd4lzJ6gPn+CtNkVlHsJPr/pOZ+YdK76MEepyVcFctN3DYN8NEK0fdjNs66H3Da 5/7ZYALPaC+3sXpF84SAOLCdO20o/msqoa+OAZ/vLSbdmRDP8EJCaV0MYU5gZeJAx57o0P Es+/EzpJCkc2Qt6Wlrmif62+bi2PbqAxv2+YC+xlWr8INZcCNCHhUfo8qKMW7Q== 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=1717557402; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zfNWfpVzmA6XKd0QpMLm6jyfM66J41fA+2AjHnHF4z4=; b=czrQHWhwRE5aMV5FUAOFdFWPJLbsz0c+IYUtYaVXlvZfW5y4h+I8GS31Ys2skiuOn4w5qg xzIj0G5CkQ+7NJ/BhCK5UbgSzo3HVFuo2lL7NxvJDzDYilrCydx5U9IKP535NGJ/o1M8nY rhCsA3g/AHWt6NXjjJ1yIjzKktm83V/3WFnkUj9hC1YwnI3+yn/ZuxJxsnGu4N/p9A0z3+ in+R8Er+eJNOfqZHS3ON46NgSWAqS4TWeHS2oDDcmgvhQlTOAMFDA12zblr3AqLvrurzt2 D7QccmP6h402WKW8r9YZN+HkPBYfMByrJx2wVNM+dW1C4k83hL18TSPeuruWTw== Received: from [IPV6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04] (unknown [IPv6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VvCL211lJzTRD; Wed, 5 Jun 2024 03:16:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 4 Jun 2024 20:16:41 -0700 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 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 871b33ad65ba - main - pci: Consistently use pci_vf_* for suballocated VF memory resources Content-Language: en-US To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202406042352.454NqFVj061328@gitrepo.freebsd.org> <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org> From: John Baldwin In-Reply-To: <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/4/24 8:00 PM, Jessica Clarke wrote: > On 5 Jun 2024, at 00:52, John Baldwin wrote: >> >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc1978c2ed7b3b >> >> commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b >> Author: John Baldwin >> AuthorDate: 2024-06-04 23:51:37 +0000 >> Commit: John Baldwin >> CommitDate: 2024-06-04 23:51:37 +0000 >> >> pci: Consistently use pci_vf_* for suballocated VF memory resources >> >> Some of the bus resource methods were passing these up to the parent >> which triggered rman mismatch assertions in INVARIANTS kernels. >> >> Reported by: kp >> Reviewed by: imp >> Tested by: kp (earlier version) >> Differential Revision: https://reviews.freebsd.org/D45406 >> --- >> sys/dev/pci/pci.c | 118 ++++++++++++++++++++++++++++++++++-- >> sys/dev/pci/pci_iov.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++ >> sys/dev/pci/pci_private.h | 19 ++++++ >> 3 files changed, 284 insertions(+), 4 deletions(-) >> >> diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c >> index 2cb8b4ce9fcc..2093d6a8b5ef 100644 >> --- a/sys/dev/pci/pci.c >> +++ b/sys/dev/pci/pci.c >> @@ -164,10 +164,18 @@ static device_method_t pci_methods[] = { >> DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), >> DEVMETHOD(bus_delete_resource, pci_delete_resource), >> DEVMETHOD(bus_alloc_resource, pci_alloc_resource), >> +#ifdef PCI_IOV >> + DEVMETHOD(bus_adjust_resource, pci_adjust_resource), >> +#else >> DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), >> +#endif >> DEVMETHOD(bus_release_resource, pci_release_resource), >> DEVMETHOD(bus_activate_resource, pci_activate_resource), >> DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), >> +#ifdef PCI_IOV >> + DEVMETHOD(bus_map_resource, pci_map_resource), >> + DEVMETHOD(bus_unmap_resource, pci_unmap_resource), >> +#endif >> DEVMETHOD(bus_child_deleted, pci_child_deleted), >> DEVMETHOD(bus_child_detached, pci_child_detached), >> DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method), > > Would it make sense to instead #ifdef parts of the body of > pci_adjust_resource rather than switching which function you’re using > in the first place? I feel that is generally easier to understand, as > there’s less conditionality, and it’s more easily extensible if any > other special cases come along. Hmm, I could do that I guess. These aren't hot paths so the extra jump to a tail call in the #ifndef case isn't that bad, and it probably is a bit more readable. In related news, you should really land your patches to enable NEW_PCIB and PCI_RES_BUS by default (and remove the !NEW_PCIB code). :) -- John Baldwin