NetBSD Problem Report #60735

From www@netbsd.org  Wed Sep 16 21:42:20 2026
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 "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 12BD21A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Sep 2026 21:42:20 +0000 (UTC)
Message-Id: <20260916214218.EC1C61A923C@mollari.NetBSD.org>
Date: Wed, 16 Sep 2026 21:42:18 +0000 (UTC)
From: royce@tycho.org
Reply-To: royce@tycho.org
To: gnats-bugs@NetBSD.org
Subject: BEEP_ONHALT fails on i386
X-Send-Pr-Version: www-1.0
X-From4GNATS: "royce@tycho.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60735
>Notify-List:    riastradh
>Category:       kern
>Synopsis:       BEEP_ONHALT fails on i386
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 16 21:45:02 +0000 2026
>Closed-Date:    
>Last-Modified:  Mon Oct 05 12:39:29 +0000 2026
>Originator:     Royce Williams
>Release:        11.0
>Organization:
>Environment:
Reproduced on multiple devices, from QEMU:
NetBSD 11.0 (QEMU_BEEPHALT) #0: Wed Sep 16 13:23:26 AKDT 2026
... and a physical device (Whistle InterJet, 486):
NetBSD test 11.0 NetBSD 11.0 (INTERJET_64M) #24: Tue Sep 15 21:57:21 AKDT 2026 
>Description:
BEEP_ONHALT seems to be designed to notify the user when halt has completed (and it's OK to shut down) -- but it looks like the components necessary to make that work on i386 have a gap, such that the beeping will never happen in practice without some adjustment.

Since many folks probably don't have a PC speaker anymore, this can be reproduced by telling QEMU to send its audio output to a file:

-audiodev wav,path=

I have a Whistle InterJet that I'm testing on and it reproduces the problem.
>How-To-Repeat:
1. Uncomment this in i386 GENERIC (NetBSD 11.0 release):

options        BEEP_ONHALT

2. On an i386-compatible system with a PC speaker, build, install, and boot.

3. Execute:

shutdown -h now

4. Expected: three beeps near/after "The operating system has halted."
   Actual:   silence

   Console shows:

sysbeep0: detached
[...]
The operating system has halted.

>Fix:
Not sure. Naively, moving the beep earlier than the device detachment would be one way, or making it so that sysbeep doesn't actually detach, or having the halt do the beeping itself directly ... but I have no idea about the trade-offs or other implications of these. In my searching it did seem like FreeBSD uses the "halt beeps on its own" approach.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 16 Sep 2026 21:58:54 +0000
State-Changed-Why:
Candidate fix committed, can you try a current kernel with sysbeep.c
rev. 1.44 and see if the problem persists?


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60735 CVS commit: src/sys/arch/x86/isa
Date: Wed, 16 Sep 2026 21:57:38 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Sep 16 21:57:38 UTC 2026

 Modified Files:
 	src/sys/arch/x86/isa: clock.c

 Log Message:
 x86/sysbeep(4): Don't detach at shutdown.

 This reverts sys/arch/x86/isa/clock.c rev. 1.32, which was the first
 of a spate of changes to sprinkle DVF_DETACH_SHUTDOWN for reasons
 that were unclear and apparently interfere with other functionality:

 > Module Name:    src
 > Committed By:   dyoung
 > Date:           Tue Apr  7 17:51:46 UTC 2009
 >
 > Modified Files:
 >         src/sys/arch/x86/isa: clock.c
 >
 > Log Message:
 > Detach sysbeep0 at shutdown.
 >
 >
 > To generate a diff of this commit:
 > cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/isa/clock.c

 https://mail-index.netbsd.org/source-changes/2009/04/07/msg219296.html

 The only reason to use DVF_DETACH_SHUTDOWN would be if:

 (a) the driver actually has to flush some stored state or release
     some hardware resources, and

 (b) a pmf shutdown hook can't do it or would do essentially the same
     as detaching anyway (e.g., it involves forcibly detaching its
     children).

 And if there is such a reason, it should be explained!

 Otherwise, requiring detach at shutdown is at best a waste of energy
 and may break other things too.

 PR kern/60735: BEEP_ONHALT fails on i386


 To generate a diff of this commit:
 cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/isa/clock.c

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

From: Royce Williams <royce@tycho.org>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, 
	riastradh@netbsd.org, royce@tycho.org
Subject: Re: kern/60735 (BEEP_ONHALT fails on i386)
Date: Sun, 20 Sep 2026 10:27:33 -0800

 --000000000000a659bc065bee4bad
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 On Wed, Sep 16, 2026 at 1:58=E2=80=AFPM <riastradh@netbsd.org> wrote:

 > Synopsis: BEEP_ONHALT fails on i386
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: riastradh@NetBSD.org
 > State-Changed-When: Wed, 16 Sep 2026 21:58:54 +0000
 > State-Changed-Why:
 > Candidate fix committed, can you try a current kernel with sysbeep.c
 > rev. 1.44 and see if the problem persists?


 Good news: this got me *partway* there - audio is produced! But the
 pitch / speed is off - so low I couldn't hear it (but QEMU-captured .wav
 showed the difference).

 I had to also keep pcppi for it to get the expected pitch/speed,
 three tidy beeps. So I think the full fix needs both attached?

 Royce

 --000000000000a659bc065bee4bad
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 <div dir=3D"ltr"><div dir=3D"ltr"><div><span style=3D"background-color:tran=
 sparent">On Wed, Sep 16, 2026 at 1:58=E2=80=AFPM &lt;<a href=3D"mailto:rias=
 tradh@netbsd.org">riastradh@netbsd.org</a>&gt; wrote:</span></div></div><di=
 v class=3D"gmail_quote gmail_quote_container"><blockquote class=3D"gmail_qu=
 ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
 4);padding-left:1ex">Synopsis: BEEP_ONHALT fails on i386<br>
 <br>
 State-Changed-From-To: open-&gt;feedback<br>
 State-Changed-By: riastradh@NetBSD.org<br>
 State-Changed-When: Wed, 16 Sep 2026 21:58:54 +0000<br>
 State-Changed-Why:<br>
 Candidate fix committed, can you try a current kernel with sysbeep.c<br>
 rev. 1.44 and see if the problem persists?</blockquote><div><br></div><div>=
 Good news: this got me *partway* there - audio is produced! But the <br>pit=
 ch / speed is off - so low I couldn&#39;t hear it (but QEMU-captured .wav <=
 br>showed the difference).</div><div><br></div><div>I had to also keep pcpp=
 i for it to get the expected pitch/speed,</div><div>three tidy beeps. So I =
 think the full fix needs both attached?</div><div><br></div><div><span styl=
 e=3D"background-color:transparent">Royce</span></div></div></div>

 --000000000000a659bc065bee4bad--

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60735 CVS commit: src/sys/dev/isa
Date: Sun, 20 Sep 2026 19:18:31 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sun Sep 20 19:18:31 UTC 2026

 Modified Files:
 	src/sys/dev/isa: pcppi.c

 Log Message:
 pcppi(4): Don't detach at shutdown.

 No reason was ever given for detaching this at shutdown; if there's
 some important resource to release, it can be done in a pmf hook, but
 otherwise it interferes with other functionality.

 PR kern/60735: BEEP_ONHALT fails on i386


 To generate a diff of this commit:
 cvs rdiff -u -r1.48 -r1.49 src/sys/dev/isa/pcppi.c

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

From: Royce Williams <royce@tycho.org>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	royce@tycho.org, riastradh@netbsd.org
Subject: Re: PR/60735 CVS commit: src/sys/dev/isa
Date: Sun, 4 Oct 2026 21:39:16 -0800

 FWIW, keeping both both sysbeep and pcppi did resolve my issue.

State-Changed-From-To: feedback->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 05 Oct 2026 12:39:29 +0000
State-Changed-Why:
Lot more drivers probably have spurious DVF_DETACH_SHUTDOWN, but this
was enough to resolve the problem at hand, so let's pull it up to
netbsd-11 and netbsd-10.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.