From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Desnoyers Subject: Re: [PATCH for 4.16 00/11] membarrier updates for 4.16 Date: Mon, 29 Jan 2018 16:02:46 +0000 (UTC) Message-ID: <1278608578.11357.1517241766434.JavaMail.zimbra@efficios.com> References: <20180123155733.3404-1-mathieu.desnoyers@efficios.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180123155733.3404-1-mathieu.desnoyers@efficios.com> Sender: linux-kernel-owner@vger.kernel.org To: Ingo Molnar , Peter Zijlstra Cc: linux-kernel , linux-api , Andy Lutomirski , "Paul E. McKenney" , Thomas Gleixner , Linus Torvalds , Boqun Feng , Andrew Hunter , maged michael , Avi Kivity , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dave Watson , "H. Peter Anvin" , Andrea Parri , "Russell King, ARM Linux" , Greg Hackmann , Will Deacon List-Id: linux-api@vger.kernel.org Hi Ingo, Hi Peter, Please let me know if you find anything that prevents you from integrating this patchset into the scheduler tree. Thanks, Mathieu ----- On Jan 23, 2018, at 10:57 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > Hi Ingo, Peter, Thomas, > > Here is the updated membarrier patch series following review from > Andy. > > It would be appreciated of those can go through the scheduler tree for > the 4.16 merge window. > > Patch "x86: Implement sync_core_before_usermode" got a reviewed-by from > Thomas, but I removed the tag following KPTI-related optimizations based > on the discussion with Andy afterwards. > > 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 (v2) > 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 | 53 +++-- > kernel/sched/membarrier.c | 177 +++++++++++++-- > .../testing/selftests/membarrier/membarrier_test.c | 237 +++++++++++++++++++-- > 18 files changed, 629 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 -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-3420708-1517241740-2-3259924829691203442 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.001, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='com', MailFrom='org', XOriginatingCountry='CA' X-Spam-charsets: plain='utf-8' X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: linux-api-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1517241739; b=c8xr5E8l/MZ2HZ8W0EK5ao5JeX0484QJDjqcYipa3vQnolQ dM1mMO3oCJLdmmlLelN6AFdndPnq4U3tRAeme3uTxyN/gaAUPQc2OwLw/SxYNU/b nsXE30hgnqc3nY1SM6yrz2vLAzaVyloC7R96ead5hylXNwtxbjVjnHbEiJK+DjQm CmHfAS3zKD0ozW8OzjGmbUXQdQ2kj3hEQjMGvDcFf5D3ismPNhoGXEEIK2fMQ81X +5vE42YFObngl2tghFsFuOXWGTZ/uepOCD3s8U12t5/U61c85ZHcLFR1oxD9Y3IT p/BRu03DDC6LPs7AXY6Ap9NeZ6xT794iqeDmC5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-type :content-transfer-encoding:sender:list-id; s=arctest; t= 1517241739; bh=rp97VVxVGINqXSs6lgBZiPIDEh5qLw2v/cBq6X/G8yE=; b=H s/2WLZPy7whXZXNG0YhWN+Pu135h1zHNBmJrsD8q7TA7f1FJOcS/s/5Bp7mjL4jx 3lf/wQanAQTkPGYvTm61/REonc8GMi0i/X8EuIMpx+yrmnQOuycZgeYlo+OuF553 7EtdvapdF7AXg0AykuVifhzJYW8OovWXCZR1HiN5/r8T2F88Sp3+sXbEa5wb1ao5 1iN8gcdvTRjPCxt18kRccmzOgJc1AlaKIevbPTHzNYIZ5jw5NDBIIAOzblSjMRpF W9CzUbnYBN9lZ3nlH/skWxflwPre4vf6JwkwoAiVBX7F9Zv8RjmzyQOPHwNfRl9s j4xJSAh4yDbBOLY1raYQQ== ARC-Authentication-Results: i=1; mx1.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=efficios.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-api-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=efficios.com header.result=pass header_is_org_domain=yes Authentication-Results: mx1.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=efficios.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-api-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=efficios.com header.result=pass header_is_org_domain=yes Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751162AbeA2QCQ (ORCPT ); Mon, 29 Jan 2018 11:02:16 -0500 Received: from mail.efficios.com ([167.114.142.141]:49940 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751127AbeA2QCQ (ORCPT ); Mon, 29 Jan 2018 11:02:16 -0500 Date: Mon, 29 Jan 2018 16:02:46 +0000 (UTC) From: Mathieu Desnoyers To: Ingo Molnar , Peter Zijlstra Cc: linux-kernel , linux-api , Andy Lutomirski , "Paul E. McKenney" , Thomas Gleixner , Linus Torvalds , Boqun Feng , Andrew Hunter , maged michael , Avi Kivity , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dave Watson , "H. Peter Anvin" , Andrea Parri , "Russell King, ARM Linux" , Greg Hackmann , Will Deacon , David Sehr , x86 Message-ID: <1278608578.11357.1517241766434.JavaMail.zimbra@efficios.com> In-Reply-To: <20180123155733.3404-1-mathieu.desnoyers@efficios.com> References: <20180123155733.3404-1-mathieu.desnoyers@efficios.com> Subject: Re: [PATCH for 4.16 00/11] membarrier updates for 4.16 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.141] X-Mailer: Zimbra 8.7.11_GA_1854 (ZimbraWebClient - FF52 (Linux)/8.7.11_GA_1854) Thread-Topic: membarrier updates for 4.16 Thread-Index: 2+wlRxpxc9yAlh3/5wBLd6rBlml9ig== Sender: linux-api-owner@vger.kernel.org X-Mailing-List: linux-api@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Hi Ingo, Hi Peter, Please let me know if you find anything that prevents you from integrating this patchset into the scheduler tree. Thanks, Mathieu ----- On Jan 23, 2018, at 10:57 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > Hi Ingo, Peter, Thomas, > > Here is the updated membarrier patch series following review from > Andy. > > It would be appreciated of those can go through the scheduler tree for > the 4.16 merge window. > > Patch "x86: Implement sync_core_before_usermode" got a reviewed-by from > Thomas, but I removed the tag following KPTI-related optimizations based > on the discussion with Andy afterwards. > > 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 (v2) > 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 | 53 +++-- > kernel/sched/membarrier.c | 177 +++++++++++++-- > .../testing/selftests/membarrier/membarrier_test.c | 237 +++++++++++++++++++-- > 18 files changed, 629 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 -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com