Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1054893rwb; Wed, 7 Dec 2022 08:07:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sLmGNSSZRoSi0tovJuKTjFGxElXRxiM4b3Y6oRUeCDKZuzR6hds9COr6Q8FXYe7cT3RBa X-Received: by 2002:a17:906:bce9:b0:7ad:960d:3a4d with SMTP id op9-20020a170906bce900b007ad960d3a4dmr58551371ejb.522.1670429246467; Wed, 07 Dec 2022 08:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670429246; cv=none; d=google.com; s=arc-20160816; b=xCXd3PAmguHQLKy/MFDIgN9q4HpPmYv754To0TAm6oa51hsnlbIPcMFyx2vSdScrx0 DfTqwkRViTa6wxIlArbexy7BvCMKYtRNoua1gPWPOvHEn+sDL8FjlL+ep2hbE1UO814K +v0ROb+JXtLhEFKTawy/OhwVrdfJdpMg2oB5YNsZ172RjTbE0HSePJEp3xoMWKUSvD8t 0VEnH9J3tZ2Eul/hGEXOst8CFi28qm6YwdbMqVpb7SvcxNjF0XNHy1S1PVykIsO4+w1a ytzZXpAWqeJiYcZNbA4HG0W41oe7GsGrsIhtDiRmlAnOPcbvnCZ5N93/hbtdjKMxzyPC vV9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:subject:organization:from:references :cc:to:content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=2nI23qKURDk6eVp9CxCt+uXO/ZCpFRupAOr1zW0mjEQ=; b=xcSVv9wl0HhXpCxNXwEZQqCByQll7v+COxFQVPFzskFDVdlg9L71g8bfEJO5u8u2JY rjLSQ/d5k+UGuYOAulGhg7LGUW8ymbtzMLW/fm7Kg7u9bixpAPf2yR86mUlgMmD11i1O WTiA9Cn59365Ukx20SmVt+K34T895CMl03NP4gSPmnfOFhIvuboGL/PBO0cOmqO7/7rx OfEvxIqnoBNw0eHhDPOfC7Y26+WxjVT3aTqf4/nbxaKtXxVRskCe1oHzbvEtVXVKTqwZ Cv9GtTVyOVXThtlYh9GfvcmeZ8HaGzqDNhGZW8PrUtJa5baBFqFYJMbBy+ihrL3SZ97h LC2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J81LOcO4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp32-20020a1709073e2000b0078333d9f17bsi18245633ejc.819.2022.12.07.08.07.03; Wed, 07 Dec 2022 08:07:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J81LOcO4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbiLGPdW (ORCPT + 76 others); Wed, 7 Dec 2022 10:33:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbiLGPdT (ORCPT ); Wed, 7 Dec 2022 10:33:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3408B61BA7 for ; Wed, 7 Dec 2022 07:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670427143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2nI23qKURDk6eVp9CxCt+uXO/ZCpFRupAOr1zW0mjEQ=; b=J81LOcO4YQvvcc74lkcamCDyNGXfefxlish7frtKgXbxjyvihyKW4FPAnspMty5g+O93JG ZAKQAv9vpmZvGbuX7sIDDuyT04zC3sZdss+HbezrsabSJrv7GJhj8fCnmX4sIVpfAF03+6 9a0y9hKzXjInNZ45TgNm3ZEkgTSlFSQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-36-elHAN870Nqq3xSEOuZMBQA-1; Wed, 07 Dec 2022 10:32:22 -0500 X-MC-Unique: elHAN870Nqq3xSEOuZMBQA-1 Received: by mail-wr1-f71.google.com with SMTP id o10-20020adfa10a000000b00241f603af8dso4348257wro.11 for ; Wed, 07 Dec 2022 07:32:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:subject:organization:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2nI23qKURDk6eVp9CxCt+uXO/ZCpFRupAOr1zW0mjEQ=; b=ENjceEj+1u1l8R7bXQt7GyL4shkialeJVSj1jUkwgXkcm56wiL3QroFBuHCM/LUN62 jY71x4Om9VczGspBPWkc354DeC/XAf4n8GNzPqr/2+dKamdsOT5W+XtaG+RO97Ex/Zg/ b33ISQR1JYwOnsO3gmhZ3ae8LuP0z0BSYJ5DDEatK6OgDfx3bXNtgzXR+e9J9lNdqGgL Yeeo+cmlTTlsyPv5NMFv2K6P019U4rqDny6qcYCIqfbSAjzk8YW5o9M3tzECquuQesEL pfESQhF589hyTlCIftSTb+8NFr1rlcYzBOm9cM/6i1NGHjh+S1ll46uKboi+AZP5Y/t1 V4Rw== X-Gm-Message-State: ANoB5plWCJN7LZevOjjMjUVvMEyamZft27OH0Kddip4ISpxNh06o83HP QbZYYVDFwGXmJKOH0K1aG979mPhC2xp+tJlb+iRc7Keo5ZwrTYeysg9rh1krZ36ZtzclEmIgAEm qPe9JxvAXTLb1bHrjUj9DqDa2 X-Received: by 2002:a1c:7401:0:b0:3cf:934b:b7ad with SMTP id p1-20020a1c7401000000b003cf934bb7admr53987907wmc.22.1670427139423; Wed, 07 Dec 2022 07:32:19 -0800 (PST) X-Received: by 2002:a1c:7401:0:b0:3cf:934b:b7ad with SMTP id p1-20020a1c7401000000b003cf934bb7admr53987890wmc.22.1670427139005; Wed, 07 Dec 2022 07:32:19 -0800 (PST) Received: from ?IPV6:2003:cb:c702:2500:fe2d:7534:ffa4:c1e5? (p200300cbc7022500fe2d7534ffa4c1e5.dip0.t-ipconnect.de. [2003:cb:c702:2500:fe2d:7534:ffa4:c1e5]) by smtp.gmail.com with ESMTPSA id i2-20020adff302000000b002421a8f4fa6sm19595033wro.92.2022.12.07.07.32.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Dec 2022 07:32:18 -0800 (PST) Content-Type: multipart/mixed; boundary="------------goKdyuB03uIJj0avVFOrEX4v" Message-ID: Date: Wed, 7 Dec 2022 16:32:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US To: Peter Xu , Hugh Dickins Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ives van Hoorne , Andrew Morton , Hugh Dickins , Alistair Popple , Mike Rapoport , Nadav Amit , Andrea Arcangeli References: <20221202122748.113774-1-david@redhat.com> <690afe0f-c9a0-9631-b365-d11d98fdf56f@redhat.com> <19800718-9cb6-9355-da1c-c7961b01e922@redhat.com> <92173bad-caa3-6b43-9d1e-9a471fdbc184@redhat.com> <22d8e8ac-d75-a66-2650-b4d59f89855e@google.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH RFC] mm/userfaultfd: enable writenotify while userfaultfd-wp is enabled for a VMA In-Reply-To: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------goKdyuB03uIJj0avVFOrEX4v Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > > David, would you please repost a new patch for this one and copy Ives to > make sure it'll work for him in his systems? Yes, will do. I think has was already cc'ed. > > I'd suggest to drop the mprotect example, I'll reply later on that to the > other email but I still don't know whether it's a good example for a reader > to understand the problem. Yes, can do. > > No reproducer needed for numa I think - I guess Ives's test case would be > far enough to verify it if possible. I also hope what Ives saw was the > numa balancing issue you reported, so maybe it'll resolve all problem he > has. Then with that verified and queued we can drop the mm/migrate patch. I tried writing a numa hinting reproducer, but so far I assume that it's with current code not (easily) possible for shmem. We'd have to call change_prot_numa() in order to protnone these PTEs. That can either happen via a) mbind() with MPOL_MF_LAZY. However, user space is currently not able to set that flag (dead code ...). b) task_numa_work(). However, vma_policy_mof() seems to always fail on shmem and prevent us from reaching that code. Reason is that shmem implements vm_ops->get_policy, and it seems to be impossible to get MPOL_F_MOF set. At least I haven't found an easy way or I am missing something. So numa hinting might not immediately explain the lost write faults. ... but are there other ways to reach do_numa_page(), even without active NUMA hinting? I found at least one: map = mmap(NULL, size, PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0); memset(map, 0, size); uffd_wp_range(map, size); On upstream during the next write fault, we'll end up in do_numa_page() and simply remap the page writable due to vm_page_prot, not triggering a write fault. I can see the "numa_hint_faults" counter in /proc/vmstat increasing accordingly, so we're really in do_numa_page(). PROT_WRITE on shmem with uffd-wp is completely non-functional as it seems. It seems to work with anon memory. And with my patch, it also works with shmem. Attaching a simple reproducer (uffd-wp-prot-write.c). Independent of uffd-wp on shmem, we seem to be missing propagating the uffd-wp bit when splitting the huge zeropage. So uffd-wp'ing the huge zeropage and then splitting it loses the uffd-wp markers. :/ Fix seems easy and I just tested my possible fix. Attaching a simple reproducer (uffd-wp-huge-zero.c). -- Thanks, David / dhildenb --------------goKdyuB03uIJj0avVFOrEX4v Content-Type: text/x-csrc; charset=UTF-8; name="uffd-wp-prot-write.c" Content-Disposition: attachment; filename="uffd-wp-prot-write.c" Content-Transfer-Encoding: base64 I2RlZmluZSBfR05VX1NPVVJDRQojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxp Yi5oPgojaW5jbHVkZSA8c3RkaW50Lmg+CiNpbmNsdWRlIDxzdGRib29sLmg+CiNpbmNsdWRl IDxpbnR0eXBlcy5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxmY250bC5oPgoj aW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8cG9sbC5o PgojaW5jbHVkZSA8cHRocmVhZC5oPgojaW5jbHVkZSA8c3lzL21tYW4uaD4KI2luY2x1ZGUg PHN5cy9zeXNjYWxsLmg+CiNpbmNsdWRlIDxzeXMvaW9jdGwuaD4KI2luY2x1ZGUgPGxpbnV4 L21lbWZkLmg+CiNpbmNsdWRlIDxsaW51eC91c2VyZmF1bHRmZC5oPgoKc3RhdGljIHNpemVf dCBwYWdlc2l6ZTsKc3RhdGljIGludCB1ZmZkOwpzdGF0aWMgaW50IHBhZ2VtYXBfZmQ7Cgoj ZGVmaW5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WQpIHsKCQkJcHJpbnRmKCJGQUlMOiB1 ZmZkLXdwIGRpZCBub3QgdHJpZ2dlclxuIik7CgkJCXJldHVybiAxOwoJCX0KCX0KCglwcmlu dGYoIlBBU1M6IHVmZmQtd3AgdHJpZ2dlcmVkXG4iKTsKCXJldHVybiAwOwp9Cg== --------------goKdyuB03uIJj0avVFOrEX4v Content-Type: text/x-csrc; charset=UTF-8; name="uffd-wp-huge-zero.c" Content-Disposition: attachment; filename="uffd-wp-huge-zero.c" Content-Transfer-Encoding: base64 I2RlZmluZSBfR05VX1NPVVJDRQojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxp Yi5oPgojaW5jbHVkZSA8c3RkaW50Lmg+CiNpbmNsdWRlIDxzdGRib29sLmg+CiNpbmNsdWRl IDxpbnR0eXBlcy5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxmY250bC5oPgoj aW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8cG9sbC5o PgojaW5jbHVkZSA8cHRocmVhZC5oPgojaW5jbHVkZSA8c3lzL21tYW4uaD4KI2luY2x1ZGUg PHN5cy9zeXNjYWxsLmg+CiNpbmNsdWRlIDxzeXMvaW9jdGwuaD4KI2luY2x1ZGUgPGxpbnV4 L21lbWZkLmg+CiNpbmNsdWRlIDxsaW51eC91c2VyZmF1bHRmZC5oPgoKc3RhdGljIHNpemVf dCBwYWdlc2l6ZTsKc3RhdGljIGludCB1ZmZkOwpzdGF0aWMgaW50IHBhZ2VtYXBfZmQ7Cgoj ZGVmaW5lIFNJWkUgKDEyOCoxMDI0KjEwMjR1bGwpCiNkZWZpbmUgYmFycmllcigpIF9fYXNt X18gX192b2xhdGlsZV9fKCIiOiA6IDoibWVtb3J5IikKCnZvbGF0aWxlIGJvb2wgdWZmZF90 cmlnZ2VyZWQ7CgpzdGF0aWMgdm9pZCB1ZmZkX3dwX3JhbmdlKGN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