git: 5346c8bc543a - stable/13 - Suppress D_NEEDGIANT warnings for some drivers
Mark Johnston
markj at FreeBSD.org
Mon Jun 14 20:25:26 UTC 2021
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=5346c8bc543a09932b168f459e8a7a601af4bfdc
commit 5346c8bc543a09932b168f459e8a7a601af4bfdc
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-06-06 20:40:19 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-06-14 20:25:14 +0000
Suppress D_NEEDGIANT warnings for some drivers
During boot we warn that the kbd and openfirm drivers are Giant-locked
and may be deleted. Generally, the warning helps signal that certain
old drivers are not being maintained and are subject to removal, but
this doesn't really apply to certain drivers which are harder to
detangle from Giant.
Add a flag, D_GIANTOK, that devices can specify to suppress the
misleading warning. Use it in the kbd and openfirm drivers.
Reviewed by: imp, jhb
Sponsored by: The FreeBSD Foundation
(cherry picked from commit fbeb4ccac990fdb3bc26ab925a3ca8e7d2f89721)
---
sys/dev/kbd/kbd.c | 2 +-
sys/dev/ofw/openfirmio.c | 2 +-
sys/kern/kern_conf.c | 2 +-
sys/sys/conf.h | 1 +
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index fd996f7a06ad..70c0ef15a56e 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -453,7 +453,7 @@ static d_poll_t genkbdpoll;
static struct cdevsw kbd_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
+ .d_flags = D_NEEDGIANT | D_GIANTOK,
.d_open = genkbdopen,
.d_close = genkbdclose,
.d_read = genkbdread,
diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c
index 2112d45d4dd9..30afb85baf8a 100644
--- a/sys/dev/ofw/openfirmio.c
+++ b/sys/dev/ofw/openfirmio.c
@@ -66,7 +66,7 @@ static d_ioctl_t openfirm_ioctl;
static struct cdevsw openfirm_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
+ .d_flags = D_NEEDGIANT | D_GIANTOK,
.d_ioctl = openfirm_ioctl,
.d_name = "openfirm",
};
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 3a07c95e74d0..42435c0b8740 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -665,7 +665,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags)
devsw->d_kqfilter = dead_kqfilter;
}
- if (devsw->d_flags & D_NEEDGIANT) {
+ if ((devsw->d_flags & (D_NEEDGIANT | D_GIANTOK)) == D_NEEDGIANT) {
printf("WARNING: Device \"%s\" is Giant locked and may be "
"deleted before FreeBSD 14.0.\n",
devsw->d_name == NULL ? "???" : devsw->d_name);
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 2a87e5d3a9ca..123bf91cf952 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -173,6 +173,7 @@ typedef int dumper_hdr_t(struct dumperinfo *di, struct kerneldumpheader *kdh,
*/
#define D_TRACKCLOSE 0x00080000 /* track all closes */
#define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */
+#define D_GIANTOK 0x00200000 /* suppress warning about using Giant */
#define D_NEEDGIANT 0x00400000 /* driver want Giant */
#define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */
More information about the dev-commits-src-all
mailing list