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
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30649
This commit is contained in:
Mark Johnston 2021-06-06 16:40:19 -04:00
parent 62b8258a7e
commit fbeb4ccac9
4 changed files with 4 additions and 3 deletions

View File

@ -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,

View File

@ -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",
};

View File

@ -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);

View File

@ -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() */