Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162587AbdD0OPQ (ORCPT ); Thu, 27 Apr 2017 10:15:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58183 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934303AbdD0OOu (ORCPT ); Thu, 27 Apr 2017 10:14:50 -0400 From: Mike Rapoport To: "Michael Kerrisk (man-pages)" Cc: Andrea Arcangeli , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-man@vger.kernel.org, Mike Rapoport Subject: [PATCH man-pages 2/2] ioctl_userfaultfd.2: start adding details about userfaultfd features Date: Thu, 27 Apr 2017 17:14:34 +0300 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493302474-4701-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1493302474-4701-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17042714-0040-0000-0000-000003778EAD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042714-0041-0000-0000-0000252427F3 Message-Id: <1493302474-4701-3-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-27_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704270238 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2815 Lines: 93 Signed-off-by: Mike Rapoport --- man2/ioctl_userfaultfd.2 | 53 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 index 42bf7a7..cdc07e0 100644 --- a/man2/ioctl_userfaultfd.2 +++ b/man2/ioctl_userfaultfd.2 @@ -121,22 +121,70 @@ and explicitly enable userfaultfd features that are disabled by default. The kernel always reports all the available features in the .I features field. + +To enable userfaultfd features the application should set +a bit corresponding to each feature it wants to enable in the +.I features +field. +If the kernel supports all the requested features it will enable them. +Otherwise it will zero out the returned +.I uffdio_api +structure and return +.BR EINVAL . .\" FIXME add more details about feature negotiation and enablement Since Linux 4.11, the following feature bits may be set: .TP .B UFFD_FEATURE_EVENT_FORK +When this feature is enabled, +the userfaultfd objects associated with a parent process are duplicated +into the child process during +.BR fork (2) +system call and the +.I UFFD_EVENT_FORK +is delivered to the userfaultfd monitor .TP .B UFFD_FEATURE_EVENT_REMAP +If this feature is enabled, +when the faulting process invokes +.BR mremap (2) +system call +the userfaultfd monitor will receive an event of type +.I UFFD_EVENT_REMAP. .TP .B UFFD_FEATURE_EVENT_REMOVE +If this feature is enabled, +when the faulting process calls +.BR madvise(2) +system call with +.I MADV_DONTNEED +or +.I MADV_REMOVE +advice to free a virtual memory area +the userfaultfd monitor will receive an event of type +.I UFFD_EVENT_REMOVE. .TP .B UFFD_FEATURE_EVENT_UNMAP +If this feature is enabled, +when the faulting process unmaps virtual memory either explicitly with +.BR munmap (2) +system call, or implicitly either during +.BR mmap (2) +or +.BR mremap (2) +system call, +the userfaultfd monitor will receive an event of type +.I UFFD_EVENT_UNMAP .TP .B UFFD_FEATURE_MISSING_HUGETLBFS +If this feature bit is set, +the kernel supports registering userfaultfd ranges on hugetlbfs +virtual memory areas .TP .B UFFD_FEATURE_MISSING_SHMEM -.\" FIXME add feature description +If this feature bit is set, +the kernel supports registering userfaultfd ranges on tmpfs +virtual memory areas The returned .I ioctls @@ -182,7 +230,8 @@ The API version requested in the .I api field is not supported by this kernel, or the .I features -field was not zero. +field passed to the kernel includes feature bits that are not supported +by the current kernel version. .\" FIXME In the above error case, the returned 'uffdio_api' structure is .\" zeroed out. Why is this done? This should be explained in the manual page. .\" -- 1.9.1