Re: Netmap LOR

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 27 Apr 2016 08:34:32 -0700
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) _at_ /usr/src/sys/vm/vm_fault.c:361
>  2nd 0xffffffff822bf9c8 (&nm_mem)->nm_mtx ((&nm_mem)->nm_mtx) _at_ /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
Received on Wed Apr 27 2016 - 14:17:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:04 UTC