Received: by 10.223.176.5 with SMTP id f5csp3385227wra; Mon, 29 Jan 2018 12:25:51 -0800 (PST) X-Google-Smtp-Source: AH8x224VbwqjUEyMZ2phIdUfZ2igQS9tTJjLjfIm2c8t72SdiuwsqFxrJwk+MIaAiMFbKeyKhi8K X-Received: by 10.101.76.193 with SMTP id n1mr21115124pgt.194.1517257551508; Mon, 29 Jan 2018 12:25:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517257551; cv=none; d=google.com; s=arc-20160816; b=NwVq2rwaNhKxBQxtEIu9IRtavCsND8/vdBbhcMQq0HrFbMjGWI209xaA2J5qaKf/zc 4g2O0dDU58fdnB7rs8y8M5q6RIuuy4EuiMKC/jZkKKqQ773TdTkt8wsKY7s7IFqqr7X6 XTQqCz8WlXNDhwRqWnUgqu5pQCFhok6PximRLyuX5lGw2+0Xx1m37+sDf+rG8rwHd7yM RAel8wYIoIVWsgI1R5vTvtqTSvPVS+Rn7q5BX5A/RBs0eqkyzx6z+A+Irp0XmC98sd4L rIqRl/6A+ORZz7wcBDgN1Z6KX03UGFtsKjv3Q8k8gfxnOQBM6PkRLWAC5zItKpWEbLCD Cnsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=WL5y5TBUZZjGafe0KSL4M1sKQozI963t4V4kT3IJ4N8=; b=EOt5Sgx9oRboeDO3m4vPq25Hry1x27W6Q70IF7F86lxz/Yy0Qqa8kYqJ1rmhX5gXF1 Zu6kkMIT6HvRs40k9o+VcCLe6u7QZhXXqNChTWzvYsW1NhSDUKi5GIQXbii3ZiNI3g7w yD2e3YR28OZ8zOrNjL5ZZzcDsR5T97Nlu5se1TCxfi0+drsPkYYe5AlhAlb5FAtctY7p 1ExQ0y1oOqxV0BqYI5aPovzhEc9b5hmH3mCfUL2q42HsRwPzrZBJ4uRTNKrQq3gxkKcq rsPE9qvZN8nHSbnvhcnMPoVZBewWU5lgVgz72Vk1YLKb72Fg71IAreLJMJMuqwSZsXd6 4AgA== 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 v34-v6si10103279plg.803.2018.01.29.12.25.36; Mon, 29 Jan 2018 12:25:51 -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 S1752846AbeA2UZP (ORCPT + 99 others); Mon, 29 Jan 2018 15:25:15 -0500 Received: from mail.efficios.com ([167.114.142.141]:53318 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754660AbeA2UWX (ORCPT ); Mon, 29 Jan 2018 15:22:23 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id ADD653402E2; Mon, 29 Jan 2018 20:22:55 +0000 (UTC) Received: from mail.efficios.com ([127.0.0.1]) by localhost (evm-mail-1.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id I18vL_wZFYLH; Mon, 29 Jan 2018 20:22:40 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id DDE66340302; Mon, 29 Jan 2018 20:22:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (evm-mail-1.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id a5lffzkoVPlc; Mon, 29 Jan 2018 20:22:40 +0000 (UTC) Received: from thinkos.internal.efficios.com (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) by mail.efficios.com (Postfix) with ESMTPSA id 777D4340111; Mon, 29 Jan 2018 20:22:40 +0000 (UTC) From: Mathieu Desnoyers To: Ingo Molnar , Peter Zijlstra , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andy Lutomirski , "Paul E . McKenney" , Boqun Feng , Andrew Hunter , Maged Michael , Avi Kivity , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dave Watson , "H . Peter Anvin" , Andrea Parri , Russell King , Greg Hackmann , Will Deacon , David Sehr , Linus Torvalds , x86@kernel.org, Mathieu Desnoyers , Arnd Bergmann , linux-arch@vger.kernel.org Subject: [PATCH for 4.16 v2 06/11] Introduce sync_core_before_usermode Date: Mon, 29 Jan 2018 15:20:15 -0500 Message-Id: <20180129202020.8515-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180129202020.8515-1-mathieu.desnoyers@efficios.com> References: <20180129202020.8515-1-mathieu.desnoyers@efficios.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Peter Zijlstra (Intel) CC: Thomas Gleixner 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: 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: Arnd Bergmann CC: x86@kernel.org CC: linux-arch@vger.kernel.org --- Changes since v1: - Introduce include/linux/sync_core.h --- include/linux/sync_core.h | 21 +++++++++++++++++++++ init/Kconfig | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 include/linux/sync_core.h diff --git a/include/linux/sync_core.h b/include/linux/sync_core.h new file mode 100644 index 000000000000..013da4b8b327 --- /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 2d118b6adee2..30208da2221f 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 -- 2.11.0