From 9d326f986025ff7aaf96c273284c1f1906df42d7 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 1 Feb 2022 11:21:26 +0000 Subject: [PATCH 02/13] squash! autoconf(9): New localcount-based device instance references. - Add ASSERT_SLEEPABLE() to device_lookup_acquire. - Note possible sleep in comments. --- sys/kern/subr_autoconf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 39774727aeee..f6d443e9f1f6 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -2631,6 +2631,9 @@ config_alldevs_exit(struct alldevs_foray *af) * node and ensuring *_detach calls vdevgone). * * XXX Find a way to assert this. + * + * Safe for use up to and including interrupt context at IPL_VM. + * Never sleeps. */ device_t device_lookup(cfdriver_t cd, int unit) @@ -2672,12 +2675,16 @@ device_lookup_private(cfdriver_t cd, int unit) * returned. May succeed or fail in that case, depending on * whether *_detach has backed out (EBUSY) or committed to * detaching. + * + * May sleep. */ device_t device_lookup_acquire(cfdriver_t cd, int unit) { device_t dv; + ASSERT_SLEEPABLE(); + /* XXX This should have a pserialized fast path -- TBD. */ mutex_enter(&config_misc_lock); mutex_enter(&alldevs_lock);