Skip to content

extend alternative instruction framework to support more than one alternative

Joerg Roedel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3i386: extend alternative instruction framworkarch/i386/kernel/alternative.c include/asm-i386/alternative.h+113 -100 replies
1/3x86_64: additions to the i386 alternative extensions to support x86_64 architecturearch/x86_64/lib/clear_page.S arch/x86_64/lib/copy_page.S arch/x86_64/lib/copy_user.S +3 more+81 -23 replies
3/3optimize get_cycles_sync for Linux as KVM guestinclude/asm-i386/cpufeature.h include/asm-x86_64/tsc.h+12 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] extend alternative instruction framework to support more than one alternative

Hi,

this small series of patches extend the alternative instructions framework on i386 and x86_64 architectures to support more than one alternative per instruction. The last patch in this series includes a first use of this extension to optimize the get_cycles_sync() function.

The extension works as follows:

The alt_instr struct is extended with 2 more fields:

	u8  used;
	u8  instr_cpuid;

which are both set to 0 for all existing entries. If an existing entry should have more than one alternative instruction the further alternatives are encoded in a following alt_instr structure. In this case the 'use' variable is either 1 oder 2 in that following structure. This encodes the number of further alternative instructions in that struct. The first following instruction is pointed to by the *instr pointer in the struct. Its matching cpuid field is 'instr_cpuid'. The third alternative is encoded like the first one in the original entry using the *replacement pointer and the cpuid field. These following structs could be cascaded to support an arbitrary number of alternative instructions. When applying the alternative instructions the sequence of alternatives is scanned and the first matching entry wins. The patches should apply cleanly to recent Linus git kernels.

Regards,
Joerg

Signature · 3 lines
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG