Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2373818rwl; Thu, 30 Mar 2023 09:24:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bJWFrzYvfIcyMvC7FRSV1Cha+qoKPu3HKFKc3oFQWjIG8j1LW6BeX5ztdNSH7qrUUM7/Tf X-Received: by 2002:a17:902:aa8a:b0:1a0:4405:5787 with SMTP id d10-20020a170902aa8a00b001a044055787mr2956959plr.0.1680193441476; Thu, 30 Mar 2023 09:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680193441; cv=none; d=google.com; s=arc-20160816; b=HFO7QrisLDGw4TZqcAUbKKEZ/ZzTuyWwB+zKNudE8ZyxcSvSFs92VMBfPjHaT7By3F ZUgJdBlhDhbgZRTrBvOoDmeXhpZxf2dHBHiQVBPOMhqNurwZ/H1GTNAo8VNQB8NE5Y+a q3xxjxG4M7EVnwAxbQgVBwRAoixZrShpixWU6p5RSoaqXhscLEMtS3AYkdvBcDVSEaPU UYBmxkVdu2dvvcUru+NiQAzcUGYTfBTTbIweU7lZOyvt88qHNnHCSbKDrU20uTF3k05c lT68yEG8/x0eyObDc23LK33fJTVcfSD7T9IBwdY4i7ddw1qScyuysIHh+lef8t5vMT+U zC5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBXFNiQEy11weTKM7tK5TrNqKeG1r9RMGXvyXsqJW94=; b=ULIOsuNbEEnHOlXfKUTQ9uaokIyMRXZ1RX3dERhkLrIJEHG1ZcYJ2puQ70OHc0cLYu 5RxgpfQEb2yqF3NLQ11l/pJv/k4VOfeop93/SFZrkO6NWzSKgBVMO7wXwN4YEB4KUb39 hQcM7lB32q+k6kTa8C0uNm5B9wxrZt92xgM6povja5f8lgEMWzZhgvWkKse3hcX6Cc9V 595HmY3HaHbyKmdqGJ9RaGSoZleLqqNEzog7qBNV1hBafycjtNJQok1pCLwhltRZkF1x LoqLzPh3AoK0bsMJjhRooyaQPm4covwPuYK8Hk6M73PnkODm+5030urD5oMVYVMA6Ni0 C7ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=INhxXP8f; 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 e5-20020a17090301c500b0019e4154578esi2174785plh.76.2023.03.30.09.23.48; Thu, 30 Mar 2023 09:24:01 -0700 (PDT) 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=INhxXP8f; 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 S231781AbjC3QI2 (ORCPT + 99 others); Thu, 30 Mar 2023 12:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbjC3QIM (ORCPT ); Thu, 30 Mar 2023 12:08:12 -0400 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 393EC9ED8 for ; Thu, 30 Mar 2023 09:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680192442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yBXFNiQEy11weTKM7tK5TrNqKeG1r9RMGXvyXsqJW94=; b=INhxXP8f1TI5QgUgYh3taKeCZ8lt9qMjh4IpIoS2NOl9HmYdWQDLQvW9Zhk5Nl2n7+Yumm SdTQdwIMVlis94768jrnMBoL/qKFQ02S6C1R/n3uMTeyUEMMy4WhImoydp5gvS2SxGMxFp f8cmLBPlxdy4UJAHAJMrN1j5I7E/Wo0= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416-pSR0SseUNXe9yN5GoxU-OA-1; Thu, 30 Mar 2023 12:07:21 -0400 X-MC-Unique: pSR0SseUNXe9yN5GoxU-OA-1 Received: by mail-qv1-f69.google.com with SMTP id px9-20020a056214050900b005d510cdfc41so8511894qvb.7 for ; Thu, 30 Mar 2023 09:07:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680192440; x=1682784440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yBXFNiQEy11weTKM7tK5TrNqKeG1r9RMGXvyXsqJW94=; b=dlgrDU3ONLEs2hX1fenrWC7NYDx128PHXPiiCoezY+Yxywbi9bP+DsYr645wbGyhYm OS32yagqbB79osLPy8TJJ2QG5U2nm0t2+wy0lvg8lubsN7latLln9Ra+rjVTT1qOglEX BTVpchr9Wf+akJLEEfx22QgsZWWyXIR5j9j5I7EJV+DtzuzKq9aHb/koxVPXd0kMyXpd oj/IuUjFbABILUTQM3l+XFIy+y6Mw1TUZjXghULcfx4tJvJ+mSw/OEgCZui0m9X3B7Fi fch+Ov1dAAXWKcCyrE2REpc8YcveRpu4zmaPesUm++VnuUDHXuioW0QQPxTsfukH9Xn8 tzJQ== X-Gm-Message-State: AAQBX9fhEZvvK4rcQi9nWU1TyjfSyHDTXDW4rQSJbLxYdebYLRtSOK09 V6SXkrRVuReZdvyHQ4S5EiY3naJqAsJMXmTtqKuev//xcMf+N+M8ffnnHsaK7JybEGUuxBoyYQV cEJY6+a70OmgsZnjgE8VIK9T2 X-Received: by 2002:a05:6214:f67:b0:5e0:3825:9adb with SMTP id iy7-20020a0562140f6700b005e038259adbmr3997365qvb.2.1680192440538; Thu, 30 Mar 2023 09:07:20 -0700 (PDT) X-Received: by 2002:a05:6214:f67:b0:5e0:3825:9adb with SMTP id iy7-20020a0562140f6700b005e038259adbmr3997336qvb.2.1680192440324; Thu, 30 Mar 2023 09:07:20 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id pr23-20020a056214141700b005dd8b934579sm5514594qvb.17.2023.03.30.09.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 09:07:19 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Andrew Morton , Andrea Arcangeli , peterx@redhat.com, Axel Rasmussen , Mike Kravetz , Leonardo Bras Soares Passos , Mike Rapoport , Nadav Amit Subject: [PATCH 11/29] selftests/mm: Drop test_uffdio_zeropage_eexist Date: Thu, 30 Mar 2023 12:07:17 -0400 Message-Id: <20230330160717.3107010-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230330155707.3106228-1-peterx@redhat.com> References: <20230330155707.3106228-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 The idea was trying to flip this var in the alarm handler from time to time to test -EEXIST of UFFDIO_ZEROPAGE, but firstly it's only used in the zeropage test so probably only used once, meanwhile we passed "retry==false" so it'll never got tested anyway. Drop both sides so we always test UFFDIO_ZEROPAGE retries if has_zeropage is set (!hugetlb). One more thing to do is doing UFFDIO_REGISTER for the alias buffer too, because otherwise the test won't even pass! We were just lucky that this test never really got ran at all. Signed-off-by: Peter Xu --- tools/testing/selftests/mm/userfaultfd.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/mm/userfaultfd.c b/tools/testing/selftests/mm/userfaultfd.c index d724f1c78847..3487ec0bfcc8 100644 --- a/tools/testing/selftests/mm/userfaultfd.c +++ b/tools/testing/selftests/mm/userfaultfd.c @@ -88,7 +88,6 @@ static bool test_dev_userfaultfd; /* exercise the test_uffdio_*_eexist every ALARM_INTERVAL_SECS */ #define ALARM_INTERVAL_SECS 10 static volatile bool test_uffdio_copy_eexist = true; -static volatile bool test_uffdio_zeropage_eexist = true; /* Whether to test uffd write-protection */ static bool test_uffdio_wp = true; /* Whether to test uffd minor faults */ @@ -1114,7 +1113,7 @@ static void retry_uffdio_zeropage(int ufd, } } -static int __uffdio_zeropage(int ufd, unsigned long offset, bool retry) +static int __uffdio_zeropage(int ufd, unsigned long offset) { struct uffdio_zeropage uffdio_zeropage; int ret; @@ -1138,11 +1137,8 @@ static int __uffdio_zeropage(int ufd, unsigned long offset, bool retry) if (res != page_size) { err("UFFDIO_ZEROPAGE unexpected size"); } else { - if (test_uffdio_zeropage_eexist && retry) { - test_uffdio_zeropage_eexist = false; - retry_uffdio_zeropage(ufd, &uffdio_zeropage, - offset); - } + retry_uffdio_zeropage(ufd, &uffdio_zeropage, + offset); return 1; } } else @@ -1153,7 +1149,7 @@ static int __uffdio_zeropage(int ufd, unsigned long offset, bool retry) static int uffdio_zeropage(int ufd, unsigned long offset) { - return __uffdio_zeropage(ufd, offset, false); + return __uffdio_zeropage(ufd, offset); } /* exercise UFFDIO_ZEROPAGE */ @@ -1177,6 +1173,13 @@ static int userfaultfd_zeropage_test(void) assert_expected_ioctls_present( uffdio_register.mode, uffdio_register.ioctls); + if (area_dst_alias) { + /* Needed this to test zeropage-retry on shared memory */ + uffdio_register.range.start = (unsigned long) area_dst_alias; + if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) + err("register failure"); + } + if (uffdio_zeropage(uffd, 0)) if (my_bcmp(area_dst, zeropage, page_size)) err("zeropage is not zero"); @@ -1763,7 +1766,6 @@ static void sigalrm(int sig) if (sig != SIGALRM) abort(); test_uffdio_copy_eexist = true; - test_uffdio_zeropage_eexist = true; alarm(ALARM_INTERVAL_SECS); } -- 2.39.1