kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* cpu_relax(), rep: nop, and PAUSE
@ 2013-02-19 12:20 David Shwatrz
  2013-02-19 18:58 ` Mulyadi Santosa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: David Shwatrz @ 2013-02-19 12:20 UTC (permalink / raw)
  To: kernelnewbies

Hi, kernel newbies,

We have:
#define cpu_relax()	asm volatile("rep; nop")
in arch/x86/boot/boot.h.

Why don't we use the PAUSE assembler instruction here ?

According to Intel manuals,
Intel? 64 and IA-32 Architectures
Software Developer?s Manual
Volume 2B:

"This instruction was introduced in the Pentium 4 processors, but is
backward compatible with all IA-32 processors.
In earlier IA-32 processors, the PAUSE instruction operates like a NOP
instruction. The Pentium 4 and Intel Xeon
processors implement the PAUSE instruction as a delay. The delay is
finite and can be zero for some processors.
This instruction does not change the architectural state of the
processor (that is, it performs essentially a delaying
no-op operation).
This instruction?s operation is the same in non-64-bit modes and 64-bit mode."

And AFAIK, in spinlocks , PAUSE indeed replaced the rep;nop.

Any ideas?

Best,
DS

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-20 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 12:20 cpu_relax(), rep: nop, and PAUSE David Shwatrz
2013-02-19 18:58 ` Mulyadi Santosa
2013-02-19 21:41   ` Valdis.Kletnieks at vt.edu
2013-02-20  3:35 ` Adam Lee
2013-02-20 21:18 ` Rainer Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).