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 E189CC54EAA for ; Fri, 27 Jan 2023 06:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232462AbjA0Gvh (ORCPT ); Fri, 27 Jan 2023 01:51:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbjA0GvS (ORCPT ); Fri, 27 Jan 2023 01:51:18 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B19979620; Thu, 26 Jan 2023 22:48:27 -0800 (PST) Received: from [192.168.10.12] (unknown [39.45.165.226]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 E2F7D6602E82; Fri, 27 Jan 2023 06:47:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1674802047; bh=69W6soRYdRXxx92H88q51hXdJ1au/2h810DecoqjF2s=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=QRQCFMh8FhNf41DVQZOcw07fhehrXuCkJ+jxGny7r17qr85Jzq05s5VQJ+wvxCrBC +cVbfQFlF9uXMeOmdEFxtFKMs7oP6bvOmyS20sBJxm3fILJTOMrCYPMbEddE2+hkFm R3k0aeIH/9AwchlkpeiPElGjUhywVleAovENUoOdtmSTvQA9SDPl9HyCnwbn2E+4jZ KexE7nJrz/8SovRhKqfRjfEGY59v/CUvVwsKpAXglPwwmLfw50nrYHuKaExM7J+NNI JWKtBdZpRXAB8/8aZPT+Wdlswe+fk6NpGGglYs0N0mPKz3GpR1/SYZ/5tfoTB8K8n1 kNInR2JY5s7Qw== Content-Type: multipart/mixed; boundary="------------YDczPGnNMYCbOh0mtE2Xi30f" Message-ID: <1968dff9-f48a-3290-a15b-a8b739f31ed2@collabora.com> Date: Fri, 27 Jan 2023 11:47:14 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Cc: Muhammad Usama Anjum , David Hildenbrand , Andrew Morton , =?UTF-8?B?TWljaGHFgiBNaXJvc8WC?= =?UTF-8?Q?aw?= , Andrei Vagin , Danylo Mocherniuk , Paul Gofman , Cyrill Gorcunov , Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Suren Baghdasaryan , Alex Sierra , 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: Re: [PATCH v8 1/4] userfaultfd: Add UFFD WP Async support To: Peter Xu References: <20230124084323.1363825-1-usama.anjum@collabora.com> <20230124084323.1363825-2-usama.anjum@collabora.com> Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/27/23 4:05 AM, Peter Xu wrote: > On Tue, Jan 24, 2023 at 01:43:20PM +0500, Muhammad Usama Anjum wrote: >> Add new WP Async mode (UFFD_FEATURE_WP_ASYNC) which resolves the page >> faults on its own. It can be used to track that which pages have been >> written-to from the time the pages were write-protected. It is very >> efficient way to track the changes as uffd is by nature pte/pmd based. >> >> UFFD synchronous WP sends the page faults to the userspace where the >> pages which have been written-to can be tracked. But it is not efficient. >> This is why this asynchronous version is being added. After setting the >> WP Async, the pages which have been written to can be found in the pagemap >> file or information can be obtained from the PAGEMAP_IOCTL. >> >> Suggested-by: Peter Xu >> Signed-off-by: Muhammad Usama Anjum >> --- >> Changes in v7: >> - Remove UFFDIO_WRITEPROTECT_MODE_ASYNC_WP and add UFFD_FEATURE_WP_ASYNC >> - Handle automatic page fault resolution in better way (thanks to Peter) >> --- >> fs/userfaultfd.c | 11 +++++++++++ >> include/linux/userfaultfd_k.h | 6 ++++++ >> include/uapi/linux/userfaultfd.h | 8 +++++++- >> mm/memory.c | 29 +++++++++++++++++++++++++++-- >> 4 files changed, 51 insertions(+), 3 deletions(-) >> >> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c >> index 15a5bf765d43..b82af02092ce 100644 >> --- a/fs/userfaultfd.c >> +++ b/fs/userfaultfd.c >> @@ -1867,6 +1867,10 @@ static int userfaultfd_writeprotect(struct userfaultfd_ctx *ctx, >> mode_wp = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_WP; >> mode_dontwake = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_DONTWAKE; >> >> + /* Write protection cannot be disabled in case of aync WP */ > > s/aync/async/ > > A slight reworded version: > > /* Unprotection is not supported if in async WP mode */ > Will fix in next version. >> + if (!mode_wp && (ctx->features & UFFD_FEATURE_WP_ASYNC)) >> + return -EINVAL; >> + >> if (mode_wp && mode_dontwake) >> return -EINVAL; >> >> @@ -1950,6 +1954,13 @@ static int userfaultfd_continue(struct userfaultfd_ctx *ctx, unsigned long arg) >> return ret; >> } >> >> +int userfaultfd_wp_async(struct vm_area_struct *vma) >> +{ >> + struct userfaultfd_ctx *ctx = vma->vm_userfaultfd_ctx.ctx; >> + >> + return (ctx && (ctx->features & UFFD_FEATURE_WP_ASYNC)); >> +} >> + >> static inline unsigned int uffd_ctx_features(__u64 user_features) >> { >> /* >> diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h >> index 9df0b9a762cc..5db51fccae1d 100644 >> --- a/include/linux/userfaultfd_k.h >> +++ b/include/linux/userfaultfd_k.h >> @@ -179,6 +179,7 @@ extern int userfaultfd_unmap_prep(struct mm_struct *mm, unsigned long start, >> unsigned long end, struct list_head *uf); >> extern void userfaultfd_unmap_complete(struct mm_struct *mm, >> struct list_head *uf); >> +extern int userfaultfd_wp_async(struct vm_area_struct *vma); >> >> #else /* CONFIG_USERFAULTFD */ >> >> @@ -274,6 +275,11 @@ static inline bool uffd_disable_fault_around(struct vm_area_struct *vma) >> return false; >> } >> >> +int userfaultfd_wp_async(struct vm_area_struct *vma) >> +{ >> + return false; >> +} >> + >> #endif /* CONFIG_USERFAULTFD */ >> >> static inline bool pte_marker_entry_uffd_wp(swp_entry_t entry) >> diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h >> index 005e5e306266..f4252ef40071 100644 >> --- a/include/uapi/linux/userfaultfd.h >> +++ b/include/uapi/linux/userfaultfd.h >> @@ -38,7 +38,8 @@ >> UFFD_FEATURE_MINOR_HUGETLBFS | \ >> UFFD_FEATURE_MINOR_SHMEM | \ >> UFFD_FEATURE_EXACT_ADDRESS | \ >> - UFFD_FEATURE_WP_HUGETLBFS_SHMEM) >> + UFFD_FEATURE_WP_HUGETLBFS_SHMEM | \ >> + UFFD_FEATURE_WP_ASYNC) >> #define UFFD_API_IOCTLS \ >> ((__u64)1 << _UFFDIO_REGISTER | \ >> (__u64)1 << _UFFDIO_UNREGISTER | \ >> @@ -203,6 +204,10 @@ struct uffdio_api { >> * >> * UFFD_FEATURE_WP_HUGETLBFS_SHMEM indicates that userfaultfd >> * write-protection mode is supported on both shmem and hugetlbfs. >> + * >> + * UFFD_FEATURE_WP_ASYNC indicates that userfaultfd write-protection >> + * asynchronous mode is supported in which the write fault is automatically >> + * resolved and write-protection is un-set. >> */ >> #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) >> #define UFFD_FEATURE_EVENT_FORK (1<<1) >> @@ -217,6 +222,7 @@ struct uffdio_api { >> #define UFFD_FEATURE_MINOR_SHMEM (1<<10) >> #define UFFD_FEATURE_EXACT_ADDRESS (1<<11) >> #define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1<<12) >> +#define UFFD_FEATURE_WP_ASYNC (1<<13) >> __u64 features; >> >> __u64 ioctls; >> diff --git a/mm/memory.c b/mm/memory.c >> index 4000e9f017e0..8c03b133d483 100644 >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -3351,6 +3351,18 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) >> >> if (likely(!unshare)) { >> if (userfaultfd_pte_wp(vma, *vmf->pte)) { >> + if (userfaultfd_wp_async(vma)) { >> + /* >> + * Nothing needed (cache flush, TLB invalidations, >> + * etc.) because we're only removing the uffd-wp bit, >> + * which is completely invisible to the user. This >> + * falls through to possible CoW. > > Here it says it falls through to CoW, but.. > >> + */ >> + pte_unmap_unlock(vmf->pte, vmf->ptl); >> + set_pte_at(vma->vm_mm, vmf->address, vmf->pte, >> + pte_clear_uffd_wp(*vmf->pte)); >> + return 0; > > ... it's not doing so. The original lines should do: > > https://lore.kernel.org/all/Y8qq0dKIJBshua+X@x1n/ > > Side note: you cannot modify pgtable after releasing the pgtable lock. > It's racy. If I don't unlock and return after removing the UFFD_WP flag in case of async wp, the target just gets stuck. Maybe the pte lock is not unlocked in some path. If I unlock and don't return, the crash happens. So I'd put unlock and return from here. Please comment on the below patch and what do you think should be done. I've missed something. > >> + } >> pte_unmap_unlock(vmf->pte, vmf->ptl); >> return handle_userfault(vmf, VM_UFFD_WP); >> } >> @@ -4812,8 +4824,21 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf) >> >> if (vma_is_anonymous(vmf->vma)) { >> if (likely(!unshare) && >> - userfaultfd_huge_pmd_wp(vmf->vma, vmf->orig_pmd)) >> - return handle_userfault(vmf, VM_UFFD_WP); >> + userfaultfd_huge_pmd_wp(vmf->vma, vmf->orig_pmd)) { >> + if (userfaultfd_wp_async(vmf->vma)) { >> + /* >> + * Nothing needed (cache flush, TLB invalidations, >> + * etc.) because we're only removing the uffd-wp bit, >> + * which is completely invisible to the user. This >> + * falls through to possible CoW. >> + */ >> + set_pmd_at(vmf->vma->vm_mm, vmf->address, vmf->pmd, >> + pmd_clear_uffd_wp(*vmf->pmd)); > > This is for THP, not hugetlb. > > Clearing uffd-wp bit here for the whole pmd is wrong to me, because we > track writes in small page sizes only. We should just split. By detecting if the fault is async wp, just splitting the PMD doesn't work. The below given snippit is working right now. But definately, the fault of the whole PMD is being resolved which if we can bypass by correctly splitting would be highly desirable. Can you please take a look on UFFD side and suggest the changes? It would be much appreciated. I'm attaching WIP v9 patches for you to apply on next(next-20230105) and pagemap_ioctl selftest can be ran to test things after making changes. > > The relevant code for hugetlb resides in hugetlb_fault(). > >> + return 0; >> + } else { >> + return handle_userfault(vmf, VM_UFFD_WP); >> + } >> + } >> return do_huge_pmd_wp_page(vmf); >> } >> >> -- >> 2.30.2 >> > --- a/mm/memory.c +++ b/mm/memory.c @@ -3351,6 +3351,18 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) if (likely(!unshare)) { if (userfaultfd_pte_wp(vma, *vmf->pte)) { + if (userfaultfd_wp_async(vma)) { + set_pte_at(vma->vm_mm, vmf->address, + vmf->pte, + pte_clear_uffd_wp(*vmf->pte)); + pte_unmap_unlock(vmf->pte, vmf->ptl); + return 0; + } pte_unmap_unlock(vmf->pte, vmf->ptl); return handle_userfault(vmf, VM_UFFD_WP); } @@ -4812,8 +4824,21 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf) if (vma_is_anonymous(vmf->vma)) { if (likely(!unshare) && - userfaultfd_huge_pmd_wp(vmf->vma, vmf->orig_pmd)) - return handle_userfault(vmf, VM_UFFD_WP); + userfaultfd_huge_pmd_wp(vmf->vma, vmf->orig_pmd)) { + if (userfaultfd_wp_async(vmf->vma)) { + set_pmd_at(vmf->vma->vm_mm, vmf->address, + vmf->pmd, + pmd_clear_uffd_wp(*vmf->pmd)); + return 0; + } else { + return handle_userfault(vmf, VM_UFFD_WP); + } + } return do_huge_pmd_wp_page(vmf); } -- BR, Muhammad Usama Anjum --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/x-patch; charset=UTF-8; name="0000-cover-letter.patch" Content-Disposition: attachment; filename="0000-cover-letter.patch" Content-Transfer-Encoding: base64 RnJvbSA3NzRlM2NkMmU2N2Y1ZTk0Zjk5OTRhNzVhYWMzYTNlMTNjY2Q2ZGViIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNdWhhbW1hZCBVc2FtYSBBbmp1bSA8dXNhbWEuYW5q dW1AY29sbGFib3JhLmNvbT4KRGF0ZTogRnJpLCAyNyBKYW4gMjAyMyAxMTo0Mjo1MyArMDUw MApTdWJqZWN0OiBbUEFUQ0ggV0lQIHY5IDAvNF0gSW1wbGVtZW50IElPQ1RMIHRvIGdldCBh bmQvb3IgdGhlIGNsZWFyIGluZm8gYWJvdXQKIFBURXMKCipDaGFuZ2VzIGluIHY5OioKLSBG aXggYnVpbGQgd2FybmluZ3MgYW5kIGVycm9ycyB3aGljaCB3ZXJlIGhhcHBlbmluZyBvbiBz b21lIGNvbmZpZ3MKLSBTaW1wbGlmeSBwYWdlbWFwIGlvY3RsJ3MgY29kZQoKKkNoYW5nZXMg aW4gdjg6KgotIFVwZGF0ZSB1ZmZkIGFzeW5jIHdwIGltcGxlbWVudGF0aW9uCi0gSW1wcm92 ZSBQQUdFTUFQX0lPQ1RMIGltcGxlbWVudGF0aW9uCgoqQ2hhbmdlcyBpbiB2NzoqCi0gQWRk IHVmZmQgd3AgYXN5bmMKLSBVcGRhdGUgdGhlIElPQ1RMIHRvIHVzZSB1ZmZkIHVuZGVyIHRo ZSBob29kIGluc3RlYWQgb2Ygc29mdC1kaXJ0eQogIGZsYWdzCg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HMKCiBmcy9wcm9jL3Rhc2tfbW11LmMgICAgICAgICAgICAgICAgICAg ICAgICAgfCAyODMgKysrKysrKwogZnMvdXNlcmZhdWx0ZmQuYyAgICAgICAgICAgICAgICAg ICAgICAgICAgIHwgIDIxICsKIGluY2x1ZGUvbGludXgvdXNlcmZhdWx0ZmRfay5oICAgICAg ICAgICAgICB8ICAxNyArCiBpbmNsdWRlL3VhcGkvbGludXgvZnMuaCAgICAgICAgICAgICAg ICAgICAgfCAgNTAgKysKIGluY2x1ZGUvdWFwaS9saW51eC91c2VyZmF1bHRmZC5oICAgICAg ICAgICB8ICAgOCArLQogbW0vbWVtb3J5LmMgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHwgIDI5ICstCiBtbS91c2VyZmF1bHRmZC5jICAgICAgICAgICAgICAgICAgICAgICAg ICAgfCAgNDAgKy0KIHRvb2xzL2luY2x1ZGUvdWFwaS9saW51eC9mcy5oICAgICAgICAgICAg ICB8ICA1MCArKwogdG9vbHMvdGVzdGluZy9zZWxmdGVzdHMvdm0vLmdpdGlnbm9yZSAgICAg IHwgICAxICsKIHRvb2xzL3Rlc3Rpbmcvc2VsZnRlc3RzL3ZtL01ha2VmaWxlICAgICAgICB8 ICAgNSArLQogdG9vbHMvdGVzdGluZy9zZWxmdGVzdHMvdm0vcGFnZW1hcF9pb2N0bC5jIHwg ODgwICsrKysrKysrKysrKysrKysrKysrKwogMTEgZmlsZXMgY2hhbmdlZCwgMTM2NCBpbnNl cnRpb25zKCspLCAyMCBkZWxldGlvbnMoLSkKIGNyZWF0ZSBtb2RlIDEwMDY0NCB0b29scy90 ZXN0aW5nL3NlbGZ0ZXN0cy92bS9wYWdlbWFwX2lvY3RsLmMKCi0tIAoyLjMwLjIKCg== --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/x-patch; charset=UTF-8; name="0001-userfaultfd-Add-UFFD-WP-Async-support.patch" Content-Disposition: attachment; filename="0001-userfaultfd-Add-UFFD-WP-Async-support.patch"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kpIHsKKwkJCWlmICh1c2VyZmF1bHRmZF93cF9hc3luYyh2 bWYtPnZtYSkpIHsKKwkJCQkvKgorCQkJCSAqIE5vdGhpbmcgbmVlZGVkIChjYWNoZSBmbHVz aCwgVExCIGludmFsaWRhdGlvbnMsCisJCQkJICogZXRjLikgYmVjYXVzZSB3ZSdyZSBvbmx5 IHJlbW92aW5nIHRoZSB1ZmZkLXdwIGJpdCwKKwkJCQkgKiB3aGljaCBpcyBjb21wbGV0ZWx5 IGludmlzaWJsZSB0byB0aGUgdXNlci4gVGhpcworCQkJCSAqIGZhbGxzIHRocm91Z2ggdG8g cG9zc2libGUgQ29XLgorCQkJCSAqLworCQkJCXNldF9wbWRfYXQodm1mLT52bWEtPnZtX21t LCB2bWYtPmFkZHJlc3MsIHZtZi0+cG1kLAorCQkJCQkgICBwbWRfY2xlYXJfdWZmZF93cCgq dm1mLT5wbWQpKTsKKwkJCQlyZXR1cm4gMDsKKwkJCX0gZWxzZSB7CisJCQkJcmV0dXJuIGhh bmRsZV91c2VyZmF1bHQodm1mLCBWTV9VRkZEX1dQKTsKKwkJCX0KKwkJfQogCQlyZXR1cm4g ZG9faHVnZV9wbWRfd3BfcGFnZSh2bWYpOwogCX0KIAotLSAKMi4zMC4yCgo= --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/x-patch; charset=UTF-8; name="0002-userfaultfd-split-mwriteprotect_range.patch" Content-Disposition: attachment; filename="0002-userfaultfd-split-mwriteprotect_range.patch" Content-Transfer-Encoding: base64 RnJvbSBlZTAzNjQ1NzQ0ZTMxMjlmYjkzMDIyYmZlYjAwM2I4OTI1MjkyM2FjIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNdWhhbW1hZCBVc2FtYSBBbmp1bSA8dXNhbWEuYW5q dW1AY29sbGFib3JhLmNvbT4KRGF0ZTogVHVlLCAzIEphbiAyMDIzIDEyOjQ4OjU5ICswNTAw ClN1YmplY3Q6IFtQQVRDSCBXSVAgd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U2FuaXRp emUgdGhlIGNvbW1hbmQgcGFyYW1ldGVyczoKKwkgKi8KKwlCVUdfT04oc3RhcnQgJiB+UEFH RV9NQVNLKTsKKwlCVUdfT04obGVuICYgflBBR0VfTUFTSyk7CisKKwkvKiBEb2VzIHRoZSBh ZGRyZXNzIHJhbmdlIHdyYXAsIG9yIGlzIHRoZSBzcGFuIHplcm8tc2l6ZWQ/ICovCisJQlVH X09OKHN0YXJ0ICsgbGVuIDw9IHN0YXJ0KTsKKworCW1tYXBfcmVhZF9sb2NrKGRzdF9tbSk7 CisKKwllcnIgPSBfX213cml0ZXByb3RlY3RfcmFuZ2UoZHN0X21tLCBzdGFydCwgbGVuLCBl bmFibGVfd3AsIG1tYXBfY2hhbmdpbmcpOworCiAJbW1hcF9yZWFkX3VubG9jayhkc3RfbW0p OwogCXJldHVybiBlcnI7CiB9Ci0tIAoyLjMwLjIKCg== --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/x-patch; charset=UTF-8; name="0003-fs-proc-task_mmu-Implement-IOCTL-to-get-and-or-the-c.patch" Content-Disposition: attachment; filename*0="0003-fs-proc-task_mmu-Implement-IOCTL-to-get-and-or-the-c.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSBmZjQ0NTNhZjMxYTA1MDRjYzA5NjQ3YmJmZmZjMTFlYWY4MGIwN2I4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNdWhhbW1hZCBVc2FtYSBBbmp1bSA8dXNhbWEuYW5q dW1AY29sbGFib3JhLmNvbT4KRGF0ZTogVHVlLCAzIEphbiAyMDIzIDEyOjUwOjIxICswNTAw ClN1YmplY3Q6IFtQQVRDSCBXSVAgdjkgMy80XSBmcy9wcm9jL3Rhc2tfbW11OiBJbXBsZW1l bnQgSU9DVEwgdG8gZ2V0IGFuZC9vcgogdGhlIGNsZWFyIGluZm8gYWJvdXQgUFRFcwoKVGhp cyBJT0NUTCwgUEFHRU1BUF9TQ0FOIG9uIH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isJX191MzIgbWF4X3BhZ2VzOwor CV9fdTMyIGZsYWdzOworCV9fdTY0IHJlcXVpcmVkX21hc2s7CisJX191NjQgYW55b2ZfbWFz azsKKwlfX3U2NCBleGNsdWRlZF9tYXNrOworCV9fdTY0IHJldHVybl9tYXNrOworfTsKKwor LyogU3BlY2lhbCBmbGFncyAqLworI2RlZmluZSBQQUdFTUFQX1dQX0VOR0FHRQkoMSA8PCAw KQorCiAjZW5kaWYgLyogX1VBUElfTElOVVhfRlNfSCAqLwotLSAKMi4zMC4yCgo= --------------YDczPGnNMYCbOh0mtE2Xi30f Content-Type: text/x-patch; charset=UTF-8; name="0004-selftests-vm-add-pagemap-ioctl-tests.patch" Content-Disposition: attachment; filename="0004-selftests-vm-add-pagemap-ioctl-tests.patch" Content-Transfer-Encoding: base64 RnJvbSA3NzRlM2NkMmU2N2Y1ZTk0Zjk5OTRhNzVhYWMzYTNlMTNjY2Q2ZGViIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNdWhhbW1hZCBVc2FtYSBBbmp1bSA8dXNhbWEuYW5q dW1AY29sbGFib3JhLmNvbT4KRGF0ZTogVHVlLCAyNCBKYW4gMjAyMyAxMzozNjoyMyArMDUw MApTdWJqZWN0OiBbUEFUQ0ggV0lQIHY5IDQvNF0gc2VsZnRlc3RzOiB2bTogYWRkIHBhZ2Vt YXAgaW9jdGwgdGVzdHMKCkFkZCBwYWdlbWFwIGlvY3RsIHRlc3RzLiBBZGQgc2V2ZXJhbCBk aWZmZXJlbnQgdHlwZXMgb2YgdGVzdHMgdG8ganVkZ2UKdGhlIGNvcnJlY3Rpb24gb2YgdGhl IGludGVyZmFjZS4KClNpZ25lZC1vZmYtYnk6IE11aGFtbWFkIFVzYW1hIEFuanVtIDx1c2Ft YS5hbmp1bUBjb2xsYWJvcmEuY29tPgotLS0KQ2hhZ2VzIGluIHY3OgotIEFkZCBhbmQgdXBk YXRlIGFsbCB0ZXN0IGNhc2VzCgpDaGFuZ2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