Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753640AbcLFRrC (ORCPT ); Tue, 6 Dec 2016 12:47:02 -0500 Received: from mail-ua0-f182.google.com ([209.85.217.182]:33582 "EHLO mail-ua0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbcLFRrA (ORCPT ); Tue, 6 Dec 2016 12:47:00 -0500 MIME-Version: 1.0 In-Reply-To: <584697BA0200007800125855@prv-mh.provo.novell.com> References: <584688FD02000078001257BB@prv-mh.provo.novell.com> <20161206092520.GX3092@twins.programming.kicks-ass.net> <584697BA0200007800125855@prv-mh.provo.novell.com> From: Andy Lutomirski Date: Tue, 6 Dec 2016 09:46:39 -0800 Message-ID: Subject: Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self To: Jan Beulich Cc: Peter Zijlstra , Borislav Petkov , Andrew Cooper , Brian Gerst , Matthew Whitehead , Henrique de Moraes Holschuh , Andy Lutomirski , X86 ML , xen-devel , One Thousand Gnomes , Boris Ostrovsky , Juergen Gross , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1143 Lines: 29 On Tue, Dec 6, 2016 at 1:49 AM, Jan Beulich wrote: >>>> On 06.12.16 at 10:25, wrote: >> On Tue, Dec 06, 2016 at 01:46:37AM -0700, Jan Beulich wrote: >>> > + asm volatile ( >>> > + "pushfl\n\t" >>> > + "pushl %%cs\n\t" >>> > + "pushl $1f\n\t" >>> > + "iret\n\t" >>> > + "1:" >>> > + : "+r" (__sp) : : "cc", "memory"); >>> >>> I don't thing EFLAGS (i.e. "cc") gets modified anywhere here. And >>> the memory clobber would perhaps better be pulled out into an >>> explicit barrier() invocation (making it more obvious what it's needed >>> for)? >> >> EVerything that implies a memory barrier (and I think serializing >> instructions do that) also imply a compiler barrier. >> >> Not doing the memory clobber gets you inconsistency wrt everything else. > > Well, I didn't say dropping the memory clobber altogether, but > split it into a separate barrier() invocation (placed perhaps after > the #endif). I'll add a comment. I'm fixing up the constraints, too. (Although if gcc allocated tmp into rsp, that would be very strange indeed.) --Andy