diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2021-03-26 18:12:01 +0300 | 
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2021-04-02 13:41:17 +0300 | 
| commit | 23c1ad538f4f371bdb67d8a112314842d5db7e5a (patch) | |
| tree | a057eba5ff709afba56b16586bc990340ec562c6 /drivers/usb/cdns3/cdns3-imx.c | |
| parent | b1f480bc0686e65d5413c035bd13af2ea4888784 (diff) | |
| download | linux-23c1ad538f4f371bdb67d8a112314842d5db7e5a.tar.xz | |
x86/alternatives: Optimize optimize_nops()
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, the tail is padded with NOPs. This case
never gets optimized.
Rewrite optimize_nops() to replace any trailing string of NOPs inside
the alternative to larger NOPs. Also run it irrespective of patching,
replacing NOPs in both the original and replaced code.
A direct consequence is that 'padlen' becomes superfluous, so remove it.
 [ bp:
   - Adjust commit message
   - remove a stale comment about needing to pad
   - add a comment in optimize_nops()
   - exit early if the NOP verif. loop catches a mismatch - function
     should not not add NOPs in that case
   - fix the "optimized NOPs" offsets output ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20210326151259.442992235@infradead.org
Diffstat (limited to 'drivers/usb/cdns3/cdns3-imx.c')
0 files changed, 0 insertions, 0 deletions
