Re: Linux timekeeping plans

Andi Kleen (ak@muc.de)
Sat, 5 Dec 1998 06:37:28 +0100


In linux-kernel, you wrote:
> volatile master_lock = 1, slave_lock = 0;
>
>master:
> tell_slave_to_start_calibration();
>
> for (i = 0; i < 100; i++) {
> /* Send to slave */
> while (slave_lock) /* Wait for slave to start spinning */
> ;
> nop(); /* Wait a moment for slave to really start spinning */
> master_time[2*i] = rdtsc();
> master_lock = 1;
>
> /* Receive from slave */
> master_lock = 0; /* Announce that we're spinning */
> while (!slave_lock)
> ;

I think you need mb() after the setting of master/slave_lock to make sure
that the other CPU sees it as early as possible.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/