Re: Question Regarding ERMS memcpy

From: Borislav Petkov
Date: Sat Mar 04 2017 - 17:44:10 EST


On Sat, Mar 04, 2017 at 01:08:15PM -0700, Logan Gunthorpe wrote:
> So my question is: how do I find out what version of memcpy my actual
> machine is using and fix it if it is wrong?

You can boot with "debug-alternative" and look for those strings where
it says "feat:"

[ 0.261386] apply_alternatives: feat: 3*32+18, old: (ffffffff8101e3c4, len: 3), repl: (ffffffff81de4e7a, len: 3), pad: 3
^^^^^^^

[ 0.264003] ffffffff8101e3c4: old_insn: 0f 1f 00
[ 0.265235] ffffffff81de4e7a: rpl_insn: 0f ae e8
[ 0.266469] ffffffff8101e3c4: final_insn: 0f ae e8

if it says 9*32+9 there, then it really does patch in the ERMS variant.

If it says 3*32+16 and it patches a NOP, i.e., something like this:

[ 2.022665] apply_alternatives: feat: 3*32+16, old: (ffffffff812dbfe0, len: 5), repl: (ffffffff81de5336, len: 0), pad: 3
[ 2.024003] ffffffff812dbfe0: old_insn: eb 0e 90 90 90
[ 2.025332] ffffffff812dbfe0: final_insn: 0f 1f 44 00 00
^^^^ NOP

then, you're using the rep; movsq variant.

Also, do

make <path-to-file>.s

of the file where it does memcpy_fromio() and attach it here. I'd like to see
what the compiler generates.

HTH.

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--