[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9e76aac65edc4d88b141d79496ae3fdf@AcuMS.aculab.com>
Date: Thu, 22 Jul 2021 08:45:42 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Yunsheng Lin' <linyunsheng@...wei.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"mst@...hat.com" <mst@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>
CC: "nickhu@...estech.com" <nickhu@...estech.com>,
"green.hu@...il.com" <green.hu@...il.com>,
"deanbo422@...il.com" <deanbo422@...il.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"yury.norov@...il.com" <yury.norov@...il.com>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"ojeda@...nel.org" <ojeda@...nel.org>,
"ndesaulniers@...ogle.com" <ndesaulniers@...ogle.com>,
"joe@...ches.com" <joe@...ches.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linuxarm@...neuler.org" <linuxarm@...neuler.org>
Subject: RE: [PATCH v2 3/4] tools headers UAPI: add cpu_relax() implementation
for x86 and arm64
> > Beware, Intel increased the stall for 'rep nop' in some recent
> > cpu to IIRC about 200 cycles.
> >
> > They even document that this might have a detrimental effect.
> > It is basically far too long for the sort of thing it makes
> > sense to busy-wait for.
>
> Thanks for the info:)
> I will be beware of that when playing with 'rep nop' in newer
> x86 cpu.
See 8.4.7 Pause Latency in Skylake Microarchitecture in
IntelĀ® 64 and IA-32 Architectures Optimization Reference Manual
The latency of PAUSE instruction in prior generation microarchitecture
is about 10 cycles, whereas on Skylake microarchitecture it has been
extended to as many as 140 cycles.
An earlier section does explain why you need pause though.
One of its effects is to stop the cpu speculatively executing
multiple iterations of the wait look - each with its own
pending read of the memory location that is being looked at.
Unwinding that isn't free - and was particularly expensive on
P4 Netburst - what a surprise, they ran everything except
benchmark looks very slowly.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists