Received: by 10.223.176.5 with SMTP id f5csp2989754wra; Mon, 5 Feb 2018 13:41:44 -0800 (PST) X-Google-Smtp-Source: AH8x227/ruZ3tXd+Lad90xl6oG06PWnFdruvw+Md95jj4XStWO86IQGhNsyE+XMjMhBHUovHvdIA X-Received: by 10.98.254.21 with SMTP id z21mr222105pfh.48.1517866904143; Mon, 05 Feb 2018 13:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517866904; cv=none; d=google.com; s=arc-20160816; b=0ni/9jU0VQ8NznwrcYcp33BObsDOOFItUPlF5Lgi+3rgdmMwlSHq/IeKYVV/rY+bDk EzS5C8laXAW7gD67SZ7zNIHjU7dV7zsVvU5m8yqtCvt4bBrta0GArdK5uHdVlJ+4kALX 7mmWwRNigGsdW3n1U9AdWeeoNq+pAGBCVDiHj8XSUNVLDbvvV0lfYHr8op8UK/+nZq2E uEVpiiD96ZmduB4Z2JO8J5JpBOhUajd6/hCF6/bc4S0YL9952mqLuC/xEFKlyIi/Kxz/ eSzHbWB10Cjy70HGiLGWdC3ho+JYZqc2MsDdSbi2FcoKrR42WTQzB0FczFp4UjFEvKlN 1Ong== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=hSFkOQyPMLt1W0ID2etrtLlYKA3Mc7vZjjqx5wX9Tgs=; b=saCDh6clO2oWdcetuP608t0hHT8h9j7QsLns6e1cAeLacG4M9V5EPdYhs/bqE9qvHQ l915UFhnICVCPeSyqfuKyvN/qexALqx+FokM+7WH6f6lfq7KlTa/kHEuSvmMJsWLKpH+ bXnEF3ki26fwPwuTMV6OUQ29mj6oeuq8A4l0d3qmjjY0GEsJxr7J0w4ImhiSA0f6PWZn k4A+G85mQfa8uuuPZb4vRrN343BQq1nIdlh/4uOoWbgRXs4EB+7wyY/U1MGGBbHxssis TGwYhRF/KM62HoUTm/O+jJuQBbxPiKQ+SoTOzD7BoSvu7v3HrlnOLVEqks0Bb7ogXLRd U2WQ== ARC-Authentication-Results: i=1; mx.google.com; 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 r3si872246pgr.349.2018.02.05.13.41.29; Mon, 05 Feb 2018 13:41:44 -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; 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 S1752477AbeBEVk1 (ORCPT + 99 others); Mon, 5 Feb 2018 16:40:27 -0500 Received: from terminus.zytor.com ([65.50.211.136]:51579 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbeBEVkD (ORCPT ); Mon, 5 Feb 2018 16:40:03 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w15LSFth028764; Mon, 5 Feb 2018 13:28:15 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w15LSCc7028758; Mon, 5 Feb 2018 13:28:12 -0800 Date: Mon, 5 Feb 2018 13:28:12 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Mathieu Desnoyers Message-ID: Cc: mpe@ellerman.id.au, tglx@linutronix.de, ghackmann@google.com, boqun.feng@gmail.com, mingo@kernel.org, peterz@infradead.org, parri.andrea@gmail.com, linux-kernel@vger.kernel.org, hpa@zytor.com, luto@kernel.org, will.deacon@arm.com, mathieu.desnoyers@efficios.com, linux@armlinux.org.uk, avi@scylladb.com, torvalds@linux-foundation.org, paulmck@linux.vnet.ibm.com, arnd@arndb.de, davejwatson@fb.com, paulus@samba.org, sehr@google.com, ahh@google.com, maged.michael@gmail.com, benh@kernel.crashing.org Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, parri.andrea@gmail.com, peterz@infradead.org, mingo@kernel.org, boqun.feng@gmail.com, ghackmann@google.com, mpe@ellerman.id.au, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, avi@scylladb.com, linux@armlinux.org.uk, mathieu.desnoyers@efficios.com, will.deacon@arm.com, luto@kernel.org, maged.michael@gmail.com, sehr@google.com, ahh@google.com, davejwatson@fb.com, paulus@samba.org, arnd@arndb.de, benh@kernel.crashing.org In-Reply-To: <20180129202020.8515-7-mathieu.desnoyers@efficios.com> References: <20180129202020.8515-7-mathieu.desnoyers@efficios.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/urgent] locking: Introduce sync_core_before_usermode() Git-Commit-ID: e61938a921a46347d7725badc40ec436ebfff977 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e61938a921a46347d7725badc40ec436ebfff977 Gitweb: https://git.kernel.org/tip/e61938a921a46347d7725badc40ec436ebfff977 Author: Mathieu Desnoyers AuthorDate: Mon, 29 Jan 2018 15:20:15 -0500 Committer: Ingo Molnar CommitDate: Mon, 5 Feb 2018 21:34:50 +0100 locking: Introduce sync_core_before_usermode() Introduce an architecture function that ensures the current CPU issues a core serializing instruction before returning to usermode. This is needed for the membarrier "sync_core" command. Architectures defining the sync_core_before_usermode() static inline need to select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE. Signed-off-by: Mathieu Desnoyers Acked-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: Andrea Parri Cc: Andrew Hunter Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Avi Kivity Cc: Benjamin Herrenschmidt Cc: Boqun Feng Cc: Dave Watson Cc: David Sehr Cc: Greg Hackmann Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Maged Michael Cc: Michael Ellerman Cc: Paul E. McKenney Cc: Paul Mackerras Cc: Russell King Cc: Will Deacon Cc: linux-api@vger.kernel.org Cc: linux-arch@vger.kernel.org Link: http://lkml.kernel.org/r/20180129202020.8515-7-mathieu.desnoyers@efficios.com Signed-off-by: Ingo Molnar --- include/linux/sync_core.h | 21 +++++++++++++++++++++ init/Kconfig | 3 +++ 2 files changed, 24 insertions(+) diff --git a/include/linux/sync_core.h b/include/linux/sync_core.h new file mode 100644 index 0000000..013da4b --- /dev/null +++ b/include/linux/sync_core.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_SYNC_CORE_H +#define _LINUX_SYNC_CORE_H + +#ifdef CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE +#include +#else +/* + * This is a dummy sync_core_before_usermode() implementation that can be used + * on all architectures which return to user-space through core serializing + * instructions. + * If your architecture returns to user-space through non-core-serializing + * instructions, you need to write your own functions. + */ +static inline void sync_core_before_usermode(void) +{ +} +#endif + +#endif /* _LINUX_SYNC_CORE_H */ + diff --git a/init/Kconfig b/init/Kconfig index 837adcf..535421f 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1918,3 +1918,6 @@ config ASN1 functions to call on what tags. source "kernel/Kconfig.locks" + +config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE + bool