NetBSD Problem Report #59276

From paul@whooppee.com  Thu Apr 10 23:28:21 2025
Return-Path: <paul@whooppee.com>
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 51E911A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 10 Apr 2025 23:28:21 +0000 (UTC)
Message-Id: <20250410232818.A071E49A96C@speedy.whooppee.com>
Date: Thu, 10 Apr 2025 16:28:18 -0700 (PDT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: Detach driver if a module later provides a higher-priority match
X-Send-Pr-Version: 3.95

>Number:         59276
>Category:       kern
>Synopsis:       Detach driver if a module later provides a higher-priority match
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 10 23:30:01 +0000 2025
>Last-Modified:  Tue Apr 15 11:50:01 +0000 2025
>Originator:     Paul Goyette
>Release:        NetBSD 10.99.12
>Organization:
+---------------------+--------------------------+----------------------+
| Paul Goyette (.sig) | PGP Key fingerprint:     | E-mail addresses:    |
| (Retired)           | 1B11 1849 721C 56C8 F63A | paul@whooppee.com    |
| Software Developer  | 6E2E 05FD 15CE 9F2D 5102 | pgoyette@netbsd.org  |
| & Network Engineer  |                          | pgoyette99@gmail.com |
+---------------------+--------------------------+----------------------+
>Environment:


System: NetBSD speedy.whooppee.com 10.99.12 NetBSD 10.99.12 (SPEEDY 2025-04-10 11:38:52 UTC) #0: Thu Apr 10 13:10:16 UTC 2025 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
We need a way for bus that is being rescanned to check if any of its
already-attached children have been "superseded" by a higher priority
match (which can happen with a newly-loading driver module).  If a
higher-priority device driver is now available it may need to evict
the current driver (assuming the current driver allows itself to be
detached).

See kern/59253 for a specific example.

>How-To-Repeat:

>Fix:


>Audit-Trail:
From: Christoph Badura <bad@bsd.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/59276: Detach driver if a module later provides a
 higher-priority match
Date: Tue, 15 Apr 2025 13:47:16 +0200

 Here's a more convincing example:

 I've got an Infinite Noise TRNG that attaches as follows:

 uftdi0 at uhub1 port 1 configuration 1 interface 0
 uftdi0: 13-37.org (0x0403) Infinite Noise TRNG (0x6015), rev 2.00/10.00, addr 1
 ucom0 at uftdi0 portno 1

 This is because on Linux it uses a daemon process to feed the RNG data
 through a Keccak sponge to /dev/random.

 I'd like to have it attach directly in the kernel as a rnd(4) source.
 Hence its match routine would need to return a higher priority than uftdi.

 This should work when loaded as a module (if for nothing else than to
 speed up development).

 If the uftdi driver gets autoloaded before this device's driver, it shoudl
 be detached when this driver module is loaded.

 --chris

>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-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.