NetBSD Problem Report #54664

From  Wed Oct 30 17:55:02 2019
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id C3D937A1D3
	for <>; Wed, 30 Oct 2019 17:55:02 +0000 (UTC)
Message-Id: <>
Date: Wed, 30 Oct 2019 17:55:01 +0000 (UTC)
Subject: fdtbus_regulator_acquire lockdebug error
X-Send-Pr-Version: www-1.0

>Number:         54664
>Category:       port-evbarm
>Synopsis:       fdtbus_regulator_acquire lockdebug error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jmcneill
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 18:00:00 +0000 2019
>Closed-Date:    Sun Aug 08 15:24:29 +0000 2021
>Last-Modified:  Sun Aug 08 15:25:01 +0000 2021
>Originator:     Tobias Nygren
>Release:        9.99.17
lock address : 0x0000000090eba31c type     :               spin
initialized  : 0x000000008003c210
shared holds :                  0 exclusive:                  1
shares wanted:                  0 exclusive:                  0
current cpu  :                  0 last held:                  0
current lwp  : 0x000000008078b700 last held: 0x000000008078b700
last locked* : 0x000000008003cb00 unlocked : 0x000000008003cce8
owner field  : 0x0000000000010500 wait/spin:                0/1

panic: LOCKDEBUG: Mutex error: assert_sleepable,70: spin lock held
cpu0: Begin traceback...
0x80aed9fc: netbsd:db_panic+0x14
0x80aeda14: netbsd:vpanic+0x194
0x80aeda2c: netbsd:snprintf
0x80aeda6c: netbsd:lockdebug_more
0x80aeda9c: netbsd:lockdebug_barrier+0xd0
0x80aedac4: netbsd:assert_sleepable+0x40
0x80aedb14: netbsd:pool_cache_get_paddr+0x1bc
0x80aedb3c: netbsd:kmem_intr_alloc+0x68
0x80aedb5c: netbsd:kmem_alloc+0x5c
0x80aedb74: netbsd:fdtbus_regulator_acquire+0x6c
0x80aedbec: netbsd:sunxi_pinctrl_set_config+0x2d4
0x80aedc24: netbsd:fdtbus_pinctrl_set_config_index+0xcc
0x80aedc44: netbsd:fdtbus_pinctrl_set_config+0x40
0x80aedc64: netbsd:fdt_pre_attach+0x64
0x80aeddcc: netbsd:fdt_scan+0x174
0x80aeddec: netbsd:fdt_rescan+0x5c
0x80aede24: netbsd:config_attach_loc+0x1b4
0x80aede54: netbsd:config_found_sm_loc+0x54
0x80aede6c: netbsd:config_found+0x2c
0x80aedea4: netbsd:arm_fdt_attach+0x68
0x80aededc: netbsd:config_attach_loc+0x1b4
0x80aedf04: netbsd:config_rootfound+0x48
0x80aedf24: netbsd:cpu_configure+0x58
0x80aedf9c: netbsd:main+0x2e0
0x80aedfac: netbsd:kernel_text+0x50
cpu0: End traceback...

Boot LOCKDEBUG kernel on sunxi.
The problem is that sunxi_pinctrl_set_config() calls fdtbus_regulator_acquire() with spin mutex sunxi_gpio_softc.sc_lock held, but fdtbus_regulator_acquire() calls kmem_alloc with flag KM_SLEEP. That's not permitted.

Either make fdtbus_regulator_acquire() use KM_NOSLEEP or refactor it's callers to not hold spin mutexes.



Responsible-Changed-From-To: port-evbarm-maintainer->jmcneill
Responsible-Changed-When: Sun, 08 Aug 2021 15:24:29 +0000

State-Changed-From-To: open->closed
State-Changed-When: Sun, 08 Aug 2021 15:24:29 +0000

From: "Jared D. McNeill" <>
Subject: PR/54664 CVS commit: src/sys/dev/fdt
Date: Sun, 8 Aug 2021 15:23:42 +0000

 Module Name:	src
 Committed By:	jmcneill
 Date:		Sun Aug  8 15:23:42 UTC 2021

 Modified Files:
 	src/sys/dev/fdt: fdt_regulator.c

 Log Message:
 fdt: regulator: pre-allocate regulator handle

 Workaround for PR# port-evbarm/54664

 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_regulator.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.