Received: by 10.223.164.202 with SMTP id h10csp763196wrb; Fri, 10 Nov 2017 14:37:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMZnWbT2qz5DfFAfj+Ygmono3c8GS4JJxw+88tPU/BwTm+IH8ZtSArADnNgWBll8FYisJXP0 X-Received: by 10.98.216.193 with SMTP id e184mr220535pfg.98.1510353475488; Fri, 10 Nov 2017 14:37:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510353475; cv=none; d=google.com; s=arc-20160816; b=gPXx0JEu1oNs+Oii2ibFHtvAMDBf6uNVQHsYnsUd170H865IQne7evEoZrvUR2hyTY oub54tIkMUrKmRNKFd1bF4CGRC+fVnM/s27x1tUsaX9vDSp1RyvIa3XaRJiIRdzfnKSs c+rv3sND465bHuRelfagxrwWl1RuQqMuw432fCQlQhc3gPPsyuOBjSktK6LN4l9dfbqs /hY5g/ejQaaZjtxqUt8Fc6yl2w52ScNYkAiyn3ez8Xk93QjU3/q7xw/UQU5IWLu0XBld os0EZ6EYSAPpNXlVetuoPI06g/d+ClCWTOYVL8z6iKkSuUpsDOkV2TByJjbABIvxbzQO +dmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=0jhNpq8XempI+jgyXEBvdr/22+yK9+GMqib2V8GBxmA=; b=FKMvvfU4Myk27iIhHJzm+ruC9W0yIV21n56edN+7739UM2ZykFZlLL2lLS3huSmqSt kzflFt6CoRxhvDXz8lP2pYQQ9z8W8ituMH8PQ0/frqo/Sq8NVSlm7ujxQnz5VFu4ljMy 8nb5QHszZEoLYpNFydyZgpJMK3jnpNIHZpq2m28cb/nRwUL1djCVZkfY9iFM+jYBQoZy ibIEc3mLrIC0ud7HVMead4p/3I7Z15rF5XsSK2Y7kBXWllwfyUXz+UkrcXlTQHfGBiXE zKa+OcjDLFK5EWfN86Gglwbfb0SbXJfXRQHTN+GRamCWAVd3LjTrsI9KKnpc4Z0LNZIw XxCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hwnyje/y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t125si9601777pgc.19.2017.11.10.14.37.43; Fri, 10 Nov 2017 14:37:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hwnyje/y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754664AbdKJWhF (ORCPT + 83 others); Fri, 10 Nov 2017 17:37:05 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46538 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbdKJWhB (ORCPT ); Fri, 10 Nov 2017 17:37:01 -0500 Received: by mail-pg0-f68.google.com with SMTP id t10so7383729pgo.3 for ; Fri, 10 Nov 2017 14:37:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0jhNpq8XempI+jgyXEBvdr/22+yK9+GMqib2V8GBxmA=; b=Hwnyje/ywu/fQcOVGPgwsXSEgAQGF5lc5wOh4cccc28trJeRoT29C3WoQL8H3hsCBt yvWusZ4dwK3oru0ae757V/d64GoysSQvU26RPdqE2DAmfurvTg/iyrx/RYWIkCiiw4eg tlVNAxv7Gt+BUol8PrtDp8gf2vBcPvs7EHUrEC1mibl7V35Ey/2DvBsosvOHs/icL83/ v/4GNE45Of80jedmCeELsiUe8L1j0K7/vh0EFSY3GWC3kc3+zK5PIZWG2gZUp6TZ/oFL pkhSoDPcgLkmA+2L+7Guv3Dfgyj8UVlcugtqE3nxUk+Sp2N4opMpCKBL9moYE1/IoIDa Z9yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0jhNpq8XempI+jgyXEBvdr/22+yK9+GMqib2V8GBxmA=; b=qb3aWgxBGSFldB0XxfTKSUkzM2yTFa/JcxSxyZrFYiUt66AUbUzYhVh2b4mKUyERWL XcgbC/PopkWIjWD+/8yfzfwcgW0BdeGFJ6LvQi0I5izfev7OnQtPx4+1fMAl1cPJZnQF 1s6awFALBvhDVyQO/g8vhmuD0cBwV1cKe2o08uA1a9iOMkmyKaa6hwdIN0+jmSlMki/M yjCP3I9zDGxYks8cYp5zjaYzCAzX/P55tY/jkqaLvpgCl8e3lIoOY98i+cnAXcDm9Pcz jqppmysBjOf1dvwLF1oQbcqfEddgGTaTbDoFYSTuzqSbtW0eZYqdkWPyo23oayh7cXou uCAQ== X-Gm-Message-State: AJaThX5o8xIZCXviMl4Jqa7+8evM/qPukxLuBg+hDchuu8WTMK0dumCu 1XURdl/8O0pQGdWoN7byJgqLjQ== X-Received: by 10.101.98.131 with SMTP id f3mr1744585pgv.366.1510353420841; Fri, 10 Nov 2017 14:37:00 -0800 (PST) Received: from ?IPv6:2600:1010:b059:bbb7:c71:3e2:ed55:c328? ([2600:1010:b059:bbb7:c71:3e2:ed55:c328]) by smtp.gmail.com with ESMTPSA id q7sm13502074pfd.43.2017.11.10.14.36.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Nov 2017 14:37:00 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH for 4.15 05/10] x86: Introduce sync_core_before_usermode From: Andy Lutomirski X-Mailer: iPhone Mail (15A432) In-Reply-To: <1007217384.13056.1510352430448.JavaMail.zimbra@efficios.com> Date: Fri, 10 Nov 2017 14:36:58 -0800 Cc: Andy Lutomirski , Boqun Feng , Peter Zijlstra , "Paul E. McKenney" , linux-kernel , linux-api , Andrew Hunter , maged michael , Avi Kivity , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dave Watson , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrea Parri , "Russell King, ARM Linux" , Greg Hackmann , Will Deacon , David Sehr , Linus Torvalds , x86 , linux-arch Content-Transfer-Encoding: quoted-printable Message-Id: References: <20171110213717.12457-1-mathieu.desnoyers@efficios.com> <20171110213717.12457-6-mathieu.desnoyers@efficios.com> <1007217384.13056.1510352430448.JavaMail.zimbra@efficios.com> To: Mathieu Desnoyers Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 10, 2017, at 2:20 PM, Mathieu Desnoyers wrote: >=20 > ----- On Nov 10, 2017, at 5:02 PM, Andy Lutomirski luto@kernel.org wrote: >=20 >> On Fri, Nov 10, 2017 at 1:37 PM, Mathieu Desnoyers >> wrote: >>> Introduce an architecture function that ensures the current CPU >>> issues a core serializing instruction before returning to usermode. >>>=20 >>> This is needed to fix an existing core serialization bug on >>> thread migration, and also needed by the membarrier "sync_core" command.= >>>=20 >>> Architectures defining the sync_core_before_usermode() static inline >>> need to define ARCH_HAS_SYNC_CORE_BEFORE_USERMODE. >>>=20 >>> Signed-off-by: Mathieu Desnoyers >>> CC: Peter Zijlstra >>> CC: Andy Lutomirski >>> CC: Paul E. McKenney >>> CC: Boqun Feng >>> CC: Andrew Hunter >>> CC: Maged Michael >>> CC: Avi Kivity >>> CC: Benjamin Herrenschmidt >>> CC: Paul Mackerras >>> CC: Michael Ellerman >>> CC: Dave Watson >>> CC: Thomas Gleixner >>> CC: Ingo Molnar >>> CC: "H. Peter Anvin" >>> CC: Andrea Parri >>> CC: Russell King >>> CC: Greg Hackmann >>> CC: Will Deacon >>> CC: David Sehr >>> CC: Linus Torvalds >>> CC: x86@kernel.org >>> CC: linux-arch@vger.kernel.org >>> --- >>> arch/x86/Kconfig | 1 + >>> arch/x86/include/asm/processor.h | 10 ++++++++++ >>> include/linux/processor.h | 6 ++++++ >>> 3 files changed, 17 insertions(+) >>>=20 >>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >>> index 01f78c1d40b5..54fbb8960d94 100644 >>> --- a/arch/x86/Kconfig >>> +++ b/arch/x86/Kconfig >>> @@ -62,6 +62,7 @@ config X86 >>> select ARCH_HAS_SG_CHAIN >>> select ARCH_HAS_STRICT_KERNEL_RWX >>> select ARCH_HAS_STRICT_MODULE_RWX >>> + select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE >>> select ARCH_HAS_UBSAN_SANITIZE_ALL >>> select ARCH_HAS_ZONE_DEVICE if X86_64 >>> select ARCH_HAVE_NMI_SAFE_CMPXCHG >>> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/pro= cessor.h >>> index bdac19ab2488..6ce996a7c730 100644 >>> --- a/arch/x86/include/asm/processor.h >>> +++ b/arch/x86/include/asm/processor.h >>> @@ -706,6 +706,16 @@ static inline void sync_core(void) >>> #endif >>> } >>>=20 >>> +/* >>> + * Ensure that a core serializing instruction is issued before returnin= g >>> + * to user-mode. x86 implements return to user-space through sysexit an= d >>> + * sysretq, which are not core serializing. >>> + */ >>> +static inline void sync_core_before_usermode(void) >>> +{ >>> + sync_core(); >>> +} >>=20 >> Make this if (!in_interrupt()) sync_core(); please. We can optimize >> it better later on. >=20 > Sure, done. It will be part of the next version of that patch. >=20 > Thanks! Hmm. Can you also cc stable and make sure it applies by itself? >=20 > Mathieu >=20 >=20 > --=20 > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com > -- > To unsubscribe from this list: send the line "unsubscribe linux-api" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html From 1583720168449337607@xxx Fri Nov 10 22:34:09 +0000 2017 X-GM-THRID: 1583715185099958400 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread