From nobody Thu Apr 14 18:01:22 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 CFECA1B441CC; Thu, 14 Apr 2022 18:01:22 +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 4KfS2B4TDcz3w9v; Thu, 14 Apr 2022 18:01:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649959282; 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=uI+UbzszrMjJWlclvDknplaKhYYgh+RW51hYSLn0LW8=; b=JkUQyQEGQrfmyzO0oSk4eXFIfAGpvBEsRnnhdgF7ctKkmByCVjj5YhOEmHgxtB6ms9fFtN B3YiuunLRvKumi0de95y3mKD9xRK17bDGArHK8vjTOBEytQgCZYMh9a4IwI/qbfhO4iXDc 2u+4m6l5UQEcv8B1rwgJkos0YUvZ0KsYh98GrEvnyPdYKNj2dwYL0fqz+90raKZDQHAKmo 5tQWrwRE2bmyA5kQON0NVgrEhBZ8MjPCSeCgqMnnWaVmYwcPaMyB/PNqgHxALuLOUfqv1h dxAzZmBpldzzg3XEL1bDtuLGTssNGom3W288wnfcOXTC86TcgsMfFMjJgS+0cA== 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 7A2D4251D4; Thu, 14 Apr 2022 18:01:22 +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 23EI1M48015896; Thu, 14 Apr 2022 18:01:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23EI1Mhr015895; Thu, 14 Apr 2022 18:01:22 GMT (envelope-from git) Date: Thu, 14 Apr 2022 18:01:22 GMT Message-Id: <202204141801.23EI1Mhr015895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 46d08fd085dc - stable/13 - LinuxKPI: PCI: add counter for linux_dma_map_phys_common() errors 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 46d08fd085dcb013b6ae09cd36b272f93fc84574 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649959282; 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=uI+UbzszrMjJWlclvDknplaKhYYgh+RW51hYSLn0LW8=; b=DT9eFxZqvgOPUnlfxg13ZAHSCEAm+8yUWE/9YJ8zh651SObGPLKobNSITcLP1hp2ofj3+n MgiAzC1rQutC6caPpYtDGbkqksZkqykecNYFUNKAoI5mAbzgAB9rpfRd9aKwrcB5ug++yS GtUHkrBS3mFg049Mnw89NJXSD7EoVUp7dBNeL+Qqkjuwl/xmERE29lB36C1RRyJ5jyUoBU ZCzT0knS2ZlOL1bfsf/Sv2Q7UmemihwVKJMstFsReR8vm2T50UMyheKbJAS7PezQvgkHVt zaW46Y3Mz8vxe562j89KHGXdfba/GwY1vb+XAlAuXNFTibSP0FP+QLQQIXP2cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649959282; a=rsa-sha256; cv=none; b=KYLCklEJtyv1kd9o0vKYTi7Z3GS/84KQXD1fFZYD2dV/f074Zx79yvMnK7HiB8n/y3RFlN iC7k+0sHETxfYZ3HrtZQ1RJmx+fJAoh7xIVt6GdJUs/5sby6pKsXHloshyIOWRh5sfjfGz xva0RtGOZZYEihPqAS0++AzRQ0pXa5whqfgLm6znOQ0+Q3pfDpzZAE2EbDfDVAi0EIzc/m Tssi+5mdlH3tEGw3YKleAAGJCOMM13jbtmM6NE0e/xAdCDvO2RA3jKPzY07K7+NJCjfcfA /eltKKNQsLq67ouLLNLElQLd/tm18L3/tD6TjOciievQuxVDYPEjvfGcF2jZ7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=46d08fd085dcb013b6ae09cd36b272f93fc84574 commit 46d08fd085dcb013b6ae09cd36b272f93fc84574 Author: Bjoern A. Zeeb AuthorDate: 2022-03-30 17:38:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-14 16:37:53 +0000 LinuxKPI: PCI: add counter for linux_dma_map_phys_common() errors LinuxKPI is asking for single-segment mappings. Some (wireless) drivers are using this to map multi-pages and our busdma framework is not very friendly to that as single-segments [D31823]. Add a counter so we can track when this happens to gather more information. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34715 (cherry picked from commit e86707418c8e84e1ebf8b4c5f35ff641c234d067) --- sys/compat/linuxkpi/common/src/linux_pci.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index acfc760f092f..3fa6de92bce4 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -77,6 +78,14 @@ __FBSDID("$FreeBSD$"); /* Undef the linux function macro defined in linux/pci.h */ #undef pci_get_class +extern int linuxkpi_debug; + +SYSCTL_DECL(_compat_linuxkpi); + +static counter_u64_t lkpi_pci_nseg1_fail; +SYSCTL_COUNTER_U64(_compat_linuxkpi, OID_AUTO, lkpi_pci_nseg1_fail, CTLFLAG_RD, + &lkpi_pci_nseg1_fail, "Count of busdma mapping failures of single-segment"); + static device_probe_t linux_pci_probe; static device_attach_t linux_pci_attach; static device_detach_t linux_pci_detach; @@ -953,7 +962,7 @@ linux_dma_init(void *arg) linux_dma_obj_zone = uma_zcreate("linux_dma_object", sizeof(struct linux_dma_obj), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - + lkpi_pci_nseg1_fail = counter_u64_alloc(M_WAITOK); } SYSINIT(linux_dma, SI_SUB_DRIVERS, SI_ORDER_THIRD, linux_dma_init, NULL); @@ -961,6 +970,7 @@ static void linux_dma_uninit(void *arg) { + counter_u64_free(lkpi_pci_nseg1_fail); uma_zdestroy(linux_dma_obj_zone); uma_zdestroy(linux_dma_trie_zone); } @@ -1023,6 +1033,9 @@ linux_dma_map_phys_common(struct device *dev, vm_paddr_t phys, size_t len, bus_dmamap_destroy(obj->dmat, obj->dmamap); DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); + counter_u64_add(lkpi_pci_nseg1_fail, 1); + if (linuxkpi_debug) + dump_stack(); return (0); }