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 446BBC43334 for ; Fri, 1 Jul 2022 16:32:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B831A6B0071; Fri, 1 Jul 2022 12:32:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B329C6B0073; Fri, 1 Jul 2022 12:32:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FA726B0074; Fri, 1 Jul 2022 12:32:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8E0976B0071 for ; Fri, 1 Jul 2022 12:32:20 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5B0F220644 for ; Fri, 1 Jul 2022 16:32:20 +0000 (UTC) X-FDA: 79639073640.23.DF9F739 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf25.hostedemail.com (Postfix) with ESMTP id CAEEEA0042 for ; Fri, 1 Jul 2022 16:32:19 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id o16-20020a05600c379000b003a02eaea815so4306423wmr.0 for ; Fri, 01 Jul 2022 09:32:19 -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=x5Y4+XQclwBh9tGt91C+cEnjaLAkW/zbUQfWY8CajA0=; b=iPuIOY6y6FVXvilHnVLIrdb9s2OW/ZSfbrJk9hL35IvGz2HeyPCC1pjc003VW0OZg/ Qm5osJCBga293fqD+sQAMbRHIa00pV+06Ie9kG5ZzVN/dr8ZgrY75XnZzaqWJbQ1dQ3l mstH8yVzE+WGiNvQepFgCt6AanNrGonSR+QpivDUQXItl/C3kvyfhHMNmyaFw2ju/O29 QFLiBJAyPXwOr5vd1ew+WDLhyu1lrbt7rwcHEJBUtB2O96nsjMHHFSCca4w/Et2gofzb upzoPre+cwoAuJqfgnhPbWbRUBX1rv4FGEGvGdZLJZoQF1XFUdJOGXH7jKxeFfLI86LN mxuw== 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=x5Y4+XQclwBh9tGt91C+cEnjaLAkW/zbUQfWY8CajA0=; b=OhqYLPuTITt2hFvj5xTG7VSZQIKgbF3fRngGHfEEoWG/j6Yo8TVJEnUwWmAsILDKp8 3z+NhZpO/2svVmXV0TZheZKDai8QKi8dGmy8onMXCxCEuQardhdZ9UKbq8rafq/bLeT9 yHYdZYxoEZyQWdVwa7pmfiDSwPxbrFSDXjRdYvGg0d0mi+0MAUxUWjyr1arJ6XthPV3J vDO2RRGutBT6bFbc3VO+0ipZQMfvZA5ypIAVAX9Zw4hmSa3FkFCR7YUrtu3IXzC88XeW MYJuMS0osGa26QQa1oJuZgmkhmKWoUm8cUSBTOg99rl1rLHgwd7eVUk1lwzx+t7XeaYA NKyQ== X-Gm-Message-State: AJIora8dEd8ZPrloERwdbqybF1NxhB5ExonUQv6c0XLbIL+cPOyqKcbP yBmO0cHkqMTxwtOYx5X5u6mp7A== X-Google-Smtp-Source: AGRyM1sfBYiYnK3vxi4i0p90GTSDvmiDdFDDYBgF1lIhV2AaHL0bCgsISbn6TcmGlgLh40IXqqJlXw== X-Received: by 2002:a1c:7310:0:b0:3a0:5580:fbf with SMTP id d16-20020a1c7310000000b003a055800fbfmr18431671wmb.109.1656693138602; Fri, 01 Jul 2022 09:32:18 -0700 (PDT) Received: from localhost (212-51-140-210.fiber7.init7.net. [212.51.140.210]) by smtp.gmail.com with ESMTPSA id z11-20020a5d654b000000b0021b8c554196sm23413504wrv.29.2022.07.01.09.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 09:32:18 -0700 (PDT) Date: Fri, 1 Jul 2022 18:32:17 +0200 From: Adam Sindelar To: David Vernet Cc: Andrew Morton , linux-mm@kvack.org, Adam Sindelar , kernel-team@fb.com Subject: Re: [PATCH v5] selftests/vm: Only run 128TBswitch with 5-level paging Message-ID: References: <20220701104934.413146-1-adam@wowsignal.io> <20220701142113.w3vx67s7frkfwwiv@dev0025.ash9.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701142113.w3vx67s7frkfwwiv@dev0025.ash9.facebook.com> ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b=iPuIOY6y; dmarc=none; spf=none (imf25.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.128.44) smtp.mailfrom=adam@wowsignal.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656693139; a=rsa-sha256; cv=none; b=7bPfvOLJABMY45aVeqdCwMS/NZBb6CJw91rwMiG3WA1CdIsh4VmVdyETKyIl6Ifb1VY3x8 /frhGKm3NR4ts4LErQ2MSCz/cEDl5qDJPXVdAs6DSX8u74uJ+UZH6roSLEVT/S4vHfYrK/ penJdO+Ivvy68eh68QFBKQMKK1dNn20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656693139; 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=x5Y4+XQclwBh9tGt91C+cEnjaLAkW/zbUQfWY8CajA0=; b=QCsKJ08SOZJOU7YkB9Sz/JA0jLBz4O/mad0SklP6aTfdiZIH1qEyBBg8r3/QTZTOnpn427 Xz/+v99uFYkQmkdcsMXh5BRom3OAzZceTGQ622LldQysaiCpE9INO4m9ENdN9NSNduRgGz /BdkYcQflHfPinKQF6h0r9LIYz5mlD8= X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b=iPuIOY6y; dmarc=none; spf=none (imf25.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.128.44) smtp.mailfrom=adam@wowsignal.io X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: CAEEEA0042 X-Stat-Signature: kw1dsf66wq17gbyjy9cb8rqfy3o1ycya X-HE-Tag: 1656693139-731593 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 Fri, Jul 01, 2022 at 07:21:13AM -0700, David Vernet wrote: > On Fri, Jul 01, 2022 at 12:49:34PM +0200, Adam Sindelar wrote: > > Hi Adam, > > > The test va_128TBswitch.c expects to be able to pass mmap an address hint > > and length that cross the address 1<<47. On x86_64, 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_64 archs, but this > > patch adds an additional check on x86_64 that skips the test if PG_TABLE_LEVELS > > It looks like checkpatch.pl is complaining about this line being too long: > > WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) > #11: > patch adds an additional check on x86_64 that skips the test if PG_TABLE_LEVELS > Fixed in v6, sorry. > > < 5. There is precedent for checking /proc/config.gz in selftests, e.g. in > > selftests/firmware. > > > > Running the tests produces the desired output: > > > > sudo make -C tools/testing/selftests TARGETS=vm run_tests > > --------------------------- > > running ./va_128TBswitch.sh > > --------------------------- > > ./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test > > [SKIP] > > ------------------------------- > > > > Signed-off-by: Adam Sindelar > > --- > > V4 -> V5: Renamed "die" to "fail" (missed the review comment, sorry!) > > V3 -> V4: Restrict the check to x86_64 > > V2 -> V3: Clean up the commit message > > V1 -> V2: Variables local, fixed Makefile typo, comment on gzip usage > > > > tools/testing/selftests/vm/Makefile | 1 + > > tools/testing/selftests/vm/run_vmtests.sh | 2 +- > > tools/testing/selftests/vm/va_128TBswitch.sh | 54 ++++++++++++++++++++ > > 3 files changed, 56 insertions(+), 1 deletion(-) > > create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh > > [...] > > > diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh > > new file mode 100755 > > index 000000000000..334d12715ac3 > > --- /dev/null > > +++ b/tools/testing/selftests/vm/va_128TBswitch.sh > > @@ -0,0 +1,54 @@ > > +#!/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 > > + > > +fail() > > +{ > > + echo "$1" > > + exit $exitcode > > +} > > My apologies for missing this in earlier reviews, but this file should be > updated to use 8-character wide tabs instead of spaces. Please see [0] for > details. > > [0] https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation > Ah, sorry, I thought that only applied to C code, but now I see shellscripts are formatted the same way. I'll fix my editor config. > > + > > +check_supported_x86_64() > > +{ > > + local config="/proc/config.gz" > > + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)" > > + [[ -f "${config}" ]] || fail "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: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" > > + exit $ksft_skip > > + fi > > +} > > + > > +check_test_requirements() > > +{ > > + # The test supports x86_64 and powerpc64. We currently have no useful > > + # eligibility check for powerpc64, and the test itself will reject other > > + # architectures. > > + case `uname -m` in > > + "x86_64") > > + check_supported_x86_64 > > + ;; > > + *) > > + return 0 > > + ;; > > + esac > > +} > > + > > +check_test_requirements > > +./va_128TBswitch > > -- > > 2.35.1 > >