[concurrency-interest] tsc register

Blair Zajac blair at orcaware.com
Fri Jan 13 23:37:10 EST 2012


On Jan 12, 2012, at 9:17 PM, David Holmes wrote:

> If you want to check TSC stability check out this test program by Ingo Molnar:
> 
> http://people.redhat.com/mingo/time-warp-test/time-warp-test.c

I cannot get this to compile on a 64-bit Ubuntu 11.10 system.  The first error is fixed by passing 0755 to open():

$ gcc -Wall -O2 -o time-warp-test time-warp-test.c -lrt
In file included from /usr/include/fcntl.h:252:0,
                 from time-warp-test.c:24:
In function ‘open’,
    inlined from ‘setup_shared_var’ at time-warp-test.c:127:5:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:51:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments

The second error I don't know how to get around, since I don't know assembler:

$ gcc -Wall -O2 -o time-warp-test time-warp-test.c -lrt
time-warp-test.c: Assembler messages:
time-warp-test.c:169: Error: incorrect register `%rax' used with `l' suffix
time-warp-test.c:169: Error: incorrect register `%rax' used with `l' suffix

This is the code, but changing the '#if 0' to '#if 1' gets a similar error.

static inline void unlock(unsigned long *flag)
{
#if 0
        __asm__ __volatile__(
                "lock; btrl $0,%0\n"
                             : "=g"(*flag) :: "memory");
        __asm__ __volatile__("rep; nop");
#else
        __asm__ __volatile__("movl $0,%0; rep; nop" : "=g"(*flag) :: "memory");
#endif
}

Blair




More information about the Concurrency-interest mailing list