Re: machdep.conspeed sysctl

From: Peter Jeremy <PeterJeremy_at_optushome.com.au>
Date: Sat, 9 Apr 2005 04:48:39 +1000
On Thu, 2005-Apr-07 21:12:10 -0600, M. Warner Losh wrote:
>In message: <200504061737.18204.michaelnottebrock_at_gmx.net>
>            Michael Nottebrock <michaelnottebrock_at_gmx.net> writes:
>: However, a loader-tunable comconsole speed would *really* be useful IMHO, so
>: perhaps someone could try and make it happen for real? :-)
>
>I backed it out because there was some problem that bde pointed out to
>me.  I can no longer recall what that was...

The log says:
"Until I can figure out how to live without the volatile qualifier on
 comdefaultrate, comment out the support for machdep.conspeed for now."

Presumably gcc and/or bde complained that TUNABLE_INT() expected an
"int *" but was passed "volatile int *".

bde made it volatile in 1.162 though it's not clear to me why the
volatile is needed here.  I probably need to go and have a close study
of exactly what a compiler is permitted to optimise away in the
absence of 'volatile'.

Rather than try and remove the 'volatile', an alternative approach would
be to expand TUNABLE_INT() and use a an alternative to tunable_int_init()
that could handle the volatile:  Replace the current line with (untested):

void
tunable_comdefaultrate_init(void *data __unused)
{
	int	rate;

	TUNABLE_INT_FETCH("machdep.conspeed", &rate);
	comdefaultrate = rate;
}

SYSINIT(Tunable_init_comdefaultrate, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, \
	tunable_comdefaultrate_init, NULL)

-- 
Peter Jeremy
Received on Fri Apr 08 2005 - 16:49:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:31 UTC