Received: by 10.223.176.5 with SMTP id f5csp3382445wra; Mon, 29 Jan 2018 12:23:39 -0800 (PST) X-Google-Smtp-Source: AH8x224QYLPFtC+QPtFIjc+l2xUp3csYqteLTlnY1wpiP7TJl+sFVGblBr6VRVbYIw7puMqNxT3a X-Received: by 10.98.160.25 with SMTP id r25mr28122939pfe.218.1517257419265; Mon, 29 Jan 2018 12:23:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517257419; cv=none; d=google.com; s=arc-20160816; b=mhKga0KlmB2iMj+Y2gh5JMk4yJFAwveIHkxhYocEIGL3LLIhxD/Y8K/JVxnlLhkRx6 pNbbLMPtOa21nnjRL5fQsASi9NbCs7TgrKlD1So2Jp7SeZrSTBVab/iMWFXKbFv/IfgJ LZeitXPO3ynIu1nHnwFfMiVLnBMvKFqTxmYRShdXMXUIbkuO7zXgb0eRNrNF/ccqoSfo BaoWMkEIKu1sy/DIaLKD4lHajzHfXc4yauzDpFGbltjGxM3GFl6N2upHZy0BPndUKg3M 5HSjx+6u3kHUT8NdHqc8/HSJ1om5hfMUIRXSehiXH+nXWmBwX7cv0ONcCJzFWFjT1tYH Y2hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DfyCo/RjGmjZQeTRlbwbrqpm1iUxxeujqUpP+dk5iN0=; b=TTm+VVewxok3xFk8UcbdAbfhAmc3+r5H6j19vHTnn9xnCeeGILLUXFGQoOK4cM4kho gergZBqHz9RDNIxlSxpcK+GF+AQuw6Cv2CevLvGOmVQoGz/VduqbE/UzVQF9kNYcc7X8 6PPPAxQb6NxUTNu6NBdVOIsWPzYTHyokKkkQfdfwRGG7BOKLP3gv0l8nxlNBAgRWrUPN B3X8riEax8gmn0locsJ5OtEtfCPCj2d16EC5I1Hax9I8vdyYfzzfgS3UBigLe9BLRkEG /0ZBu8+c8lKZoaXo7c1dAWLJbOlBEyDvllEwmzX2zQPZI8QQ+tnPav1V8BafV18Q7Vzw VunQ== 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 b34-v6si9920980pld.389.2018.01.29.12.23.25; Mon, 29 Jan 2018 12:23:39 -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 S932512AbeA2UWJ (ORCPT + 99 others); Mon, 29 Jan 2018 15:22:09 -0500 Received: from mail.efficios.com ([167.114.142.141]:53144 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754133AbeA2UWH (ORCPT ); Mon, 29 Jan 2018 15:22:07 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id F3D5D3401B0; Mon, 29 Jan 2018 20:22:38 +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 LOyfwhtIGCSQ; Mon, 29 Jan 2018 20:22:38 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 74A1A3402DE; Mon, 29 Jan 2018 20:22:38 +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 O_nQBvuE7VyI; Mon, 29 Jan 2018 20:22:38 +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 0264E340192; Mon, 29 Jan 2018 20:22:37 +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 Subject: [PATCH for 4.16 00/11] membarrier updates for 4.16 Date: Mon, 29 Jan 2018 15:20:09 -0500 Message-Id: <20180129202020.8515-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ingo, Peter, Thomas, Here is the updated membarrier patch series following Acked-by from Peter. It would be appreciated of those can go through the scheduler tree for the 4.16 merge window. Highlights: "powerpc: membarrier: Skip memory barrier in switch_mm()" takes care of a TODO that was left in the private expedited implementation when merged in 4.14: an extra memory barrier was added on context switch on powerpc. Ensure that the barrier is only performed when scheduling between different processes, only for threads belonging to processes that have registered their intent to use the private expedited command. "membarrier: provide GLOBAL_EXPEDITED command" adds new commands to membarrier for registration and use of membarrier across processes communicating through shared memory mappings. The non-expedited command has proven to be really too slow (taking 10ms and more to complete) for real-world use. The expedited version completes in a matter of microseconds. This patch renames the pre-existing MEMBARRIER_CMD_SHARED to MEMBARRIER_CMD_GLOBAL for consistency, keeping the old enum label as an alias for backward compatibility. "membarrier: Provide core serializing command" provides core serialization for JIT reclaim. We received positive feedback from Android developers that the proposed ABI fits their use-case. Only x86 32/64 and arm 64 implement this command so far. This is opt-in per architecture. The other patches add selftests and documentation. Thanks, Mathieu Mathieu Desnoyers (11): membarrier: selftest: Test private expedited cmd (v2) powerpc: membarrier: Skip memory barrier in switch_mm() (v7) membarrier: Document scheduler barrier requirements (v5) membarrier: provide GLOBAL_EXPEDITED command (v3) membarrier: selftest: Test global expedited cmd (v2) Introduce sync_core_before_usermode (v2) x86: Implement sync_core_before_usermode (v3) membarrier: Provide core serializing command (v3) membarrier: x86: Provide core serializing command (v4) membarrier: arm64: Provide core serializing command membarrier: selftest: Test private expedited sync core cmd MAINTAINERS | 1 + arch/arm64/Kconfig | 1 + arch/arm64/kernel/entry.S | 4 + arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/membarrier.h | 27 +++ arch/powerpc/mm/mmu_context.c | 7 + arch/x86/Kconfig | 2 + arch/x86/entry/entry_32.S | 5 + arch/x86/entry/entry_64.S | 4 + arch/x86/include/asm/sync_core.h | 28 +++ arch/x86/mm/tlb.c | 6 + include/linux/sched/mm.h | 40 +++- include/linux/sync_core.h | 21 ++ include/uapi/linux/membarrier.h | 74 ++++++- init/Kconfig | 9 + kernel/sched/core.c | 57 +++-- kernel/sched/membarrier.c | 177 +++++++++++++-- .../testing/selftests/membarrier/membarrier_test.c | 237 +++++++++++++++++++-- 18 files changed, 633 insertions(+), 68 deletions(-) create mode 100644 arch/powerpc/include/asm/membarrier.h create mode 100644 arch/x86/include/asm/sync_core.h create mode 100644 include/linux/sync_core.h -- 2.11.0