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 5566CC433EF for ; Mon, 27 Jun 2022 16:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E34E98E0002; Mon, 27 Jun 2022 12:28:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE3668E0001; Mon, 27 Jun 2022 12:28:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAD088E0002; Mon, 27 Jun 2022 12:28:56 -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 BE12E8E0001 for ; Mon, 27 Jun 2022 12:28:56 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9A79E80D12 for ; Mon, 27 Jun 2022 16:28:56 +0000 (UTC) X-FDA: 79624549872.18.A8646E8 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by imf21.hostedemail.com (Postfix) with ESMTP id AF7CC1C002D for ; Mon, 27 Jun 2022 16:28:55 +0000 (UTC) Received: by mail-qk1-f169.google.com with SMTP id n10so3815179qkn.10 for ; Mon, 27 Jun 2022 09:28:55 -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=2onJ2iC5pODhiiZgPcLeXsi73C+Jq6I5Ak3bABYBDBY=; b=MFNijEC4XpCupWYbYubqH8NXM6ddsdQE+sz3DcRtQ1z//br794ZowZJ5NRP9Pk/KUl 7qQWvMlHvP558bucL+XtkKpQmEz1EqyEsHpE9Ha16QQjkQdv6vW81DpjdrEtkY440PU+ rTVcCBEY0zAYVmPWX0wb4cS6ljb3nfnGolJQz7gPE9Vsv8n8uwhI/2Q2VkJtYszT5Xhx IgmjwwuQHAcNWFXHTeE/lMCwKewW70bryohKKKeV+Q+u5SjPavHTd8cezHEvY+DpFWxn i53PMW6ueXsev3c8jRl/pjYsPmcGZPKxXR4bhYbU4lxu5sgipa6wZ2fWfMm0aVVqlCIL ha2Q== X-Gm-Message-State: AJIora/SQFEsFUY0lXfNNkp1UHDGY0sM5po2MiM5nhUtGkCGh5RSDrzY HF0khBQJIP5RW4e5hOBXHomK/c9fYq0= X-Google-Smtp-Source: AGRyM1sv6VIDdgBFaqqbGKL0t0/RBQSvZV0uQ9h1zv2tPPEJH8hxPRN1RjuEDFf+i3+GwrPGMATpqA== X-Received: by 2002:a37:67c9:0:b0:6af:a24:df4b with SMTP id b192-20020a3767c9000000b006af0a24df4bmr8752439qkc.691.1656347334820; Mon, 27 Jun 2022 09:28:54 -0700 (PDT) Received: from dev0025.ash9.facebook.com (fwdproxy-ash-006.fbsv.net. [2a03:2880:20ff:6::face:b00c]) by smtp.gmail.com with ESMTPSA id h9-20020ac85149000000b003050bd1f7c9sm7498587qtn.76.2022.06.27.09.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 09:28:54 -0700 (PDT) Date: Mon, 27 Jun 2022 09:28:34 -0700 From: David Vernet To: Adam Sindelar Cc: Andrew Morton , linux-mm@kvack.org, Adam Sindelar , kernel-team@fb.com Subject: Re: [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging Message-ID: <20220627162834.5fmi2f2obq6zlaa3@dev0025.ash9.facebook.com> References: <20220627161332.4536-1-adam@wowsignal.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627161332.4536-1-adam@wowsignal.io> User-Agent: NeoMutt/20211029 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656347335; a=rsa-sha256; cv=none; b=XOddUsDzY2YiphQGGY93Y1e+DCsAzS7S5OzuQj2LhofEbaCvG6buPRDqBQXt0ZKTlItxFg fdNOgp5w/2zQMnHd/F1DoQQDjXe8QGWqQDNQYffWe7BdKfn8BTh5PzMUiCZMx9cthldin6 D0lXaU3hgVRbuD+RPbcamcy8toUBbtk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.222.169 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=1656347335; 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=2onJ2iC5pODhiiZgPcLeXsi73C+Jq6I5Ak3bABYBDBY=; b=U6nrK0vZtA4NY3zevPYdlyZl+xLdXr3A/TeMNQK90S3wh7XiWTYd2wisTjwiv95lHu0vK3 okKbEHJLn6j2Rjo6sSh4lEDkuXzmVTmn4Bkl+xrlvR1r8Ogj8H2PXe7YzkrChhia+26vUE 3HixUK560QF64VBUpco4y/AiBSLKxF8= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: AF7CC1C002D Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=dcvernet@gmail.com; dmarc=none X-Rspam-User: X-Stat-Signature: 5ycgngbciin4kffxj9zdpr7o3mcygwuo X-HE-Tag: 1656347335-693686 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: On Mon, Jun 27, 2022 at 06:13:32PM +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. > > Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests` > produces the desired output: > > ``` > --------------------------- > running ./va_128TBswitch.sh > --------------------------- > ./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test > [SKIP] > ------------------------------- > ``` Different subsystems have different workflows, but I don't recall having ever seen markdown used in any mm patches. Can you update the patch description to not use markdown? > v2: > - Function variables declared local > - Fixed variable name typo in Makefile > - Comment to explain gzip -dcfq Can you move the version-change descriptions out of the commit summary and into the patch itself, directly after the ---? We don't want it to be included in the changelog that eventually gets merged. This is described in more detail in [0]. [0] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format > Signed-off-by: Adam Sindelar > --- > tools/testing/selftests/vm/Makefile | 1 + > tools/testing/selftests/vm/run_vmtests.sh | 2 +- > tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++ > 3 files changed, 41 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..7860d0969888 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 > > 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..767a6465b5d2 > --- /dev/null > +++ b/tools/testing/selftests/vm/va_128TBswitch.sh > @@ -0,0 +1,39 @@ > +#!/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 Agreed that it's preferable to follow the contours that already exist in the vm/ tests, but IMO this is pretty confusing and should be fixed for the whole suite in a follow-on patch. Both ksft_skip and exitcode are exit codes so this variable name doesn't really make sense. > +# Kselftest framework requirement - SKIP code is 4. > +ksft_skip=4 > + > +die() Sorry, missed this on the first pass, but can we change the name of this function to fail() to show that we're failing the test rather than killing the testrun? > +{ > + echo "$1" > + exit $exitcode > +} > + > +check_test_requirements() > +{ > + local config="/proc/config.gz" > + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)" > + [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot" > + > + # gzip -dcfq automatically handles both compressed and plaintext input. > + # See man 1 gzip under '-f'. > + local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2) > + > + 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