From patchwork Thu Feb 2 11:29:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13125836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C041DC636D3 for ; Thu, 2 Feb 2023 11:30:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 510D66B0078; Thu, 2 Feb 2023 06:30:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C1B96B007B; Thu, 2 Feb 2023 06:30:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 363096B007D; Thu, 2 Feb 2023 06:30:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 283D86B0078 for ; Thu, 2 Feb 2023 06:30:34 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0378B1C66E9 for ; Thu, 2 Feb 2023 11:30:33 +0000 (UTC) X-FDA: 80422133988.13.23EA818 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 3565C40025 for ; Thu, 2 Feb 2023 11:30:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ckNO74WB; spf=pass (imf12.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=reject) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675337432; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Qm1b/r5EaArMOm2VfEm0gRCqLh5hnCX7Lg7t/WY9ly0=; b=aQLGz9oXRoHDjciyj2NhMRwRnwCqdWhYrl3M6VBlin1iygYJY5gdXc++w6vvW5FQTwNUdx Bj/4sVnaH2Jj4ZQihmclmX7wBSPSsCt61GIj9TgOBKk6ipLpkySc+39L0fE5FSeRWmFmI6 4fkSgTEAFuRDq4so3LeRkxM2Dmh7370= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ckNO74WB; spf=pass (imf12.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=reject) header.from=collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675337432; a=rsa-sha256; cv=none; b=Hd2vwYSvMQDUjCnL8QnL2upk1mdvpb4xRkE2X+Ir/0BDy4Ze9csQET0PTfQhnbx75JoHy8 ZtPVDTbhKmUmNkrfeGNQhfbvuiVgtAauLpSvVRXlkoGbyEuUPS11tdsuU6NxexZ0FuHt3N ZBVdUxSOmhR4ZdW8UlSLFCU3JIVpt2M= Received: from localhost.localdomain (unknown [39.45.165.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id 78CF16602EF0; Thu, 2 Feb 2023 11:30:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1675337430; bh=vLKWj5//Zawv0HDUOAPz3B4soyCTnmWzd0wVrOxevEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckNO74WBHEGIncMfejSOR510T/8wB9MB00CaiU+blSg51WPIaE4wcPwxMUkwzV4UU WskrW7Z1biJhLEWhZDkS5uw5BMj/OGVnp6R39bOyPfbFmHnJVsjK9xOgn18wE6hSL5 W2yR+C4iW7Rcblo243JSxZXDeJrZ4OwiyFa9fYu5QkaPtkoEcFTsjfiAlDn4GCegZV opgp6A/vMjwx1Mez8Ebxw++3S/20ewAru2kuXyL0Gn1bOy11bvDbB7FuP/ZfRKXmms SR7wT1jyG9A/JueueH/Yy5/cYdnBqSq4kXb2KMIJR7FyF76zuzTKTTE8b5SM38ww0e awUF+YVxh0iRg== From: Muhammad Usama Anjum To: Peter Xu , David Hildenbrand , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Andrei Vagin , Danylo Mocherniuk , Paul Gofman , Cyrill Gorcunov Cc: Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Suren Baghdasaryan , Alex Sierra , Muhammad Usama Anjum , Matthew Wilcox , Pasha Tatashin , Mike Rapoport , Nadav Amit , Axel Rasmussen , "Gustavo A . R . Silva" , Dan Williams , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Greg KH , kernel@collabora.com Subject: [PATCH v10 2/6] userfaultfd: update documentation to describe UFFD_FEATURE_WP_ASYNC Date: Thu, 2 Feb 2023 16:29:11 +0500 Message-Id: <20230202112915.867409-3-usama.anjum@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230202112915.867409-1-usama.anjum@collabora.com> References: <20230202112915.867409-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3565C40025 X-Stat-Signature: qtw6b16qi6i4sdeip1st3kmkg6anzubw X-Rspam-User: X-HE-Tag: 1675337431-603483 X-HE-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O+il5i8e0FdGa4nGMLn85WAvfK1AVIHsW6DepsLC43++ewlr0oW7wrmpvE7pdAXQszZjcNmjAYN4S9++5qCX0dySfLttp1o7R9a8KGmMplCYNiRWyrb/7y4V/eKqdbbMB+DQTMRWEVbx+h4J6SUWkCqHNmH60Kr7SIeIbAbsy3rMqFoSSlmCYMu9J/CbxCJeFkHHZMY215CS/Nb4L/jZA2dW4puQBE899R9xrjpg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Explain the difference created by UFFD_FEATURE_WP_ASYNC to the write protection (UFFDIO_WRITEPROTECT_MODE_WP) mode. Signed-off-by: Muhammad Usama Anjum --- Documentation/admin-guide/mm/userfaultfd.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/admin-guide/mm/userfaultfd.rst b/Documentation/admin-guide/mm/userfaultfd.rst index 83f31919ebb3..4747e7bd5b26 100644 --- a/Documentation/admin-guide/mm/userfaultfd.rst +++ b/Documentation/admin-guide/mm/userfaultfd.rst @@ -221,6 +221,13 @@ former will have ``UFFD_PAGEFAULT_FLAG_WP`` set, the latter you still need to supply a page when ``UFFDIO_REGISTER_MODE_MISSING`` was used. +If ``UFFD_FEATURE_WP_ASYNC`` is set while calling ``UFFDIO_API`` ioctl, the +behaviour of ``UFFDIO_WRITEPROTECT_MODE_WP`` changes such that faults for +anon and shmem are resolved automatically by the kernel instead of sending +the message to the userfaultfd. The hugetlb isn't supported. The ``pagemap`` +file can be read to find which pages have ``PM_UFFD_WP`` flag set which +means they are write-protected. + QEMU/KVM ========