From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Hugh Dickins <hughd@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
Andrea Arcangeli <aarcange@redhat.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jason Gunthorpe <jgg@nvidia.com>,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v1 4/7] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE
Date: Thu, 20 Oct 2022 12:05:29 +0200 [thread overview]
Message-ID: <95c44cc0-31db-88cf-7296-7c18a1e7f42a@redhat.com> (raw)
In-Reply-To: <Yz8m0J+UV/O9K5Lk@x1n>
Hi Peter,
sorry for replying so late, I only managed now to get back to this patch
set.
>> Yes, I can give it a try. What I dislike about ksm_test is that it's a
>> mixture of benchmarks and test cases that have to explicitly triggered by
>> parameters. It's not a simple "run all available test cases" tests as we
>> know it. So maybe something separate (or having it as part of the uffd
>> tests) makes more sense.
>
> We can add an entry into run_vmtests.sh. That's also what current ksm_test
> does.
Right, but I kind-of don't like that way at all and would much rather do
it cleaner...
>
> Yes adding into uffd test would work too, but I do have a plan that we
> should move functional tests out of userfaultfd.c, leaving that with the
> stress test only. Not really a big deal, though.
... similar to what you want to do with userfaultfd.c
So maybe I'll just add a new test for ksm functional tests.
>
>>
>>>
>>>>
>>>> Consequently, we will no longer trigger a fake write fault and break COW
>>>> without any such side-effects.
>>>>
>>>> This is primarily a fix for KSM+userfaultfd-wp, however, the fake write
>>>> fault was always questionable. As this fix is not easy to backport and it's
>>>> not very critical, let's not cc stable.
>>>
>>> A patch to cc most of the stable would probably need to still go with the
>>> old write approach but attaching ALLOW_RETRY. But I agree maybe that may
>>> not need to bother, or a report should have arrived earlier.. The unshare
>>> approach looks much cleaner indeed.
>>
>> A fix without FAULT_FLAG_UNSHARE is not straight forward. We really don't
>> want to notify user space about write events here (because there is none).
>> And there is no way around the uffd handling in WP code without that.
>>
>> FAULT_FLAG_ALLOW_RETRY would rely on userfaultfd triggering and having to
>> resolve the WP event.
>
> Right it'll be very much a false positive, but the userspace should be fine
> with it e.g. for live snapshot we need to copy page earlier; it still won't
> stop the process from running along the way. But I agree that's not ideal.
At least the test case at hand will wait until infinitely, because there
is no handler that would allow break_cow to make progress (well, we
don't expect write events in the test :) ).
Anyhow, I don't think messing with that for stable kernels is worth the
pain / complexity / possible issues.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-10-20 10:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 14:19 [PATCH v1 0/7] mm/ksm: break_ksm() cleanups and fixes David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 1/7] selftests/vm: add test to measure MADV_UNMERGEABLE performance David Hildenbrand
2022-10-05 20:27 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 2/7] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 3/7] mm: remove VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 4/7] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE David Hildenbrand
2022-09-30 22:27 ` Andrew Morton
2022-10-01 8:13 ` David Hildenbrand
2022-10-05 20:35 ` Peter Xu
2022-10-06 9:29 ` David Hildenbrand
2022-10-06 19:04 ` Peter Xu
2022-10-20 10:05 ` David Hildenbrand [this message]
2022-09-30 14:19 ` [PATCH v1 5/7] mm/pagewalk: add walk_page_range_vma() David Hildenbrand
2022-10-05 20:42 ` Peter Xu
2022-10-06 9:35 ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 6/7] mm/ksm: convert break_ksm() to use walk_page_range_vma() David Hildenbrand
2022-10-05 21:00 ` Peter Xu
2022-10-06 9:20 ` David Hildenbrand
2022-10-06 19:28 ` Peter Xu
2022-10-21 9:11 ` David Hildenbrand
2022-10-20 8:59 ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 7/7] mm/gup: remove FOLL_MIGRATION David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=95c44cc0-31db-88cf-7296-7c18a1e7f42a@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=shuah@kernel.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).