svn commit: r308268 - head/sys/x86/x86
Adrian Chadd
adrian at FreeBSD.org
Thu Nov 3 23:11:34 UTC 2016
Author: adrian
Date: Thu Nov 3 23:11:33 2016
New Revision: 308268
URL: https://svnweb.freebsd.org/changeset/base/308268
Log:
Add a witness check to enforce that no non-sleeping locks are held when
they shouldn't be.
I used this during driver bring-up to find that the Linux driver holds a
whole lot of locks whilst doing their equivalent of busdma operations.
If this works out well, it should be added to the other architecture busdma
implementations to aid in similar debugging.
Tested:
* bounce buffer and dmar busdma, Lenovo X230 laptop, all the internal
hardware
* ath(4) too
Discussed with: jhb
Modified:
head/sys/x86/x86/busdma_machdep.c
Modified: head/sys/x86/x86/busdma_machdep.c
==============================================================================
--- head/sys/x86/x86/busdma_machdep.c Thu Nov 3 23:05:39 2016 (r308267)
+++ head/sys/x86/x86/busdma_machdep.c Thu Nov 3 23:11:33 2016 (r308268)
@@ -197,6 +197,8 @@ bus_dma_tag_create(bus_dma_tag_t parent,
struct bus_dma_tag_common *tc;
int error;
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
if (parent == NULL) {
error = bus_dma_bounce_impl.tag_create(parent, alignment,
boundary, lowaddr, highaddr, filter, filterarg, maxsize,
@@ -228,6 +230,8 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
{
struct bus_dma_tag_common *tc;
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
tc = (struct bus_dma_tag_common *)dmat;
return (tc->impl->map_create(dmat, flags, mapp));
}
@@ -257,6 +261,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
{
struct bus_dma_tag_common *tc;
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
tc = (struct bus_dma_tag_common *)dmat;
return (tc->impl->mem_alloc(dmat, vaddr, flags, mapp));
}
More information about the svn-src-head
mailing list