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: 649878 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 461A9C636D3 for ; Thu, 2 Feb 2023 11:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbjBBLaw (ORCPT ); Thu, 2 Feb 2023 06:30:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231959AbjBBLai (ORCPT ); Thu, 2 Feb 2023 06:30:38 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C60254577; Thu, 2 Feb 2023 03:30:32 -0800 (PST) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 ========