NetBSD Problem Report #54664

From www@netbsd.org  Wed Oct 30 17:55:02 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C3D937A1D3
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 30 Oct 2019 17:55:02 +0000 (UTC)
Message-Id: <20191030175501.4AD167A25B@mollari.NetBSD.org>
Date: Wed, 30 Oct 2019 17:55:01 +0000 (UTC)
From: tnn@nygren.pp.se
Reply-To: tnn@nygren.pp.se
To: gnats-bugs@NetBSD.org
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:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 18:00:00 +0000 2019
>Originator:     Tobias Nygren
>Release:        9.99.17
>Organization:
>Environment:
>Description:
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...

>How-To-Repeat:
Boot LOCKDEBUG kernel on sunxi.
>Fix:
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.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.