[ofa-general] Re: [Bug 408] dapltest compilation fails on x86 [PATCH]
Michael S. Tsirkin
mst at dev.mellanox.co.il
Sat Mar 17 10:35:31 PDT 2007
> > > > @@ -143,7 +143,7 @@ DT_Mdep_GetTimeStamp ( void )
> > > > asm volatile("rdtsc" : "=a" (__a), "=d" (__d));
> > > > return ((unsigned long)__a) | (((unsigned long)__d)<<32);
> > > > #else
> > > > -#error "Non-Pentium and Non-PPC Linux - unimplemented"
> > > > +#error "Linux CPU architecture - unimplemented"
> > > > #endif
> > > > #endif
> > > > #endif
> >
> > You can't detect a pentium processor at compile-time, and testing
> > for __PENTIUM__ is the wrong thing to do - you are actually testing
> > for pentium-only optimizations being enabled in compiler.
> >
> > You really must test for processor type at run time.
>
> How do you suggest performing the run time check?
>
> Parse /proc/cpuinfo for the "tsc" string in the flags field, use
> assembly programming to check the eflags & issue a CPUID
> instruction,...?
>
> We'd like something easy to maintain.
I think either if these methods will do.
Assembly will probably be shorter and have less chances to break with kernel
changes.
--
MST
More information about the general
mailing list