lkml.org 
[lkml]   [2008]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] x86: convert rdtscll() to use __native_read_tsc

* Ken Chen <kenchen@google.com> wrote:

> Is there any reason why x86 rdtscll have to use the out of line function
> instead of inline __native_read_tsc()? native_read_tsc and
> __native_read_tsc is essentially the same functions.

Your patch is correct.

The reason for the __native_read_tsc() / native_read_tsc() distinction is
and obscure problem with paravirt function pointers. Such constructs:

./xen/enlighten.c: .read_tsc = native_read_tsc,

do not always work fine with all versions of gcc, if native_read_tsc() is
a simple static inline (as it should be) - the build would fail with
certain gcc flags. (and i remember runtime problems too) The C semantics
of taking the address of an inline function seem pretty clear: the inlined
function should be instantiated in that .o and a pointer should be
generated out of that local instantiation.

Perhaps the real fix is to do this rename as well:

native_read_tsc => native_read_tsc_paravirt
__native_read_tsc => native_read_tsc

as this makes the native_read_tsc_paravirt() a pure technical variant, to
be used in paravirt_ops function pointer assignments. People would thus
just use the obvious native_read_tsc() inline function most of the time
and could forget about native_read_tsc_paravirt().

Jeremy?

Ingo


\
 
 \ /
  Last update: 2008-12-16 10:19    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site