LWN.net Logo

[PATCH 0/4 TRY#3] improve alternative instruction code and optimize get_cycles_sync

From:  "Joerg Roedel" <joerg.roedel@amd.com>
To:  discuss@x86-64.org
Subject:  [PATCH 0/4 TRY#3] improve alternative instruction code and optimize get_cycles_sync
Date:  Fri, 9 Mar 2007 16:08:25 +0100
Cc:  "Andi Kleen" <ak@suse.de>, linux-kernel@vger.kernel.org
Archive-link:  Article, Thread

This series of patches extend the alternative instructions framework on
i386 and x86_64 architectures to support two alternative instruction
replacements. This code is used together with the introduction of the
X86_FEATURE_SYNC_RDTSC flag on i386 to simplify and optimize the
get_cycles_sync() function. The optimization changes this function to
use RDTSCP instead of CPUID;RDTSC if this instruction is available.
Don't use CPUID there is really important if the kernel runs as a KVM
guest, because this instruction is intercepted and causes an expensive
VMEXIT.

Changes to the previous submit:
 * rebased to current linus git tree
 * replaced RDTSCP usage in get_cycles_sync with the opcode to
   make it compile with older binutils

-- 
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG



Copyright © 2007, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds