NetBSD Problem Report #58602

From www@netbsd.org  Thu Aug 15 21:53:43 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B889D1A9242
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 15 Aug 2024 21:53:42 +0000 (UTC)
Message-Id: <20240815215341.927DF1A9243@mollari.NetBSD.org>
Date: Thu, 15 Aug 2024 21:53:41 +0000 (UTC)
From: tnn@nygren.pp.se
Reply-To: tnn@nygren.pp.se
To: gnats-bugs@NetBSD.org
Subject: cy82c693_init() calls bus_space_map() with spin lock held
X-Send-Pr-Version: www-1.0

>Number:         58602
>Category:       port-alpha
>Synopsis:       cy82c693_init() calls bus_space_map() with spin lock held
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thorpej
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 15 21:55:01 +0000 2024
>Closed-Date:    Wed Sep 25 14:41:06 +0000 2024
>Last-Modified:  Wed Sep 25 14:41:06 +0000 2024
>Originator:     Tobias Nygren
>Release:        
>Organization:
>Environment:
>Description:
cy82c693_init() calls bus_space_map with it's spin lock (cyhc_lock) held.
This results in a LOCKDEBUG panic with this backtrace:

lockdebug_abort1()
mutex_enter()
vmem_xalloc()
vmem_xalloc_addr()
cia_swiz_io_map()
cy82c693_init()
cy82c693_setup_elcr()
sio_intr_setup()
pci_eb164_pickintr()
alpha_pci_intr_init()
ciaattach()
...
>How-To-Repeat:
Boot pc164sx with LOCKDEBUG kernel.
>Fix:
Rewrite the init code so it doesn't hold a spin lock.
It looks ok to me to use a regular IPL_NONE mutex instead.
None of this code seems to be called from interrupt handlers.


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-alpha-maintainer->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Sat, 17 Aug 2024 14:51:05 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->analyzed
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Sat, 17 Aug 2024 14:51:05 +0000
State-Changed-Why:
Fix in progress.


From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58602 CVS commit: src/sys/dev/pci
Date: Sat, 17 Aug 2024 14:58:51 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sat Aug 17 14:58:51 UTC 2024

 Modified Files:
 	src/sys/dev/pci: cy82c693.c

 Log Message:
 Make the cyhc lock a regular mutex rather than a spin mutex.  Simplify
 some interaction with the lock by converting some open-coded test/panic
 blocks to KASSERT()s that can be safely tested outside the lock perimeter.

 PR port-alpha/58602


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/cy82c693.c

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

State-Changed-From-To: analyzed->feedback
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Sat, 17 Aug 2024 15:01:23 +0000
State-Changed-Why:
Please confirm that -current LOCKDEBUG kernels boot for you now and
I'll pull this up to -10.


State-Changed-From-To: feedback->needs-pullups
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Sun, 18 Aug 2024 17:58:36 +0000
State-Changed-Why:
confirmed fixed


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58602 CVS commit: [netbsd-10] src/sys/dev/pci
Date: Sat, 24 Aug 2024 16:32:00 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Aug 24 16:32:00 UTC 2024

 Modified Files:
 	src/sys/dev/pci [netbsd-10]: cy82c693.c

 Log Message:
 Pull up following revision(s) (requested by thorpej in ticket #809):

 	sys/dev/pci/cy82c693.c: revision 1.11

 Make the cyhc lock a regular mutex rather than a spin mutex.  Simplify
 some interaction with the lock by converting some open-coded test/panic
 blocks to KASSERT()s that can be safely tested outside the lock perimeter.

 PR port-alpha/58602


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.10.34.1 src/sys/dev/pci/cy82c693.c

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

State-Changed-From-To: needs-pullups->closed
State-Changed-By: rin@NetBSD.org
State-Changed-When: Wed, 25 Sep 2024 14:41:06 +0000
State-Changed-Why:
Pulled up to netbsd-10 as intended by Committer.
Please feel free to reopen if you want this in netbsd-9.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.