NetBSD Problem Report #21607
Received: (qmail 20552 invoked by uid 605); 17 May 2003 05:24:50 -0000
Message-Id: <20030517052445.F2ACD11154@narn.netbsd.org>
Date: Sat, 17 May 2003 05:24:45 +0000 (UTC)
From: kochi@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: kochi@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: sysmon_power : locking against myself
X-Send-Pr-Version: www-1.0
>Number: 21607
>Category: kern
>Synopsis: sysmon_power : locking against myself
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 17 05:25:01 +0000 2003
>Closed-Date: Mon May 19 23:28:05 +0000 2003
>Last-Modified: Mon May 19 23:28:05 +0000 2003
>Originator: Takayoshi Kochi
>Release: NetBSD 1.6T (20030517)
>Organization:
>Environment:
NetBSD xxxxx 1.6T NetBSD 1.6T (AX4PE) #1: Sat May 17 13:46:40 JST 2003 kochi@xxxxx:/home/kochi/conf/kernel/ax4pe i386
>Description:
A kernel built with MULTIPROCESSOR fails to get a lock when power
button is pressed.
Here's the log with LOCKDEBUG enabled.
simple_lock: locking against myself
lock: 0xc0365798, currently at: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:268 on cpu 0
last locked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:400
last unlocked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:270
filt_sysmon_power_read(c1c68000,0,e4655ecc,c01f7bd3,e4655f1c) at netbsd:filt_sysmon_power_read:0x21
knote(c0370970,0,e4655eec,c01f7f7c,c1af0350) at netbsd:knote+0x21
sysmon_pswitch_event(c1af0350,0,0,c01475eb,c03657b4) at netbsd:sysmon_pswitch_event+0x5b
acpi_fixed_button_pressed(c1af0350,c030a2a0,b9,e4655f90,e4651080) at netbsd:acpi_fixed_button_pressed+0x13
sysmon_task_queue_thread(e4651080,0,0,0,c010030c) at netbsd:sysmon_task_queue_thread+0x1bb
Stopped in pid 2.1 (sysmon taskq) at netbsd:cpu_Debugger+0x4: leave
db{0}>
>How-To-Repeat:
Build a kernel with "options MULTIPROCESSOR" with acpibut, run the kernel and push power button.
>Fix:
nothing yet
>Release-Note:
>Audit-Trail:
From: Takayoshi Kochi <t-kouchi@mud.biglobe.ne.jp>
To: gnats-bugs@netbsd.org
Cc: kochi@netbsd.org
Subject: Re: kern/21607
Date: Tue, 20 May 2003 01:01:36 +0900
Also, I got following messages when I configure a kernel
without MULTIPROCESSOR.
simple_lock: lock held
lock: 0xc035fe4c, currently at: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:268
last locked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:400
last unlocked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:270
filt_sysmon_power_read(c1bdd000,0,e45c2ecc,c027793a,e45c2f1c) at netbsd:filt_sysmon_power_read+0x21
knote(c036e970,0,dabd6,0,c1ab7e50) at netbsd:knote+0x21
sysmon_queue_power_event(e45c2f1c,0,e45c2f20,c0151d62,e45c2f20) at netbsd:sysmon_queue_power_event+0xa1
sysmon_pswitch_event(c1ab7e50,0,0,c015233f,c035fe68) at netbsd:sysmon_pswitch_event+0x5b
acpi_fixed_button_pressed(c1ab7e50,c030ca40,b9,e45be080,e45be080) at netbsd:acpi_fixed_button_pressed+0x13
sysmon_task_queue_thread(e45be080,0,0,0,c010030c) at netbsd:sysmon_task_queue_thread+0x197
simple_unlock: lock not held
lock: 0xc035fe4c, currently at: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:411
last locked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:400
last unlocked: /home/kochi/nbwk/sys/dev/sysmon/sysmon_power.c:270
sysmon_pswitch_event(c1ab7e50,0,0,c015233f,c035fe68) at netbsd:sysmon_pswitch_event+0x77
acpi_fixed_button_pressed(c1ab7e50,c030ca40,b9,e45be080,e45be080) at netbsd:acpi_fixed_button_pressed+0x13
sysmon_task_queue_thread(e45be080,0,0,0,c010030c) at netbsd:sysmon_task_queue_thread+0x197
Thanks,
Takayoshi Kochi
From: Takayoshi Kochi <kochi@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/21607
Date: Tue, 20 May 2003 01:48:16 +0900 (JST)
The patch attached below works for me.
--- sysmon_power.c.orig Mon May 12 22:32:12 2003
+++ sysmon_power.c Tue May 20 01:19:05 2003
@@ -96,12 +96,6 @@
SYSMON_NEXT_EVENT(sysmon_power_event_queue_head);
sysmon_power_event_queue_count++;
- if (sysmon_power_event_queue_flags & PEVQ_F_WAITING) {
- sysmon_power_event_queue_flags &= ~PEVQ_F_WAITING;
- wakeup(&sysmon_power_event_queue_count);
- }
- selnotify(&sysmon_power_event_queue_selinfo, 0);
-
return (1);
}
@@ -408,12 +402,23 @@
strcpy(pev.pev_switch.psws_name, smpsw->smpsw_name);
rv = sysmon_queue_power_event(&pev);
- simple_unlock(&sysmon_power_event_queue_slock);
- if (rv == 0)
+ if (rv == 0) {
+ simple_unlock(&sysmon_power_event_queue_slock);
printf("%s: WARNING: state change event %d lost; "
"queue full\n", smpsw->smpsw_name,
pev.pev_type);
- return;
+ return;
+ } else {
+ if (sysmon_power_event_queue_flags & PEVQ_F_WAITING) {
+ sysmon_power_event_queue_flags &= ~PEVQ_F_WAITING;
+ simple_unlock(&sysmon_power_event_queue_slock);
+ wakeup(&sysmon_power_event_queue_count);
+ } else {
+ simple_unlock(&sysmon_power_event_queue_slock);
+ }
+ selnotify(&sysmon_power_event_queue_selinfo, 0);
+ return;
+ }
}
simple_unlock(&sysmon_power_event_queue_slock);
State-Changed-From-To: open->feedback
State-Changed-By: kochi
State-Changed-When: Mon May 19 16:51:00 UTC 2003
State-Changed-Why:
A patch for the problem is made.
State-Changed-From-To: feedback->closed
State-Changed-By: kochi
State-Changed-When: Mon May 19 23:27:18 UTC 2003
State-Changed-Why:
The patch was ok'd by Jason Thorpe and I committed it.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.