Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of x86 PAUSE instruction for PPC

Does there exist an equivalent of the x86 PAUSE instruction, which is placed within busy waiting loops to improve performance, particularly on SMT machines, on PowerPC?

like image 386
Jimmeh Avatar asked Mar 24 '11 21:03

Jimmeh


1 Answers

In the Linux kernel we have this in arch/powerpc/include/asm/processor.h

/* Macros for adjusting thread priority (hardware multi-threading) */
#define HMT_very_low()   asm volatile("or 31,31,31   # very low priority")
#define HMT_low()    asm volatile("or 1,1,1      # low priority")
#define HMT_medium_low() asm volatile("or 6,6,6      # medium low priority")
#define HMT_medium()     asm volatile("or 2,2,2      # medium priority")
#define HMT_medium_high() asm volatile("or 5,5,5      # medium high priority")
#define HMT_high()   asm volatile("or 3,3,3      # high priority")

I'm not familiar with x86 PAUSE, but sounds like "or 31,31,31" is what you want.

Which powerpc processor are you doing this on? For SMT it must be POWER5, 6 or 7?

like image 99
mikey Avatar answered Sep 30 '22 18:09

mikey