diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,14 @@ /* 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_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 @@ 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 @@ 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); }