From nobody Sun Apr 03 23:07:05 2022 X-Original-To: dev-commits-src-main@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 589FA1A573BB; Sun, 3 Apr 2022 23:07:06 +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 4KWqL21cR6z4Z7D; Sun, 3 Apr 2022 23:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649027226; 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=ZrkkXVxRbl7zhdDRyeSKG/mFv2Te8ValFVxDVq+8qcU=; b=DmrwpJgwxFo9kjAr4kXHREfueE0P+wsmbAkYqfE0Bl3PUb/MCbXikFAQYlLBkUBebzBMyt DIEVrUmpoM9uqu0qsI1wb6SkmpHBSy8+9mMr7KyF/9llVZ1DLwBe9PfmmChfYvhok7qMjU cj6Kjf2UsQ9T9FgblrME4iarVqIxaiGUJGvsWO01sQC7bqdWgwbtNs+hQk/10zRi3vYA9J FnAYdQ7NGHuEOQFt40B8Z0vv9pGJheH8gZqLfGC9f7DiQpfmW8IkSX+W1xpZGDvae5BljG ck70eRn2VL9Mhpmc51H4FcGDD8FON48d+9j7E9JpQoavQVL+1MLVAw4Utu0S2g== 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 D2862264EE; Sun, 3 Apr 2022 23:07:05 +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 233N75Uf016152; Sun, 3 Apr 2022 23:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 233N75Rx016151; Sun, 3 Apr 2022 23:07:05 GMT (envelope-from git) Date: Sun, 3 Apr 2022 23:07:05 GMT Message-Id: <202204032307.233N75Rx016151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: e86707418c8e - main - LinuxKPI: PCI: add counter for linux_dma_map_phys_common() errors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e86707418c8e84e1ebf8b4c5f35ff641c234d067 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649027226; 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=ZrkkXVxRbl7zhdDRyeSKG/mFv2Te8ValFVxDVq+8qcU=; b=wKLfKSzwljZKt0NckNH3bzsErbifCFig26Cr4/lOafZMug6AVteBhuUrZyEt43XklgkqU/ HyNAx8znESAOfauxmKrsHO3s+sI5FKcb2S3nmt/GOOA0fwBGeDpFPH6W3XN5F982hn3jaR 1UOVux9yJjeEQn0iOPKgqyTkdO/Dz+pc7uSkjWVayxKHpabvFdqFA9U09eTFz0k6Xpoo0D N8ywU1B15SLhkg9DSL3P6HFk6HNDU9s7/kq42M4T7zFVG8TPCywk0PxnggIdDpFtZ1DAjo /IWho71fElhBJp/rEKLIQRvK2F571j7/f1Zk/Z/jsDW708s/2BaHJBT6wPfp0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649027226; a=rsa-sha256; cv=none; b=w5U3nKtjhlgbwBJ2O/Fdn6gGMnmE6pNsADJYrZ1TafI1TxPYusNC/atOBBqO8z6+MLseyl CIUP7iJJoBmGqfal3hP7V6NIv9lTbQVZQ2q34NLzF4Ysst3sRuQxebFMrJ8Hh9R1bmgaTs rG+e6b9EbZPKboIx7T1L8avwkeRCunwocTDx39GqOgWbrulBAFx74Z/YglgIns58f3W8+5 JMK7OtDNXjXkpxnZbP0yEHBLydwQ4CXKRWDC4bxy6FHtisU7l9k0BGR7F3e5ngVm8f/Xh/ ED7xj+jsL6Yadh+RKHkiqrEoJ53HTWKFggh9b3yKdwnVYHFj0pm4Jgi1VqhpUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=e86707418c8e84e1ebf8b4c5f35ff641c234d067 commit e86707418c8e84e1ebf8b4c5f35ff641c234d067 Author: Bjoern A. Zeeb AuthorDate: 2022-03-30 17:38:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-03 23:05:47 +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 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34715 --- 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 f8ae03d2bf28..34bac3843378 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; @@ -796,7 +805,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); @@ -804,6 +813,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); } @@ -866,6 +876,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); }