Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbdCDWn6 (ORCPT ); Sat, 4 Mar 2017 17:43:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:59881 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103AbdCDWn4 (ORCPT ); Sat, 4 Mar 2017 17:43:56 -0500 Date: Sat, 4 Mar 2017 23:43:41 +0100 From: Borislav Petkov To: Logan Gunthorpe Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Tony Luck , Al Viro , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: Question Regarding ERMS memcpy Message-ID: <20170304224341.zfp4fl37ypt57amg@pd.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1296 Lines: 40 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 .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) --