Date: Wed, 27 Apr 2016 08:34:32 -0700 From: John Baldwin <jhb@freebsd.org> To: freebsd-current@freebsd.org Cc: Shawn Webb <shawn.webb@hardenedbsd.org>, 'Luigi Rizzo' <luigi@freebsd.org> Subject: Re: Netmap LOR Message-ID: <2137327.T2i4J3cQgy@ralph.baldwin.cx> In-Reply-To: <20160425232700.GB99221@mutt-hardenedbsd> References: <20160425232700.GB99221@mutt-hardenedbsd>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, April 25, 2016 07:27:00 PM Shawn Webb wrote: > Here's the backtrace: > > lock order reversal: (sleepable after non-sleepable) > 1st 0xfffff8002a914840 vm object (vm object) @ /usr/src/sys/vm/vm_fault.c:361 > 2nd 0xffffffff822bf9c8 (&nm_mem)->nm_mtx ((&nm_mem)->nm_mtx) @ /usr/src/sys/dev/netmap/netmap_mem2.c:490 > stack backtrace: > #0 0xffffffff80bb3790 at witness_debugger+0x70 > #1 0xffffffff80bb3684 at witness_checkorder+0xe54 > #2 0xffffffff80b5f132 at _sx_xlock+0x72 > #3 0xffffffff8075c43d at netmap_mem2_ofstophys+0x2d > #4 0xffffffff80759a2b at netmap_dev_pager_fault+0x3b > #5 0xffffffff80e8b991 at dev_pager_getpages+0x61 > #6 0xffffffff80eb440a at vm_pager_get_pages+0x4a > #7 0xffffffff80e98210 at vm_fault_hold+0x780 > #8 0xffffffff80e97a48 at vm_fault+0x78 > #9 0xffffffff81028745 at trap_pfault+0x115 > #10 0xffffffff81027dd2 at trap+0x342 > #11 0xffffffff81008981 at calltrap+0x8 > > Thanks, Yes, it's not safe to acquire an sx lock in a d_mmap callback. OTOH, if the buffers are static (and they should be since d_mmap mappings are cached forever once established), then netmap could create an sglist of the physaddrs of the backing pages and create an OBJT_SG VM object backed by that sglist. It could then return that object via a d_mmap_single callback (which can grab sx locks). -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2137327.T2i4J3cQgy>