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 805AFC43334 for ; Mon, 27 Jun 2022 16:22:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 160CB8E0002; Mon, 27 Jun 2022 12:22:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 110C88E0001; Mon, 27 Jun 2022 12:22:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1C428E0002; Mon, 27 Jun 2022 12:22:32 -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 E42EE8E0001 for ; Mon, 27 Jun 2022 12:22:32 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id BA660607ED for ; Mon, 27 Jun 2022 16:22:32 +0000 (UTC) X-FDA: 79624533744.27.BBB2CE8 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf22.hostedemail.com (Postfix) with ESMTP id 5415AC002B for ; Mon, 27 Jun 2022 16:22:18 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id o10so13840497edi.1 for ; Mon, 27 Jun 2022 09:22:18 -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=4bGTqP2YTQxRePvh72clG/ok/5yWC5zeqo8FOqOWeiw=; b=Y2GkNBKFbgCx7xucaRKoQvo2QCzVikaTv8NwW9zLHO39ThPBrli2aq03nK1T9LZ8FW sUMC+YLwt5Hm1zIDaepqv2Wm6i/payKBE7hcVlchptDCviMzmSJegzSbOomWnfK8fMMj yuBmlAurGt1V9mjk1/CNiHGNY1it1ZIX60kOHamXdhKXS9P4XI1wOkZjt6xOdh3208wX JIVDOPPsRlmXA6kRxppcaFdn9/iEh+BDCGH36+bmUfUYZIXcija2O5G00HshjG6tnVoc 3BjmJu6jlO18tXIHjtWfKa9+wG8S2oAxD85o2TeiH2De3R5HclycICvsml+OOv98RfeD zWyg== 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=4bGTqP2YTQxRePvh72clG/ok/5yWC5zeqo8FOqOWeiw=; b=PRsYA4CTFJHnNyyIU0MXty42RFC4RUyHk73YPGJAzTCbiDXmZbUiTODjSVg1zA0Ypv reQxHKzYMGD0cgmYe5PjyViSXiJ69qidTGL1EjWEXuWqNBRw7u7MsGWyWMlAmkfYpfZE 4bA5yAOYxffUp/0JkNT4RfPE3ot6Pz7QakVsxpJFJCz/j72JQzHVYr5yWSjyo2NcKACA 2AlTEpJiG/xpQjJZj53SF1G95LJI34SUHLq+4KI3HGUCY+fhHytM9F59BnTI7p5mv5P4 nNe5mf2TjrxpXiwbDXqBI99ZBUAGPgnUQxciFPIVHwo9Bb1Pvs1Zaa7yFlyq9QW97Mkr auKg== X-Gm-Message-State: AJIora+KFOF1bCZyFd/bjU1T6Ybbu7V19fq4Yy3UwunhJ8828TDCnulX I2i0xECqPF/COayS5mk54XTEg0MTv4vkMlAVgIZWdTtx X-Google-Smtp-Source: AGRyM1uuXZamvrdEtdozMuV7KrabaE3Nej2ybrouX5aTpVSGOYpc5CqFx7eIBYQiV1TdVtIKRG5W5A== X-Received: by 2002:a05:6402:26cb:b0:436:2173:3f7 with SMTP id x11-20020a05640226cb00b00436217303f7mr17815446edd.61.1656346937013; Mon, 27 Jun 2022 09:22:17 -0700 (PDT) Received: from localhost ([2620:10d:c093:500::1:e511]) by smtp.gmail.com with ESMTPSA id y1-20020aa7c241000000b004355dc75066sm7746599edo.86.2022.06.27.09.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 09:22:16 -0700 (PDT) Date: Mon, 27 Jun 2022 17:22:15 +0100 From: Adam Sindelar To: Andrew Morton Cc: linux-mm@kvack.org, Adam Sindelar , David Vernet , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627161332.4536-1-adam@wowsignal.io> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5415AC002B Authentication-Results: imf22.hostedemail.com; dkim=temperror ("DNS error when getting key") header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b=Y2GkNBKF; spf=temperror (imf22.hostedemail.com: error in processing during lookup of adam@wowsignal.io: DNS error) smtp.mailfrom=adam@wowsignal.io; dmarc=temperror reason="query timed out" header.from=wowsignal.io (policy=temperror) X-Rspam-User: X-Stat-Signature: ppd37hocp5dy7dtyfjabs6w1jbmgemo5 X-HE-Tag: 1656346938-633396 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000176, 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] > ------------------------------- > ``` > > v2: > - Function variables declared local > - Fixed variable name typo in Makefile > - Comment to explain gzip -dcfq > > 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 > + > +# Kselftest framework requirement - SKIP code is 4. > +ksft_skip=4 > + > +die() > +{ > + 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 > Apologies for sending the v2 out twice - I had the VM crash in the middle of sending the first email. -Adam