From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753323AbbCEA0r (ORCPT ); Wed, 4 Mar 2015 19:26:47 -0500 Received: from mail-we0-f180.google.com ([74.125.82.180]:32876 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbbCEA0q (ORCPT ); Wed, 4 Mar 2015 19:26:46 -0500 Date: Thu, 5 Mar 2015 01:26:40 +0100 From: Ingo Molnar To: Borislav Petkov Cc: X86 ML , Andy Lutomirski , LKML , Linus Torvalds Subject: Re: [PATCH v2 15/15] x86/lib/memcpy_64.S: Convert memcpy to ALTERNATIVE_2 macro Message-ID: <20150305002640.GA20449@gmail.com> References: <1424776497-3180-1-git-send-email-bp@alien8.de> <1424776497-3180-16-git-send-email-bp@alien8.de> <20150304072633.GB22014@gmail.com> <20150304135853.GF3516@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150304135853.GF3516@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Borislav Petkov wrote: > On Wed, Mar 04, 2015 at 08:26:33AM +0100, Ingo Molnar wrote: > > Since most CPUs we care about have ERMS, wouldn't it be better to > > patch in the actual memcpy_erms sequence into the primary memcpy() > > function? It's just about 9 bytes AFAICT. > > Actually, most set REP_GOOD - all Intel family 6 and all relevant > AMDs. > > And only the newer Intels have ERMS. My SNB, for example doesn't > while IVB has it. So I'd guess everything >= IVB would have it. Well, my point equally applies to all variants: it's better to avoid the NOP or JMP overhead (however small it may be), by simply copying the ideal memcpy routine into memcpy()? I.e. while I'd not want to patch in memcpy_orig (it's legacy really), but the other two variants, ERMS and REP MOVSQ could be patched in directly via ALTERNATIVE_2()? Thanks, Ingo