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 871AEC43334 for ; Mon, 27 Jun 2022 16:38:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 228AD8E0002; Mon, 27 Jun 2022 12:38:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D7E48E0001; Mon, 27 Jun 2022 12:38:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A07C8E0002; Mon, 27 Jun 2022 12:38:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EEE168E0001 for ; Mon, 27 Jun 2022 12:38:39 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BF103B06 for ; Mon, 27 Jun 2022 16:38:39 +0000 (UTC) X-FDA: 79624574358.17.82A05CD Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf07.hostedemail.com (Postfix) with ESMTP id 39401400A3 for ; Mon, 27 Jun 2022 16:38:39 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id c65so13876900edf.4 for ; Mon, 27 Jun 2022 09:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wowsignal-io.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hBm71vkTlJExx3G7wML46tAHz3X4/AKiYDjJ2Cnqo+o=; b=En/HVQi/gi0M5Kzi+vsytBWeuokio55NJ8i6SHuJOVjm/BiY1QbEM3D9KWRacl8E4/ BxgzYJbQyuyhlZfMbFw6y89J4ID4UAHQ26LUW5/eus9UJK0/afpO9zE5vVojn3aDq8XF CUeh/blNOlm3Jhhlsh1RsfA+6WsxQ+dXgxQCe70zRc6iycmkD2zktsRmOSOHHv0vVkF9 pgPwBuuJju4f3l+PksuvhZ2glApe//aP+5irUb0sYWow6SsUluzkQtnZUjcMotUSpQyL PZCIKn2Zk9hhh06dDwXMTtVoFUex8JbBDSEBYv6+f055pAdAiqt5zdlvw7jW+RYri+yH jatg== 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; bh=hBm71vkTlJExx3G7wML46tAHz3X4/AKiYDjJ2Cnqo+o=; b=fH2Ksviy8t73XIV7rWa8z0cJ0DzvQPnHcS1w9ep7cdR+2f0l355u18lYuuIIRwdxIg De/9II2a+oRaVb5REONVl0ZlyClfUIEorJ6wSFoPFlnLa+o282JEI38Hnr0QaxL9jEUF jh0h2jfe8D8A0/QTwWR8JSpBh32TTxqrqlfkBGD1RPy8pg8GwTvYhzUUZOCkk1JBpZZG j9nKSkh8rEmdvjITL6Iy35MIZHZlWxLO6TqQ4v11Z0+w4RwASRQqgdRJwYg1Meh30iGS 7uBPO0YtTzkqvXRv7SuZN6XHhNTCLkmg2r2el0vn3r0RhxmURc39k5TsL/ZVUAONZ8b3 tIhw== X-Gm-Message-State: AJIora/vv/vAv+ESkUj4KdgBHsjmDuiZTiQcYTXx63xHIMzrF9eoEu8S NaVYEMFzFwFNg8lq9v5ptS81Vw== X-Google-Smtp-Source: AGRyM1t4MBRF2TjcPzaUxfqrHej+XtZdu7f7kMEWJisgFh9UsCQwVmgh5Xs2o4dmXMtsbQ6ibGAB2w== X-Received: by 2002:a05:6402:5306:b0:437:8bbd:b313 with SMTP id eo6-20020a056402530600b004378bbdb313mr9339575edb.123.1656347917976; Mon, 27 Jun 2022 09:38:37 -0700 (PDT) Received: from localhost ([2620:10d:c093:500::1:e511]) by smtp.gmail.com with ESMTPSA id t23-20020a170906609700b006fed062c68esm5292422ejj.182.2022.06.27.09.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 09:38:37 -0700 (PDT) Date: Mon, 27 Jun 2022 17:38:32 +0100 From: Adam Sindelar To: David Vernet 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: References: <20220627161332.4536-1-adam@wowsignal.io> <20220627162834.5fmi2f2obq6zlaa3@dev0025.ash9.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627162834.5fmi2f2obq6zlaa3@dev0025.ash9.facebook.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656347919; a=rsa-sha256; cv=none; b=TH6QibioIzxsKk6hLr/u+3nerQkFs1mM+i5Zw3sG80HgTjFyURmc8SA84bSr1ug5tl52Ex YzQx7u05JgwSBEjhkqvkJryOMWhZBi6TubRDIoF63zkXWucpI0g5zl82GKgLqafzgR8a84 YaAl2Wk4aci6MAW6XjlvxPsdWhtyEhA= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b="En/HVQi/"; spf=none (imf07.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.208.51) smtp.mailfrom=adam@wowsignal.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656347919; 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:dkim-signature; bh=hBm71vkTlJExx3G7wML46tAHz3X4/AKiYDjJ2Cnqo+o=; b=aPHlDYqbkDJzLYc7FLipXQS3TgsMxdBhcz2KU9LruEh5iQmV+OnNRTxCpaQel5VRp0qqyL hypQ7aYynl44O1X4xB4+02cF3wHMvu4zURAZnWtBWe321GLA70uTa4lbIhX49+HtRr7jxL URKoIAWL4Wge/vJu5NWLWtjGgF+YdSw= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 39401400A3 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b="En/HVQi/"; spf=none (imf07.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.208.51) smtp.mailfrom=adam@wowsignal.io; dmarc=none X-Rspam-User: X-Stat-Signature: quc4zimtqtxbpqon3b4m3ugnqx9xxqwo X-HE-Tag: 1656347919-553978 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 09:28:34AM -0700, David Vernet wrote: > 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? > Ah, my bad - force of habit. > > 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 > Fixed in v3. Thanks for the link! > > 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