thinkpad(4): Don't detach on shutdown.
There's no important state that needs to be recorded, or resources that need to be relinquished, so detach-on-shutdown isn't necessary. At the moment, detach-on-shutdown is actually harmful here: if shutdown is triggered by a sysmon power switch event, then config_detach will be called from the sysmon taskqueue, but thinkpad_detach has to wait for ACPI notifiers to finish running which means waiting for the sysmon taskqueue -> deadlock or crash. We should maybe arrange to do config_detach from a thread other than the sysmon taskqueue thread to avoid this class of problems -- but for now, thinkpad(4) has no reason to detach on shutdown anyway, so let's take the easy path. Note: There are many drivers that set DVF_DETACH_SHUTDOWN which probably shouldn't; the flag means the kernel _will_ detach on shutdown, not that it _may_. Even those that do need to record state or relinquish resources might be better served by pmf shutdown hooks which can skip freeing software resources for faster shutdown.
This commit is contained in:
parent
1536c4bfa3
commit
8769a2203d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: thinkpad_acpi.c,v 1.54 2021/12/31 17:22:35 riastradh Exp $ */
|
||||
/* $NetBSD: thinkpad_acpi.c,v 1.55 2022/08/12 16:21:41 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.54 2021/12/31 17:22:35 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.55 2022/08/12 16:21:41 riastradh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -170,7 +170,7 @@ static void thinkpad_cmos(thinkpad_softc_t *, uint8_t);
|
|||
|
||||
CFATTACH_DECL3_NEW(thinkpad, sizeof(thinkpad_softc_t),
|
||||
thinkpad_match, thinkpad_attach, thinkpad_detach, NULL, NULL, NULL,
|
||||
DVF_DETACH_SHUTDOWN);
|
||||
0);
|
||||
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ .compat = "IBM0068" },
|
||||
|
|
Loading…
Reference in New Issue