From owner-svn-src-all@freebsd.org Thu Nov 3 23:11:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5301FC2E51A; Thu, 3 Nov 2016 23:11:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E9C8173C; Thu, 3 Nov 2016 23:11:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA3NBXAw010618; Thu, 3 Nov 2016 23:11:33 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA3NBXJh010617; Thu, 3 Nov 2016 23:11:33 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611032311.uA3NBXJh010617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 3 Nov 2016 23:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308268 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 23:11:34 -0000 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)); }