Re: hires timestamps for netif_rx()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 18, 2002 at 12:36:00PM -0800, David S. Miller wrote:
> Andi, the x86 platforms that have SMP have TSC and in that
> case do_get_fast_time == do_gettimeofday and there is no read locking
> :-))))))))))))

Unless I'm misreading the code completely there is readlocking:

void do_gettimeofday(struct timeval *tv)
{
        unsigned long flags;
        unsigned long usec, sec;

        read_lock_irqsave(&xtime_lock, flags);
        usec = do_gettimeoffset();

...

      if (cpu_has_tsc) {
                unsigned long tsc_quotient = calibrate_tsc();
                if (tsc_quotient) {
						...
                        do_get_fast_time = do_gettimeofday;

void (*do_get_fast_time)(struct timeval *) = do_normal_gettime;

/*
 * Generic way to access 'xtime' (the current time of day).
 * This can be changed if the platform provides a more accurate (and fast!) 
 * version.
 */

void get_fast_time(struct timeval * t)
{
        do_get_fast_time(t);
}

There would be no locking if get_fast_time used do_gettimeoffset, but it doesn't.

The only lockless i386 gettimeofday i'm aware of is the one in the x86-64 vsyscall
implementation from Andrea.

Anyways. I guess it would hurt to change get_fast_time to gettimeoffset because
it could cause non-monotonies for software that is comparing the socket timestamp
with gettimeofday. A better plan might be to port Andrea's version over to
the generic TSC do_gettimeofday and avoid the lock. 

-Andi

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux