(unknown charset) Re: weird fxp / timecounter interaction in top-of-tree

From: (unknown charset) Bruce Evans <bde_at_zeta.org.au>
Date: Mon, 7 Apr 2003 08:25:27 +1000 (EST)
On Sun, 6 Apr 2003, Dag-Erling [iso-8859-1] Smørgrav wrote:

> des_at_ofug.org (Dag-Erling Smørgrav) writes:
> >  - loading the if_fxp module (and miibus as a dependency) switches the
> >    timecounter hardware to PIIX.
>
> This turns out to be caused by a combination of bugs in tc_init() and
> the piix driver.  The piix driver initializes the PIIX timecounter in
> piix_attach(), which is called whenever the PCI bus is rescanned (e.g.
> when a driver for a PCI device such as fxp is loaded) instead of
> piix_probe() which is only called once.  The other problem is that
> tc_init() will actually install the timecounter being initialized, so
> in effect, unless you explicitly select one after boot, your machine
> will use whichever timecounter was probed and attached last.
>
> I've modified the piix driver to only initialize the timecounter once,
> and tc_init() to use the *first* timecounter it runs across (on i386,
> this is generally the i8254), leaving the admin to pick another one if
> the default does not suit her.  See the attached patch.

Do any other attach routines get called on rescan?  I would expect most of
them to do the wrong thing.

> Index: sys/kern/kern_tc.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/kern_tc.c,v
> retrieving revision 1.148
> diff -u -r1.148 kern_tc.c
> --- sys/kern/kern_tc.c	18 Mar 2003 08:45:23 -0000	1.148
> +++ sys/kern/kern_tc.c	6 Apr 2003 18:06:38 -0000
> _at__at_ -295,7 +295,8 _at__at_
>  	printf("\n");
>  	(void)tc->tc_get_timecount(tc);
>  	(void)tc->tc_get_timecount(tc);
> -	timecounter = tc;
> +	if (timecounter == &dummy_timecounter)
> +		timecounter = tc;
>  }

This is not quite right (see other replies), but tc_init() should be split
up so that it never decides whether to start using the timecounter.  Note
that the tc_get_timecounter() calls are part of using it.

Bruce
Received on Sun Apr 06 2003 - 13:25:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:02 UTC