Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187AbcLCMoR (ORCPT ); Sat, 3 Dec 2016 07:44:17 -0500 Received: from mail.skyhub.de ([78.46.96.112]:57068 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcLCMoO (ORCPT ); Sat, 3 Dec 2016 07:44:14 -0500 Date: Sat, 3 Dec 2016 13:44:06 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: Linus Torvalds , Peter Anvin , the arch/x86 maintainers , One Thousand Gnomes , "linux-kernel@vger.kernel.org" , Brian Gerst , Matthew Whitehead , Henrique de Moraes Holschuh , Peter Zijlstra , Andrew Cooper Subject: Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Message-ID: <20161203124406.5h2csgya4s57wjih@pd.tnic> References: <0a21157c2233ba7d0781bbf07866b3f2d7e7c25d.1480638597.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 29 On Fri, Dec 02, 2016 at 09:38:38AM -0800, Andy Lutomirski wrote: > TBH, I didn't start down this path for performance. I did it because > I wanted to kill off a CPUID that was breaking on old CPUs that don't > have CPUID. So I propose MOV-to-CR2 followed by an unconditional > jump. My goal here is to make the #*!& thing work reliably and not be > ludicrously slow. Borislav and I mulled over using an alternative to > use CPUID if and only if we have CPUID, but that doesn't work because > we call sync_core() before we're done applying alternatives. Btw if the noinline thing which Linus suggested, works out, we can still do the alternatives thing with CPUID in sync_core() because we won't need it in alternatives.c itself anymore. Just putting it on the table, I know you complained about the mess yesterday on IRC and in case the CR2 move looks painful on xen, we can still do what we initially considered. I.e., that thing: + /* Do a CPUID if available, otherwise do a forward jump. */ + alternative_io("jmp 1f\n\t1:", "cpuid", + X86_FEATURE_CPUID, + "=a" (tmp), + "0" (1) + : "ebx", "ecx", "edx", "memory"); -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.