From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA80DC433ED for ; Tue, 18 May 2021 20:57:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F58861028 for ; Tue, 18 May 2021 20:57:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F58861028 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9C21D8E0055; Tue, 18 May 2021 16:57:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 971EF8E002F; Tue, 18 May 2021 16:57:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7ED918E0055; Tue, 18 May 2021 16:57:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 4B57E8E002F for ; Tue, 18 May 2021 16:57:23 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D72C08249980 for ; Tue, 18 May 2021 20:57:22 +0000 (UTC) X-FDA: 78155562324.25.A027780 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 1F2F94080F47 for ; Tue, 18 May 2021 20:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621371441; 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=6CktfC1f25HhOIljJc9q5zTejG+pTMtIeU+4rsojDgs=; b=L/mPw2dsQ0Tsp46zlokOln6Bow8Msk1/UB+1eyhragqHDfnA9Q9mA42zvaV38OsHmwulNA uTps6SSyUFHSVAj5dErcxfCWiRpSPc4x3byg7KAisHYpTq0cDmE9cdd8SokQtUojZLf8fn 4RWwjoMGTHftAv2Nqu+Gy0CMlYeVnmQ= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-HpQHEJX0MeCFg7hlYpe83Q-1; Tue, 18 May 2021 16:57:17 -0400 X-MC-Unique: HpQHEJX0MeCFg7hlYpe83Q-1 Received: by mail-qt1-f199.google.com with SMTP id v13-20020ac8578d0000b02901e4f5d48831so8289961qta.14 for ; Tue, 18 May 2021 13:57:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=os9Jf6J1kMn1gZUBBCbgzerMPhCA2LxWWK/nSdgqiLA=; b=lzM+YY24he7lccL1UIKC2P6cyXhjEeFpJlUwRCdBFx0Zl+N5Soa16iZTZqtdrLT7vw a1onl48sA75ntZJSIqtlSTs6emm9Yv9toRGgnzX9HSmSjWEfBTMfthi15ZTU4fynl9Xv dEPe+SD1VGd6+3dkGDi+vCGi0hqAkVk6S5e/vzwjBLPYwF8X7aLeGz+kpJDJbSCDV4Be lUWwB5OPIywJPdKKt1tgtrWhFa35PFZhDofMMRDrZ9zF/XZI7yMOTC3/mdYif/Wbx2il tjvWgc0TphEqnYjDAeDuv0TtIZaUCpZhzvDWOvB1xjH1lAqOXsSXdha+DWrfVrZT10Ct 9KHA== X-Gm-Message-State: AOAM532ff5OW6ZCDSQLv7V2p1JTn/WMiAPxqxSM149m/+2PrIqAs0JHY F2qR0rcp3ZZKiyKEBaW8yN3/YlN2MVTEIMSN54Ox+O8zWz6m+lHnT/B5MEfQ08HoeYkuVRfuCoT woyOHIhHmqEI= X-Received: by 2002:a0c:fd44:: with SMTP id j4mr8481116qvs.12.1621371437468; Tue, 18 May 2021 13:57:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPbtPTS7GA1DjU4twlKSNhyrANpoU7alV6mW8IiMGHJyAqzzJ6TCOkFpMmZKf7mBAGJ5Mb2g== X-Received: by 2002:a0c:fd44:: with SMTP id j4mr8481084qvs.12.1621371437207; Tue, 18 May 2021 13:57:17 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id 64sm2637797qkn.87.2021.05.18.13.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 13:57:16 -0700 (PDT) Date: Tue, 18 May 2021 16:57:14 -0400 From: Peter Xu To: Axel Rasmussen , Andrew Morton Cc: Alexander Viro , Andrea Arcangeli , Andrew Morton , Hugh Dickins , Jerome Glisse , Joe Perches , Lokesh Gidra , Mike Kravetz , Mike Rapoport , Shaohua Li , Shuah Khan , Stephen Rothwell , Wang Qing , linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, Brian Geffon , "Dr . David Alan Gilbert" , Mina Almasry , Oliver Upton Subject: Re: [PATCH v5 09/10] userfaultfd/selftests: reinitialize test context in each test Message-ID: References: <20210427225244.4326-1-axelrasmussen@google.com> <20210427225244.4326-10-axelrasmussen@google.com> MIME-Version: 1.0 In-Reply-To: <20210427225244.4326-10-axelrasmussen@google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="D6+R1HeMtL7GYPqG" Content-Disposition: inline Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="L/mPw2ds"; spf=none (imf02.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1F2F94080F47 X-Stat-Signature: ex3hby6d7chzrnnycw1hcia8perx17ye X-HE-Tag: 1621371441-270166 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --D6+R1HeMtL7GYPqG Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Tue, Apr 27, 2021 at 03:52:43PM -0700, Axel Rasmussen wrote: > Currently, the context (fds, mmap-ed areas, etc.) are global. Each test > mutates this state in some way, in some cases really "clobbering it" > (e.g., the events test mremap-ing area_dst over the top of area_src, or > the minor faults tests overwriting the count_verify values in the test > areas). We run the tests in a particular order, each test is careful to > make the right assumptions about its starting state, etc. > > But, this is fragile. It's better for a test's success or failure to not > depend on what some other prior test case did to the global state. > > To that end, clear and reinitialize the test context at the start of > each test case, so whatever prior test cases did doesn't affect future > tests. > > This is particularly relevant to this series because the events test's > mremap of area_dst screws up assumptions the minor fault test was > relying on. This wasn't a problem for hugetlb, as we don't mremap in > that case. > > Signed-off-by: Axel Rasmussen Hi, Andrew, There's a conflict on the uffd test case with v5.13-rc1-mmots-2021-05-13-17-23 between this patch and the uffd pagemap series, so I think we may need to queue another fixup patch (to be squashed into this patch of Axel's) which is attached. Thanks, -- Peter Xu --D6+R1HeMtL7GYPqG Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-fixup-userfaultfd-selftests-reinitialize-test-contex.patch" >From 745402175cc5670475df8e6c6bd03b6268f4175d Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 18 May 2021 16:50:36 -0400 Subject: [PATCH] fixup! userfaultfd/selftests: reinitialize test context in each test Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index c4150b4fbd17..f78816130c7f 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1326,7 +1326,7 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize) /* Flush so it doesn't flush twice in parent/child later */ fflush(stdout); - uffd_test_ops->release_pages(area_dst); + uffd_test_ctx_init(0); if (test_pgsize > page_size) { /* This is a thp test */ @@ -1338,9 +1338,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize) err("madvise(MADV_NOHUGEPAGE) failed"); } - if (userfaultfd_open(0)) - err("userfaultfd_open"); - uffdio_register.range.start = (unsigned long) area_dst; uffdio_register.range.len = nr_pages * page_size; uffdio_register.mode = UFFDIO_REGISTER_MODE_WP; @@ -1383,7 +1380,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize) pagemap_check_wp(value, false); close(pagemap_fd); - close(uffd); printf("done\n"); } -- 2.31.1 --D6+R1HeMtL7GYPqG--