[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <90126210af5441c1830b1325ef996e77@AcuMS.aculab.com>
Date: Mon, 15 Mar 2021 16:45:30 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Peter Zijlstra' <peterz@...radead.org>,
"x86@...nel.org" <x86@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC][PATCH] x86/alternatives: Optimize optimize_nops()
From: Peter Zijlstra
> Sent: 15 March 2021 15:45
>
> Currently optimize_nops() scans to see if the alternative starts with
> NOPs. However, the emit pattern is:
>
> 141: \oldinstr
> 142: .skip (len-(142b-141b)), 0x90
>
> That is, when oldinstr is short, we pad the tail with NOPs. This case
> never gets optimized.
>
> Rewrite optimize_nops() to replace any string of NOPs inside the
> alternative to larger NOPs. Also run it irrespective of patching,
> replacing NOPs in both the original and replaced code.
This should even speed up old 64bit cpu.
Although the nopl instruction has to go through the 'big decoder'
(so only one per clock) it is much bigger than the 0x90 'nop'
instructions currently used.
So although (probably) 3 'nop' can be decoded each clock
that is less bytes of padding per clock.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists