From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754190AbdKNQcY (ORCPT ); Tue, 14 Nov 2017 11:32:24 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:48546 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbdKNQcO (ORCPT ); Tue, 14 Nov 2017 11:32:14 -0500 Date: Tue, 14 Nov 2017 17:31:59 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Thomas Gleixner , Mathieu Desnoyers , Avi Kivity , Linus Torvalds , linux-kernel , linux-api , "Paul E. McKenney" , Boqun Feng , Andrew Hunter , maged michael , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dave Watson , Ingo Molnar , "H. Peter Anvin" , Andrea Parri , "Russell King, ARM Linux" , Greg Hackmann , Will Deacon , David Sehr , x86 Subject: Re: [RFC PATCH 0/2] x86: Fix missing core serialization on migration Message-ID: <20171114163159.GD3165@worktop.lehotels.local> References: <20171110211249.10742-1-mathieu.desnoyers@efficios.com> <885227610.13045.1510351034488.JavaMail.zimbra@efficios.com> <617343212.13932.1510592207202.JavaMail.zimbra@efficios.com> <4d47fbb8-8f99-19d3-a9cf-66841aeffac3@scylladb.com> <4431530.14831.1510672632887.JavaMail.zimbra@efficios.com> <20171114160541.GC3165@worktop.lehotels.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 14, 2017 at 08:16:09AM -0800, Andy Lutomirski wrote: > What guarantees that there's an IPI? Do we never do a syscall, get > migrated during syscall processing (due to cond_resched(), for > example), and land on another CPU that just happened to already be > scheduling? Possible, the other CPU could've pulled the task because it went idle. No IPIs involved in that scenario. And if it was running a different thread of the same process prior to that, we'll also not do switch_mm(). So yes, it is possible to construct a migration scenario without core serializing instructions (of the CPUID/MOV-CR kind, not the LOCK prefix kind). Note that that still requires a multi-threaded process. There is another scenario; where the NOHZ load-balancer moves the task; such that the NOHZ load balancing CPU is a 3rd CPU. In that case there is an interrupt (to affect the load-balancing) but it will not land on the CPU that's going to run the task. This could happen for a single threaded task; since I suppose the NOHZ idle CPU that's going to be the victim could have ran our task last and still lazily have the mm. Very tricky to make work, not to mention that I suspect actually going idle will kill a whole bunch of state real quick.