Message ID | 20221028132640.2791026-1-jsavitz@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp835474wru; Fri, 28 Oct 2022 06:36:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rT4i9xcBeoIA++O1gm3NY3nHb6PdF0dZ1xN5Zi7A7l1rbXS5yPIfSjAfBh/Z0ljWxXb8f X-Received: by 2002:a17:907:2d8a:b0:78d:4448:e96c with SMTP id gt10-20020a1709072d8a00b0078d4448e96cmr46477681ejc.199.1666964174203; Fri, 28 Oct 2022 06:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666964174; cv=none; d=google.com; s=arc-20160816; b=UCCPal+L6ZGJcF6KjnICaX3b7Uv1xgtJsUfBnKcefz8I4k1B4WoabXUF8RxnVgsJgn 06bj/EaR6B/snr5tH3JCjAE5fXsZ63BQlMpLu/G3c58JmbT0oaGXk9vgIbMNsBYLDN20 6MzirS2vFs0DjR0PIkb19fNkZWhKxIdBVKOw/jE9Xm2qFOyAx+wuvRHVypIwpBuTXE0e WV/tuVts8ESKMepPtt0+9Oh6Gjkk8yinNx7Kil4G28/6ojdrtIAZsa2+5GT4ivPG6Fgq lF4rm6L2RBygXB9enLNf4c+s8mbmNBfYRPG1KJolzpzlzopGxDVitWRpfAaeJXi2Zerz T+7A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nMEqJ+SJX81wA4F4D8VcQ1oWVGj7/HJA80MojM8MPSQ=; b=YDSAG3HRo0p61z/J7R9HDIi1TTo3NvtIL4ARZLY/+l3z1IGMZGCOntghHWKaF8auz4 2qZ6azqxwx1YtuHbycdx5xRi1F3KdFCmO2NYgQFdaCoEVC22cRv1m5QEEUxknIWUo7GA J220fBGx+7HPgAwrB8ux2A8Aouno1V8wimZOVIIaxw8f/ucObychQvciIQfN46+zlMIu oF/8czUbH3pNhlfJlB7C084riRVOh5E+bOHJIFu8S7/JEyGFdnxlwOULqUsoZWQWjSpC YPOHT+Dmx5KKh8offzNnS24z2ME7IS3HkeYLlfVUYqcPShfnubdVfUtJgEbugq/1/uVR zvKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Txwkx/3Q"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a05640250cb00b0045cca8f9a0asi5135859edb.580.2022.10.28.06.35.50; Fri, 28 Oct 2022 06:36:14 -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="Txwkx/3Q"; 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 S229450AbiJ1N2K (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Fri, 28 Oct 2022 09:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiJ1N17 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 09:27:59 -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 6E5BA1CB52E for <linux-kernel@vger.kernel.org>; Fri, 28 Oct 2022 06:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666963619; 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; bh=nMEqJ+SJX81wA4F4D8VcQ1oWVGj7/HJA80MojM8MPSQ=; b=Txwkx/3QgMEfCouQ6A8W9Wh+PTr2AYsEVZtRGV0mfhDFiBCMS9MpLOAEu7r8ZS5y0bRtpB 5SXuKAYMoE7ZH8gFkoVY1IX3mk6vnq0EsEFVYDCIPx8i2Q+ddJMzYZPOuJSx2LXkpz9EYN fccZGHEtdWhopRTZKVMHDriGWvDGcd8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-170-eXGXvRW4NzCQ6fMIzMAqUA-1; Fri, 28 Oct 2022 09:26:56 -0400 X-MC-Unique: eXGXvRW4NzCQ6fMIzMAqUA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDD8484ACA0; Fri, 28 Oct 2022 13:26:55 +0000 (UTC) Received: from jsavitz-csb.redhat.com (unknown [10.22.16.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F9CE492B06; Fri, 28 Oct 2022 13:26:53 +0000 (UTC) From: Joel Savitz <jsavitz@redhat.com> To: linux-kernel@vger.kernel.org Cc: Joel Savitz <jsavitz@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Shuah Khan <shuah@kernel.org>, David Hildenbrand <dhildenb@redhat.com>, Nico Pache <npache@redhat.com>, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH linux-next] selftests/vm: calculate variables in correct order Date: Fri, 28 Oct 2022 09:26:40 -0400 Message-Id: <20221028132640.2791026-1-jsavitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747938625933569163?= X-GMAIL-MSGID: =?utf-8?q?1747938625933569163?= |
Series |
[linux-next] selftests/vm: calculate variables in correct order
|
|
Commit Message
Joel Savitz
Oct. 28, 2022, 1:26 p.m. UTC
commit b5ba705c2608 ("selftests/vm: enable running select groups of tests")
unintentionally reversed the ordering of some of the lines of
run_vmtests.sh that calculate values based on system configuration.
Importantly, $hpgsize_MB is determined from $hpgsize_KB, but this later
value is not read from /proc/meminfo until later, causing userfaultfd
tests to incorrectly fail since $half_ufd_size_MB will always be 0.
Switch these statements around into proper order to fix the invocation
of the userfaultfd tests that use $half_ufd_size_MB.
Suggested-by: Nico Pache <npache@redhat.com>
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
---
tools/testing/selftests/vm/run_vmtests.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Comments
On Fri, 28 Oct 2022 09:26:40 -0400 Joel Savitz <jsavitz@redhat.com> wrote: > commit b5ba705c2608 ("selftests/vm: enable running select groups of tests") > unintentionally reversed the ordering of some of the lines of > run_vmtests.sh that calculate values based on system configuration. > Importantly, $hpgsize_MB is determined from $hpgsize_KB, but this later > value is not read from /proc/meminfo until later, causing userfaultfd > tests to incorrectly fail since $half_ufd_size_MB will always be 0. > > Switch these statements around into proper order to fix the invocation > of the userfaultfd tests that use $half_ufd_size_MB. Does this fix address the failure in https://lkml.kernel.org/r/202211021026.61b267d1-yujie.liu@intel.com? Thanks.
On Wed, Nov 16, 2022 at 8:09 PM Joel Savitz <jsavitz@redhat.com> wrote: > > On Tue, Nov 8, 2022 at 8:31 PM Andrew Morton <akpm@linux-foundation.org> wrote: >> >> On Fri, 28 Oct 2022 09:26:40 -0400 Joel Savitz <jsavitz@redhat.com> wrote: >> >> > commit b5ba705c2608 ("selftests/vm: enable running select groups of tests") >> > unintentionally reversed the ordering of some of the lines of >> > run_vmtests.sh that calculate values based on system configuration. >> > Importantly, $hpgsize_MB is determined from $hpgsize_KB, but this later >> > value is not read from /proc/meminfo until later, causing userfaultfd >> > tests to incorrectly fail since $half_ufd_size_MB will always be 0. >> > >> > Switch these statements around into proper order to fix the invocation >> > of the userfaultfd tests that use $half_ufd_size_MB. >> >> Does this fix address the failure in >> https://lkml.kernel.org/r/202211021026.61b267d1-yujie.liu@intel.com? >> >> Thanks. >> > > I have tried to reproduce this failure on a couple of different systems before and after the application of this commit but I haven't had any success in doing so. I suspect that there was some sort of hugepage configuration issue on the test system but I'd have to look into it more to be sure. > > However, I noticed that on the mm-everything branch, the hugepage-mmap test fails: > > # ./run_vmtests.sh -t "hugetlb" > running: ./hugepage-mmap > ----------------------- > running ./hugepage-mmap > ----------------------- > Open failed: No such file or directory > [FAIL] > ... > > It appears this is due to commit 0796c7b8be84 ("selftests/vm: drop mnt point for hugetlb in run_vmtests.sh") > as the test still replies on the ./huge mountpoint removed in that commit. The test passes before that patchset is applied. > > Additionally, I just noticed an extraneous 'echo "running: $1"' line in run_test(), the effects of which are seen above, and I have just sent a patch to remove it. > > Joel Resending this reply since it appears a bit of HTML slipped into the last reply and it got rejected by the lists.
On Wed, Nov 16, 2022 at 08:09:11PM -0400, Joel Savitz wrote: > However, I noticed that on the mm-everything branch, the hugepage-mmap test > fails: > > # ./run_vmtests.sh -t "hugetlb" > running: ./hugepage-mmap > ----------------------- > running ./hugepage-mmap > ----------------------- > Open failed: No such file or directory > [FAIL] > ... > > It appears this is due to commit 0796c7b8be84 ("selftests/vm: drop mnt > point for hugetlb in run_vmtests.sh") > as the test still replies on the ./huge mountpoint removed in that commit. > The test passes before that patchset is applied. Oops, sorry I totally overlooked this hard-coded test case using the mntpoint. Fix is simple though, which is attached.
On 11/17/22 16:33, Peter Xu wrote: > On Wed, Nov 16, 2022 at 08:09:11PM -0400, Joel Savitz wrote: > > However, I noticed that on the mm-everything branch, the hugepage-mmap test > > fails: > > > > # ./run_vmtests.sh -t "hugetlb" > > running: ./hugepage-mmap > > ----------------------- > > running ./hugepage-mmap > > ----------------------- > > Open failed: No such file or directory > > [FAIL] > > ... > > > > It appears this is due to commit 0796c7b8be84 ("selftests/vm: drop mnt > > point for hugetlb in run_vmtests.sh") > > as the test still replies on the ./huge mountpoint removed in that commit. > > The test passes before that patchset is applied. > > Oops, sorry I totally overlooked this hard-coded test case using the > mntpoint. > > Fix is simple though, which is attached. > > -- > Peter Xu > From 71da2480d4bac0fc598e4d1f05f71aba8b980bc4 Mon Sep 17 00:00:00 2001 > From: Peter Xu <peterx@redhat.com> > Date: Thu, 17 Nov 2022 16:29:15 -0500 > Subject: [PATCH] selftests/vm: use memfd for hugepage-mmap test > Content-type: text/plain > > This test was overlooked with a hard-coded mntpoint path in test when we're > removing the hugetlb mntpoint in commit 0796c7b8be84. Fix it up so the > test can keep running. > > Reported-by: Joel Savitz <jsavitz@redhat.com> > Signed-off-by: Peter Xu <peterx@redhat.com> > --- > tools/testing/selftests/vm/hugepage-mmap.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) Thanks Peter! That is also something I noticed and was on my todo list. Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh index fff00bb77086..ce52e4f5ff21 100755 --- a/tools/testing/selftests/vm/run_vmtests.sh +++ b/tools/testing/selftests/vm/run_vmtests.sh @@ -82,16 +82,6 @@ test_selected() { fi } -# Simple hugetlbfs tests have a hardcoded minimum requirement of -# huge pages totaling 256MB (262144KB) in size. The userfaultfd -# hugetlb test requires a minimum of 2 * nr_cpus huge pages. Take -# both of these requirements into account and attempt to increase -# number of huge pages available. -nr_cpus=$(nproc) -hpgsize_MB=$((hpgsize_KB / 1024)) -half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) -needmem_KB=$((half_ufd_size_MB * 2 * 1024)) - # get huge pagesize and freepages from /proc/meminfo while read -r name size unit; do if [ "$name" = "HugePages_Free:" ]; then @@ -102,6 +92,16 @@ while read -r name size unit; do fi done < /proc/meminfo +# Simple hugetlbfs tests have a hardcoded minimum requirement of +# huge pages totaling 256MB (262144KB) in size. The userfaultfd +# hugetlb test requires a minimum of 2 * nr_cpus huge pages. Take +# both of these requirements into account and attempt to increase +# number of huge pages available. +nr_cpus=$(nproc) +hpgsize_MB=$((hpgsize_KB / 1024)) +half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) +needmem_KB=$((half_ufd_size_MB * 2 * 1024)) + # set proper nr_hugepages if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)