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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C142DC43334 for ; Mon, 27 Jun 2022 14:38:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C9966B0071; Mon, 27 Jun 2022 10:38:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 379556B0072; Mon, 27 Jun 2022 10:38:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 240EB8E0001; Mon, 27 Jun 2022 10:38:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 158266B0071 for ; Mon, 27 Jun 2022 10:38:41 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C79CA21113 for ; Mon, 27 Jun 2022 14:38:40 +0000 (UTC) X-FDA: 79624272000.01.8508005 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) by imf08.hostedemail.com (Postfix) with ESMTP id 68C26160017 for ; Mon, 27 Jun 2022 14:38:40 +0000 (UTC) Received: by mail-qk1-f171.google.com with SMTP id v6so7020205qkh.2 for ; Mon, 27 Jun 2022 07:38:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=D3mWycJo+RFLisHBaYGTaHnt1L/jcKRD8Y7qNnAh3xU=; b=2POT7547VvLUNHVL+FY7K7HJOKK07scbSpwLLvT89FUcebRdFPm276nQ5tTQVODC0C 1Jrs9z0bJHruxPIebeUVOwWf7ZxV9ps5hWbzvUv6jy6OARtbbZ5ajwXYEA+RUanGtetb 00Xswh3fa6FWOgn90cya0mVqibnL+ZXA0xYhp/IlaZkkaNVPWNsKau11BbrjECUnap2U Fkomjmh6hOiLWC6jjVLm47TjjAKxXS4WjPX5doUyXFMnTcC4Gxm7XXZ+K57q2gBTA6pr nXlAv+WQ3VKmITnzSspeLIqTZWR8Q5hp8VU0j1MnEIq6Q0r1g7aZ7jJVLZ4T3VYWzp8v i2fA== X-Gm-Message-State: AJIora+ColvplMS9DZaxlBjUJ/W1kE2x4d2CvcKAX5n9ESeLnLv+yRX2 Rv3aA9ImKcaU5Okm2UE2/Hs= X-Google-Smtp-Source: AGRyM1u2Q1k7Qj2wWNQnv1J7ZYOwzB3Zybvjj4ZTns45muoqMd4z6EVYAVSHK0pdLJsWwa1Jtd/yhw== X-Received: by 2002:a05:620a:808a:b0:6af:1f4f:10c6 with SMTP id ef10-20020a05620a808a00b006af1f4f10c6mr4678304qkb.642.1656340719557; Mon, 27 Jun 2022 07:38:39 -0700 (PDT) Received: from dev0025.ash9.facebook.com (fwdproxy-ash-015.fbsv.net. [2a03:2880:20ff:f::face:b00c]) by smtp.gmail.com with ESMTPSA id x20-20020a05620a0ed400b006a79d8c8198sm8391430qkm.135.2022.06.27.07.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 07:38:39 -0700 (PDT) Date: Mon, 27 Jun 2022 07:38:37 -0700 From: David Vernet To: Adam Sindelar Cc: Andrew Morton , linux-mm@kvack.org, Adam Sindelar , kernel-team@fb.com Subject: Re: [PATCH] selftests/vm: Only run 128TBswitch with 5-level paging Message-ID: <20220627143837.mjln2g34xkbvkj2b@dev0025.ash9.facebook.com> References: <20220627123106.3798-1-adam@wowsignal.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627123106.3798-1-adam@wowsignal.io> User-Agent: NeoMutt/20211029 ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.222.171 as permitted sender) smtp.mailfrom=dcvernet@gmail.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656340720; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=D3mWycJo+RFLisHBaYGTaHnt1L/jcKRD8Y7qNnAh3xU=; b=O3ePO8an+75npJ2+mvhUfk8I1vSh/2k2LAD1kheZ45eWdXK0GiSunbqHhMfQSzeHERvBym Met+Mz/5WiXfEgQkobhCUeVrPUL503GuxreQpKuB0DvzDZEPXmdsAt+QTEwszYjzFG/N2Q Vd7odzvNkcOEvZ9yLgIu0wPZZydGzfQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656340720; a=rsa-sha256; cv=none; b=lVVXNIQTFqIOgdAJwtisMtspD5fZvvBXM9LPxvGpRP48F35xQDOiDG0qB8JYeQeW47G21Y sgCDgwJ8aA9ab9IVW3tClt1vcooHXZP0NcBnvThVjmUel5U1gyL8FmlZudaqYPyYLey30d yGM8FgOCWPIg+bJF8H76442mDqEp72M= X-Stat-Signature: umae1fhzdo8axkkgb98m8n7qsmycjmzq X-Rspamd-Queue-Id: 68C26160017 X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.222.171 as permitted sender) smtp.mailfrom=dcvernet@gmail.com; dmarc=none X-Rspamd-Server: rspam02 X-HE-Tag: 1656340720-116818 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 27, 2022 at 02:31:06PM +0200, Adam Sindelar wrote: > The test va_128TBswitch.c expects to be able to pass mmap an address hint > and length that cross the address 1<<47. This is not possible without > 5-level page tables, so the test fails. > > The test is already only run on 64-bit powerpc and x86 archs, but this > patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5. > There is precedent for checking /proc/config.gz in selftests, e.g. in > selftests/firmware. > > Signed-off-by: Adam Sindelar Hi Adam, Thanks for the patch. This is a great start -- left a few comments and questions. > --- > tools/testing/selftests/vm/Makefile | 1 + > tools/testing/selftests/vm/run_vmtests.sh | 2 +- > tools/testing/selftests/vm/va_128TBswitch.sh | 37 ++++++++++++++++++++ > 3 files changed, 39 insertions(+), 1 deletion(-) > create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh > > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile > index c45e535ff4b8..74390f498859 100644 > --- a/tools/testing/selftests/vm/Makefile > +++ b/tools/testing/selftests/vm/Makefile > @@ -91,6 +91,7 @@ endif > TEST_PROGS := run_vmtests.sh > > TEST_FILES := test_vmalloc.sh > +TEST_FILEs += va_128TBswitch.sh s/TEST_FILEs/TEST_FILES I recommend verifying that the installation worked as expected by running: $ make -C tools/testing/selftests TARGETS=vm install and ensuring that the shell script is output into tools/testing/selftests/kselftest_install/vm > KSFT_KHDR_INSTALL := 1 > include ../lib.mk > diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh > index a2302b5faaf2..edda7350ccca 100755 > --- a/tools/testing/selftests/vm/run_vmtests.sh > +++ b/tools/testing/selftests/vm/run_vmtests.sh > @@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then > run_test ./virtual_address_range > > # virtual address 128TB switch test > - run_test ./va_128TBswitch > + run_test ./va_128TBswitch.sh > fi # VADDR64 > > # vmalloc stability smoke test > diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh > new file mode 100755 > index 000000000000..269cc674fe9e > --- /dev/null > +++ b/tools/testing/selftests/vm/va_128TBswitch.sh > @@ -0,0 +1,37 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# > +# Copyright (C) 2022 Adam Sindelar (Meta) > +# > +# This is a test for mmap behavior with 5-level paging. This script wraps the > +# real test to check that the kernel is configured to support at least 5 > +# pagetable levels. > + > +# 1 means the test failed > +exitcode=1 Should we change this to ksft_fail to match ksft_skip? > + > +# Kselftest framework requirement - SKIP code is 4. > +ksft_skip=4 > + > +die() > +{ > + echo "$1" > + exit $exitcode > +} > + > +check_test_requirements() > +{ > + config="/proc/config.gz" Can you make this variable local? > + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)" > + [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot" > + > + pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2) Same here r.e. making it local. Also, does this work if we end up having to pull config from /boot where it's not gzipped? Perhaps we should create a variable called something like 'configs' which stores the output as either: $ local configs="$(zcat /proc/config.gz)" or $ local configs="$(cat /boot/config-$(uname -r))" Also, to the point above, just using zcat might be a bit simpler than invoking gzip -dcfq. > + if [[ "${pg_table_levels}" -lt 5 ]]; then > + echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" > + exit $ksft_skip > + fi > +} > + > +check_test_requirements > +./va_128TBswitch > -- > 2.35.1 > Thanks, David