Subject: Re: Easy to follow NAMED & SSHD.... inc. apology :)
To: Aaron J. Grier <agrier@poofygoof.com>
From: David A. Gatwood <dgatwood@apple.com>
List: port-mac68k
Date: 01/10/2002 13:26:41
On Thursday, January 10, 2002, at 11:23 AM, Aaron J. Grier wrote:

On Mon, Dec 31, 2001 at 06:48:25PM -0700, Don Yuniskis wrote:

- time server (there be dragons here)

completely unusable unless you want to break out the SMT soldering gear,
razor, and magnet wire to swap physical interrupt lines.  apple in their
infinite stuck-in-1984 wisdom decided that the clock interrupt takes
lowest priority, and if you're getting network traffic or disk I/O, the
clock interrupt gets starved out and NTP can't really deal with it.

There are ways of dealing with this, but probably none that you guys would be willing to work up.  ;-)

1.  The Mac OS X way: Make your interrupt handler extraordinarily small, and do the actual work in a kernel thread.  That way you shouldn't drop interrupts on the floor in the first place.  This is a little abstract, but something lilke:

unsigned long device1_count;
low_level_interrupt_handler_routine()
{
    while (still have more interrupt sources to poll) {
	ret=poll_interrupt_source(blah)
	if (ret & kDevice1Mask) {
		device1_count++
		some_interupt_received=1;
	}
	.
	.
	}
    if(some_interrupt_received) {
	some_interrupt_received = 0;
	wake_interrupt_thread()
    }
}


interrupt_thread()
{
unsigned long local_device1_count, temp_count;
unsigned long rep, i;

    while (1) {
	temp_count = device1_count; /* grab global value */
	if (temp_count != local_device1_count) {
	    rep = temp_count - local_device1_count;
	    local_device1_count = temp_count;
	    for (i=0; i<rep; i++) {
		dohandler(device1);
	    }
	}
    sleep_until_next_message_event();
    }
}

2.  The <10 way: After long periods of disk activity, grab the RTC value and use it.  (At least I think I remember reading that classic Mac OS does this.)
3.  Use a different clock source.  Does anyone have a list of the different IPLs for these machines?


Thoughts?
David