Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp848224rdb; Wed, 6 Dec 2023 01:21:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiTMzP8kjwnX+2OkC1kTvdAI9zxwFXL1FfbuW02VkiI1HGA+Z9R1GleAqO7fR5UpjAj94A X-Received: by 2002:a05:6871:4082:b0:1f9:50f5:a8c with SMTP id kz2-20020a056871408200b001f950f50a8cmr560730oab.35.1701854500727; Wed, 06 Dec 2023 01:21:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701854500; cv=none; d=google.com; s=arc-20160816; b=iHnV1cMLUsLcMxSsIYyN+flFhdRVbqhHOvAMTIQ3ChTIu/ecSqO2o3ReuttyuRbODt SoLTS3M4fk7CpfFqOHwI2m2bd4h2cvIy6dYkiqtpHFAVwdLbxk9pctKSewCb3iIy9tqi LKushmbyi+ZVQFnt9oPHC8+IHBBGmXDdcC5A4g30aTSAOGJbLGUPNKUnK1RfuTDo6B82 DR1ijmAfTTc8CXh92Ua9qwcHeJ+2CE9RpmqB8RQmte9mrxfIh7Dll8Iws/hcCBB30z9w dLNG+DWIbgq68O6dUGUgI7B86UryOIOjyxLsWGuAXPloMycg5uqjQEPuOaiLsqFGXhf8 4/ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=C15e7/LIYcrGWdbNEaRKjqFcMT5GroD4qDzg3I8vY9E=; fh=qjl3MieVwWhdZ3DAt1zsSuxfMhp9fB41mk+/Y3t9Y0s=; b=eezFZMNT5bTOIBo/00qifrhnm5cwqVh19tDYNakBwbuDoZL2FPtoz6PD5Na9xYY/kh qsl6+6vmXfHWy4nrtheiu7+ISVRMKzRm32OvDYggEz/eBWv9DvPYbExKFQEqL1EoMqNi fYVho28UyVkcLzSBApZpGX6Ex9ewu/2ANmiDuvkSkNMIpDBm8S6LtEJxdidwOIRaSG6d 55uw2TnJAKocUoaIHmMhI9h/YMgDBJzCTe1njRm/+N+gieFUS3+Qnsusx4SxUG5g3Z4R WTdKCkHq/hS6xiSvjYbOa4/maj+LPjPhZQIGSiB1tv2cSZrbmGV6BSZ5RnxwzO0/EQod hRvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bW4qtMBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id g14-20020a63564e000000b005c1b289757dsi11068864pgm.88.2023.12.06.01.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:21:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bW4qtMBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 044D78247765; Wed, 6 Dec 2023 01:21:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235178AbjLFJVS (ORCPT + 99 others); Wed, 6 Dec 2023 04:21:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjLFJVQ (ORCPT ); Wed, 6 Dec 2023 04:21:16 -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 71BAA1BDA for ; Wed, 6 Dec 2023 01:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701854481; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=C15e7/LIYcrGWdbNEaRKjqFcMT5GroD4qDzg3I8vY9E=; b=bW4qtMBDWM6tXQeTlPIYnSvWHOMkWfXtRyQbRk3sqGJKhCmfKGIYaw//u17MNfDJ5+y88h l/h3QpWkBi4ZbAdwKY8RFPaA6S5T2kpW4LA1r+LWGe8nStf19YG+ieAWZydAavzXiige7e eDhBApEeacxxo005zYJelTovkZHql00= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-h0GcTty3MZqkASa7xIKW-g-1; Wed, 06 Dec 2023 04:21:20 -0500 X-MC-Unique: h0GcTty3MZqkASa7xIKW-g-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-332e2f70092so539575f8f.0 for ; Wed, 06 Dec 2023 01:21:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701854479; x=1702459279; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=C15e7/LIYcrGWdbNEaRKjqFcMT5GroD4qDzg3I8vY9E=; b=WjqSsyj20/dg/AQqxM4Ce0bAV78wM5IO0JCnT2FZ74T7dqd9UukGYJqNqwbRgL9NXG KKjkLb6iebByyRJ9pU7iVRyiqYxciBHDBGsol4jmI26GS8lPN1iZ4i0McOgHVyPoeiKa ZXy+C/C4Eu5MgpF8jrQ/Bzfg5SL4BFSlzxAFVXgjue9lafuDSx/wXjHhxxaIxTohz9cp fRuZfF/zgRuqgriKXUfmDld5/96CcpPkTE98kVsLVCf9d/CE0C2B1HdmHzwmfG5nQhcW PrXQKXXr70EFpUQaAlkA+k2EdVSXzbDHl+5f3oZGdq8zAMNG0EJUod433DZwJWQKUtLF BWEA== X-Gm-Message-State: AOJu0YyJ4CsYRD49bBYgfM+omFinUWHtpjCg2AkegzRfrO/Dh9/yBpSg nzpEoghHBMj8/lGP3AnTCmiPA1hNvcWS45Nyu43d0DXcm+1aN6QRfGXcQcyJ30erIYJ9KF0Q7E0 m7Tr5JHnA14TUwYlSCPlV+Wp3 X-Received: by 2002:a5d:6a0a:0:b0:333:1d9c:c34b with SMTP id m10-20020a5d6a0a000000b003331d9cc34bmr291841wru.41.1701854479089; Wed, 06 Dec 2023 01:21:19 -0800 (PST) X-Received: by 2002:a5d:6a0a:0:b0:333:1d9c:c34b with SMTP id m10-20020a5d6a0a000000b003331d9cc34bmr291831wru.41.1701854478657; Wed, 06 Dec 2023 01:21:18 -0800 (PST) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id g7-20020a5d4887000000b003335ebde680sm2792854wrq.75.2023.12.06.01.21.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 01:21:18 -0800 (PST) Message-ID: <3ba0015b-b36e-449a-8445-0f6272694db5@redhat.com> Date: Wed, 6 Dec 2023 10:21:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 5/5] selftests/mm: add UFFDIO_MOVE ioctl test Content-Language: en-US To: Suren Baghdasaryan Cc: Ryan Roberts , akpm@linux-foundation.org, viro@zeniv.linux.org.uk, brauner@kernel.org, shuah@kernel.org, aarcange@redhat.com, lokeshgidra@google.com, peterx@redhat.com, hughd@google.com, mhocko@suse.com, axelrasmussen@google.com, rppt@kernel.org, willy@infradead.org, Liam.Howlett@oracle.com, jannh@google.com, zhangpeng362@huawei.com, bgeffon@google.com, kaleshsingh@google.com, ngeoffray@google.com, jdduke@google.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com References: <20231121171643.3719880-1-surenb@google.com> <20231121171643.3719880-6-surenb@google.com> <744be4e0-48e0-4c77-825c-711386dd205f@arm.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/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IOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 01:21:37 -0800 (PST) On 05.12.23 05:46, Suren Baghdasaryan wrote: > On Mon, Dec 4, 2023 at 10:44 AM Suren Baghdasaryan wrote: >> >> On Mon, Dec 4, 2023 at 10:27 AM David Hildenbrand wrote: >>> >>> On 04.12.23 17:35, Suren Baghdasaryan wrote: >>>> On Mon, Dec 4, 2023 at 1:27 AM Ryan Roberts wrote: >>>>> >>>>> On 04/12/2023 04:09, Suren Baghdasaryan wrote: >>>>>> On Sat, Dec 2, 2023 at 2:11 AM David Hildenbrand wrote: >>>>>>> >>>>>>> On 02.12.23 09:04, Ryan Roberts wrote: >>>>>>>> On 01/12/2023 20:47, David Hildenbrand wrote: >>>>>>>>> On 01.12.23 10:29, Ryan Roberts wrote: >>>>>>>>>> On 21/11/2023 17:16, Suren Baghdasaryan wrote: >>>>>>>>>>> Add tests for new UFFDIO_MOVE ioctl which uses uffd to move source >>>>>>>>>>> into destination buffer while checking the contents of both after >>>>>>>>>>> the move. After the operation the content of the destination buffer >>>>>>>>>>> should match the original source buffer's content while the source >>>>>>>>>>> buffer should be zeroed. Separate tests are designed for PMD aligned and >>>>>>>>>>> unaligned cases because they utilize different code paths in the kernel. >>>>>>>>>>> >>>>>>>>>>> Signed-off-by: Suren Baghdasaryan >>>>>>>>>>> --- >>>>>>>>>>> tools/testing/selftests/mm/uffd-common.c | 24 +++ >>>>>>>>>>> tools/testing/selftests/mm/uffd-common.h | 1 + >>>>>>>>>>> tools/testing/selftests/mm/uffd-unit-tests.c | 189 +++++++++++++++++++ >>>>>>>>>>> 3 files changed, 214 insertions(+) >>>>>>>>>>> >>>>>>>>>>> diff --git a/tools/testing/selftests/mm/uffd-common.c >>>>>>>>>>> b/tools/testing/selftests/mm/uffd-common.c >>>>>>>>>>> index fb3bbc77fd00..b0ac0ec2356d 100644 >>>>>>>>>>> --- a/tools/testing/selftests/mm/uffd-common.c >>>>>>>>>>> +++ b/tools/testing/selftests/mm/uffd-common.c >>>>>>>>>>> @@ -631,6 +631,30 @@ int copy_page(int ufd, unsigned long offset, bool wp) >>>>>>>>>>> return __copy_page(ufd, offset, false, wp); >>>>>>>>>>> } >>>>>>>>>>> +int move_page(int ufd, unsigned long offset, unsigned long len) >>>>>>>>>>> +{ >>>>>>>>>>> + struct uffdio_move uffdio_move; >>>>>>>>>>> + >>>>>>>>>>> + if (offset + len > nr_pages * page_size) >>>>>>>>>>> + err("unexpected offset %lu and length %lu\n", offset, len); >>>>>>>>>>> + uffdio_move.dst = (unsigned long) area_dst + offset; >>>>>>>>>>> + uffdio_move.src = (unsigned long) area_src + offset; >>>>>>>>>>> + uffdio_move.len = len; >>>>>>>>>>> + uffdio_move.mode = UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES; >>>>>>>>>>> + uffdio_move.move = 0; >>>>>>>>>>> + if (ioctl(ufd, UFFDIO_MOVE, &uffdio_move)) { >>>>>>>>>>> + /* real retval in uffdio_move.move */ >>>>>>>>>>> + if (uffdio_move.move != -EEXIST) >>>>>>>>>>> + err("UFFDIO_MOVE error: %"PRId64, >>>>>>>>>>> + (int64_t)uffdio_move.move); >>>>>>>>>> >>>>>>>>>> Hi Suren, >>>>>>>>>> >>>>>>>>>> FYI this error is triggering in mm-unstable (715b67adf4c8): >>>>>>>>>> >>>>>>>>>> Testing move-pmd on anon... ERROR: UFFDIO_MOVE error: -16 (errno=16, >>>>>>>>>> @uffd-common.c:648) >>>>>>>>>> >>>>>>>>>> I'm running in a VM on Apple M2 (arm64). I haven't debugged any further, but >>>>>>>>>> happy to go deeper if you can direct. >>>>>>>>> >>>>>>>>> Does it trigger reliably? Which pagesize is that kernel using? >>>>>>>> >>>>>>>> Yep, although very occasionally it fails with EAGAIN. 4K kernel; see other email >>>>>>>> for full config. >>>>>>>> >>>>>>>>> >>>>>>>>> I can spot that uffd_move_pmd_test()/uffd_move_pmd_handle_fault() uses >>>>>>>>> default_huge_page_size(), which reads the default hugetlb size. >>>>>>>> >>>>>>>> My kernel command line is explicitly seting the default huge page size to 2M. >>>>>>>> >>>>>>> >>>>>>> Okay, so that likely won't affect it. >>>>>>> >>>>>>> I can only guess that it has to do with the alignment of the virtual >>>>>>> area we are testing with, and that we do seem to get more odd patterns >>>>>>> on arm64. >>>>>>> >>>>>>> uffd_move_test_common() is a bit more elaborate, but if we aligned the >>>>>>> src+start area up, surely "step_count" cannot be left unmodified? >>>>>>> >>>>>>> So assuming we get either an unaligned source or an unaligned dst from >>>>>>> mmap(), I am not convinced that we won't be moving areas that are not >>>>>>> necessarily fully backed by PMDs and maybe don't even fall into the VMA >>>>>>> of interest? >>>>>>> >>>>>>> Not sure if that could trigger the THP splitting issue, though. >>>>>>> >>>>>>> But I just quickly scanned that test setup, could be I am missing >>>>>>> something. It might make sense to just print the mmap'ed range and the >>>>>>> actual ranges we are trying to move. Maybe something "obvious" can be >>>>>>> observed. >>>>>> >>>>>> I was able to reproduce the issue on an Android device and after >>>>>> implementing David's suggestions to split the large folio and after >>>>>> replacing default_huge_page_size() with read_pmd_pagesize(), the >>>>>> move-pmd test started working for me. Ryan, could you please apply >>>>>> attached patches (over mm-unstable) and try the test again? >>>>> >>>>> Yep, all fixed with those patches! >>>> >>>> Great! Thanks for testing and confirming. I'll post an updated >>>> patchset later today and will ask Andrew to replace the current one >>>> with it. >>>> I'll also look into the reasons we need to split PMD on ARM64 in this >>>> test. It's good that this happened and we were able to test the PMD >>>> split path but I'm curious about the reason. It's possible my address >>>> alignment calculations are somehow incorrect. >>> >>> I only skimmed the diff briefly, but likely you also want to try >>> splitting in move_pages_pte(), if you encounter an already-pte-mapped THP. >> >> Huh, good point. I might be able to move the folio splitting code into >> pte-mapped case and do a retry after splitting. That should minimize >> the additional code required. Will do and post a new set shortly. >> Thanks! > > Was planning to post an update today but need some more time. Will try > to send it tomorrow. It would be great to have tests that cover these cases (having to PTE-map a PMD-mapped THP, and stumbling over an already-PTE-mapped one). -- Cheers, David / dhildenb