Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755118AbcLBVKf (ORCPT ); Fri, 2 Dec 2016 16:10:35 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:35764 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753055AbcLBVKd (ORCPT ); Fri, 2 Dec 2016 16:10:33 -0500 MIME-Version: 1.0 In-Reply-To: References: <0a21157c2233ba7d0781bbf07866b3f2d7e7c25d.1480638597.git.luto@kernel.org> <20161202180343.gehqor7lgtmzwqq3@pd.tnic> <20161202185008.tdziqrzi4a3axord@pd.tnic> <20161202192050.l5l3rcwems6hptub@pd.tnic> From: Linus Torvalds Date: Fri, 2 Dec 2016 13:10:31 -0800 X-Google-Sender-Auth: aKd5AS_8MOr0PnQFNnnKUNfQqs4 Message-ID: Subject: Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation To: Andy Lutomirski Cc: Borislav Petkov , Borislav Petkov , Andy Lutomirski , 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 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: 921 Lines: 25 On Fri, Dec 2, 2016 at 12:41 PM, Andy Lutomirski wrote: > > Because, if so, we should maybe serialize whenever we migrate a > process to a different CPU. The intel docs are bad on this issue. Technically what we do could fall under the "cross-modifying code" case, where one CPU does the write, and then we run it on another CPU. And no, we do *not* do a serializing instruction before returning to user space. Sure, we might do an iret (which is serializing), but we equally well might be doing a systret (which is not). Honestly, I think Intel should clean up their documentation. > (We *definitely* need to flush the store buffer when migrating, There is no such thing as flushing the store buffer. But we do end up doing a memory barrier which gives you the required semantics. That's not a problem. Those operations are fast. The serializing instructions are not. Linus