Received: by 10.223.164.202 with SMTP id h10csp2625349wrb; Sun, 19 Nov 2017 03:13:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ2Ju9GaZExJtX1dDzRwVw/fEX7/6lDE6g+IVALxNN8hKdf8AqkkQTiXf+uqWsDz2E9fOSl X-Received: by 10.98.21.17 with SMTP id 17mr7839304pfv.120.1511089988611; Sun, 19 Nov 2017 03:13:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511089988; cv=none; d=google.com; s=arc-20160816; b=og599GkIA9BxN7/R78B1UI7AsdIytU9hOXLBb9FK8lM/aDnItg1tPlGdxsiH6FUgd5 Vhw1hJ3wQokBjnEr6M2y8PBqoSpmOgmS2pzzqXbLjgJeAPU/hk0y1oVI9C2aPZU69zDB tHN8LdzQJk6AYNs0bXDAC8+Hf0kDBWrdH5Drj1VnSci5jEO23E3PoVvoBdWoVl2ZYBQa zsiL19HSFa9U4KEotupsx3ofq3WniVMl4UY+LumAAm2GNkcOCcd/MKj6PPYPYz1RpPhL lSBh2eoNBy35JqXHDzgeloCo+B5qkNePUDC3ZPYY0z5hWJJBBpQzflrIHyjmGAQnhc5R if+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc:dkim-signature :arc-authentication-results; bh=woaQioPMAgdj2jr0jd6JqC9X98+sruUN2X9twLrXplQ=; b=h/XQ/NITsmYXTzL4WN78ynH37wlHP3mTINjKb/YxbPNQIJ0aLslHZgpHwgZ31SunTD FAHx5I71jvVLtNALEMURC61ORkPIBkdnUCb4yXRTS25ttHvC7F+ASUGtbBOWVANkBd+x uEufugmQzLR7seJFypx2TOsNSV1dD+dvJv3tsX9/tOFzrnprnzG9sdPXTHooQA/TbO4M vtFUxRLp36gMJklnqC9PJPw4/OQxZ1SyUw8a6l5VqbqtXl98d5TvwbXAB7qXz37N8g0E PnPFrS4BmpVzl7NbIT9lhHEg+xsQek5F4a4sLBEpHN/TU2qhPKpjMC8reTBZAxd4D9dZ 0wqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s/PQFcCK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si5989639pgt.535.2017.11.19.03.12.56; Sun, 19 Nov 2017 03:13:08 -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=@gmail.com header.s=20161025 header.b=s/PQFcCK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750951AbdKSLMT (ORCPT + 73 others); Sun, 19 Nov 2017 06:12:19 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:43804 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbdKSLMQ (ORCPT ); Sun, 19 Nov 2017 06:12:16 -0500 Received: by mail-wm0-f68.google.com with SMTP id x63so13716818wmf.2; Sun, 19 Nov 2017 03:12:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=cc:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=woaQioPMAgdj2jr0jd6JqC9X98+sruUN2X9twLrXplQ=; b=s/PQFcCKlWCBjiN/HeFPKhe44vSvesxBZwHhtTufA3SCMoT+oeIWllP/Zs+KFYK8oL rW291TTJ7YwtcpV9Jy+1B3RwUaKG2N4ZrctzzfY0iNOU/syEweLfbUR2IJunvLMLB88U m85tvE3R/mhj3hRWZPNXnhsZU74x+iIfC/xpbaEh7lXd+CZVxIVOT4RGYyRVLC8EyHWh LZEtDMOkflp4RFqV/MmCMGlDDw1eZiD1mPcFLPNy/jgoUnHAaN1MoYgxB0WOW3Hz0nab R5whJAjbNlLxbY/DZwTRlIaPel7uhZbROm7bpnfRumCh6+ZJFwqhWy+QTps0XO/s/EVM xn7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=woaQioPMAgdj2jr0jd6JqC9X98+sruUN2X9twLrXplQ=; b=hHsI9g/U2dQKUe55n540180nWYCVRDPOA4jDQaedgMShhnBtHgJ/FlCw/CNRFLJK5A tA4L3p8ANetIonO6osLeBxXi/AI6UyOIht7EY/4VE2PiPyDT0wuc7ZEKTpoiJPJgf0PN yTczi4HFSMUS5bA/Cub/Rvu571Mzp+61R15IUnkX2/mzc0Ai8v3hPOYFLMgAGhaPNyFp zLVUTKe5cdP0SMi2s7pCq1haQdtCGdf87tuIVV/r49DNXYzSJsPpvv9+q64o29d18rRv gIJdc8onW6l+TnfF/B+Tz6TM3EMHsJ4TnecSNXE5bOvgY5El29FA/wYcYamOvzlC8yzo G4Og== X-Gm-Message-State: AJaThX50yo8uCWktLwyUh3RGsgntnZZu1h8Z8/8NXjvEv+xwM+LSBiLo wsSzN5a9mA9BfCYWhZTWtrg= X-Received: by 10.80.168.2 with SMTP id j2mr15602118edc.287.1511089934681; Sun, 19 Nov 2017 03:12:14 -0800 (PST) Received: from ?IPv6:2001:a61:42f0:e01:7ee9:d3ff:fef5:1a91? ([2001:a61:42f0:e01:7ee9:d3ff:fef5:1a91]) by smtp.gmail.com with ESMTPSA id 4sm5506901edf.81.2017.11.19.03.12.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Nov 2017 03:12:12 -0800 (PST) Cc: mtk.manpages@gmail.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Peter Zijlstra , "Paul E . McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , Paul Turner , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon Subject: Re: [RFC PATCH 3/3] Update membarrier manpage for 4.14, 4.15 To: Mathieu Desnoyers References: <20171116151711.19001-1-mathieu.desnoyers@efficios.com> <20171116151711.19001-4-mathieu.desnoyers@efficios.com> From: "Michael Kerrisk (man-pages)" Message-ID: <038c0532-f45c-7beb-5b47-e34816f5b082@gmail.com> Date: Sun, 19 Nov 2017 12:12:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171116151711.19001-4-mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, On 11/16/2017 04:17 PM, Mathieu Desnoyers wrote: > Add documentation for those new membarrier commands: > > New in 4.14: > MEMBARRIER_CMD_PRIVATE_EXPEDITED > MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED > > Adapt the MEMBARRIER_CMD_SHARED return value documentation to reflect > that it now returns -EINVAL when issued on a system configured for > nohz_full. > > New in 4.15: > MEMBARRIER_CMD_SHARED_EXPEDITED > MEMBARRIER_CMD_REGISTER_SHARED_EXPEDITED Combining details into one patch in this way makes things more difficult for me. I would prefer these details to be split into separate pieces for the 4.14 and 4.15 changes, in part because of the way the man-pages release cycle currently works (roughly synchronized with kernel releases) and also because the 4.15 details might change. I've applied the 4.14 details from this patch to the man page; if you had a chance to check whether I did that job correctly, that would be great. See the patch below. Once the pieces get merged for 4.15, could you ping me/resend a patch for the 4.15 changes please. Cheers, Michael diff --git a/man2/membarrier.2 b/man2/membarrier.2 index bbf611e10..6390f9693 100644 --- a/man2/membarrier.2 +++ b/man2/membarrier.2 @@ -1,4 +1,4 @@ -.\" Copyright 2015 Mathieu Desnoyers +.\" Copyright 2015-2017 Mathieu Desnoyers .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this @@ -22,7 +22,7 @@ .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" -.TH MEMBARRIER 2 2017-09-15 "Linux" "Linux Programmer's Manual" +.TH MEMBARRIER 2 2017-11-15 "Linux" "Linux Programmer's Manual" .SH NAME membarrier \- issue memory barriers on a set of threads .SH SYNOPSIS @@ -87,6 +87,25 @@ order between entry to and return from the .BR membarrier () system call. All threads on the system are targeted by this command. +.TP +.BR MEMBARRIER_CMD_PRIVATE_EXPEDITED " (since Linux 4.14)" +Execute a memory barrier on each running thread belonging to the same +process as the current thread. +Upon return from system call, the calling +thread is assured that all its running threads siblings have passed +through a state where all memory accesses to user-space addresses match +program order between entry to and return from the system call +(non-running threads are de facto in such a state). +This covers only threads from the same process as the calling thread. +.IP +The "expedited" commands complete faster than the non-expedited ones; +they never block, but have the downside of causing extra overhead. +A process needs to register its intent to use the private +expedited command prior to using it. +.TP +.BR MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED " (since Linux 4.14)" +Register the process's intent to use +.BR MEMBARRIER_CMD_PRIVATE_EXPEDITED . .PP The .I flags @@ -117,9 +136,12 @@ The pair ordering is detailed as (O: ordered, X: not ordered): .SH RETURN VALUE On success, the .B MEMBARRIER_CMD_QUERY -operation returns a bit mask of supported commands and the -.B MEMBARRIER_CMD_SHARED -operation returns zero. +operation returns a bit mask of supported commands, and the +.B MEMBARRIER_CMD_SHARED , +.B MEMBARRIER_CMD_PRIVATE_EXPEDITED , +and +.B MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED , +operations return zero. On error, \-1 is returned, and .I errno @@ -138,22 +160,22 @@ set to 0, error handling is required only for the first call to .TP .B EINVAL .I cmd -is invalid or +is invalid, or .I flags -is non-zero. +is non-zero, or the +.BR MEMBARRIER_CMD_SHARED +command is disabled because the +.I nohz_full +CPU parameter has been set. .TP .B ENOSYS The .BR membarrier () system call is not implemented by this kernel. .TP -.BR ENOSYS " (since Linux 4.11)" -.\" 907565337ebf998a68cb5c5b2174ce5e5da065eb -The -.BR membarrier () -system call is disabled because the -.I nohz_full -CPU parameter has been set. +.B EPERM +The current process was not registered prior to using private expedited +commands. .SH VERSIONS The .BR membarrier () @@ -162,6 +184,10 @@ system call was added in Linux 4.3. .SH CONFORMING TO .BR membarrier () is Linux-specific. +.\" .SH SEE ALSO +.\" FIXME See if the following syscalls make it into Linux 4.15 or later +.\" .BR cpu_opv (2), +.\" .BR rseq (2) .SH NOTES A memory barrier instruction is part of the instruction set of architectures with weakly-ordered memory models. -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ From 1584251352350346154@xxx Thu Nov 16 19:17:05 +0000 2017 X-GM-THRID: 1584251352350346154 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread