Re: dev_lock() question
From: John Baldwin (jhb_at_FreeBSD.org)
Date: 09/30/05
- Previous message: John Baldwin: "Re: freebsd-5.4-stable panics"
- In reply to: Poul-Henning Kamp: "Re: dev_lock() question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: freebsd-hackers@freebsd.org Date: Fri, 30 Sep 2005 08:59:59 -0400
On Thursday 29 September 2005 03:36 pm, Poul-Henning Kamp wrote:
> In message <200509291455.59914.jhb@FreeBSD.org>, John Baldwin writes:
> >On Thursday 29 September 2005 02:14 pm, Poul-Henning Kamp wrote:
> >> In message <200509291408.18098.jhb@FreeBSD.org>, John Baldwin writes:
> >> >Actually, you would think that it could be initialized either via an
> >> > early SYSINIT() or in the init_mutexes() function in kern_mutex.c and
> >> > thus not need the early check and avoid penalizing dev_lock().
> >> >
> >> >phk, how early his dev_lock needed?
> >>
> >> Far too early due to console madness (in syscons I belive).
> >
> >So would mutex_init() work?
>
> Havn't tried. It basically has to work right before the copyright
> is printed.
Actually, mutexes won't work until after mutex_init() anyway, so it had better
work. :) I'll try it out. Patch is below for reference:
--- //depot/vendor/freebsd/src/sys/kern/kern_conf.c 2005/09/19 20:01:08
+++ //depot/projects/smpng/sys/kern/kern_conf.c 2005/09/30 12:57:36
@@ -57,8 +57,7 @@
void
dev_lock(void)
{
- if (!mtx_initialized(&devmtx))
- mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
+
mtx_lock(&devmtx);
}
--- //depot/vendor/freebsd/src/sys/kern/kern_mutex.c 2005/09/02 20:25:20
+++ //depot/projects/smpng/sys/kern/kern_mutex.c 2005/09/30 12:57:36
@@ -900,5 +935,6 @@
mtx_init(&Giant, "Giant", NULL, MTX_DEF | MTX_RECURSE);
mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE);
mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
+ mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
mtx_lock(&Giant);
}
-- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: John Baldwin: "Re: freebsd-5.4-stable panics"
- In reply to: Poul-Henning Kamp: "Re: dev_lock() question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|