From owner-freebsd-current@FreeBSD.ORG Thu May 22 01:11:38 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAE6F37B401 for ; Thu, 22 May 2003 01:11:38 -0700 (PDT) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5FC3543FB1 for ; Thu, 22 May 2003 01:11:38 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au (210.50.251.4) by smtp01.syd.iprimus.net.au (7.0.015) id 3ECAA295000461F8 for current@freebsd.org; Thu, 22 May 2003 18:11:35 +1000 Received: by dilbert.robbins.dropbear.id.au (Postfix, from userid 1000) id 17372C90F; Thu, 22 May 2003 18:11:34 +1000 (EST) Date: Thu, 22 May 2003 18:11:33 +1000 From: Tim Robbins To: current@freebsd.org Message-ID: <20030522181133.A32602@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Subject: VM-related lock order reversal X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2003 08:11:39 -0000 Got this today while stressing the system out, trying to reproduce a nullfs deadlock: lock order reversal 1st 0xc103d940 vm object (vm object) @ /usr/p4/tjr/src/sys/vm/vm_map.c:2148 2nd 0xc042f110 system map (system map) @ /usr/p4/tjr/src/sys/vm/vm_kern.c:325 In case the line numbers in my tree are slightly out of sync: vm_map.c:2148 is in vm_map_delete(): 2143 if (object->ref_count != 1 && 2144 (object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING && 2145 (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { 2146 VM_OBJECT_UNLOCK(object); 2147 vm_object_collapse(object); 2148 VM_OBJECT_LOCK(object); 2149 vm_object_page_remove(object, offidxstart, offidxend, FALSE); 2150 if (object->type == OBJT_SWAP) 2151 swap_pager_freespace(object, offidxstart, count); vm_kern.c:325 is in kmem_malloc(): 320 /* 321 * Locate sufficient space in the map. This will give us the final 322 * virtual address for the new memory, and thus will tell us the 323 * offset within the kernel map. 324 */ 325 vm_map_lock(map); 326 if (vm_map_findspace(map, vm_map_min(map), size, &addr)) { 327 vm_map_unlock(map); 328 if (map != kmem_map) { 329 static int last_report; /* when we did it (in ticks) */ Kernel config is GENERIC minus a few things, plus WITNESS, WITNESS_SKIPSPIN, INVARIANTS, INVARIANTS_SUPPORT, DEBUG_VFS_LOCKS, and DIAGNOSTIC. Tim