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 6E0C5C433EF for ; Fri, 1 Jul 2022 14:21:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC6C46B0073; Fri, 1 Jul 2022 10:21:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B749C6B0074; Fri, 1 Jul 2022 10:21:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3C4E6B0075; Fri, 1 Jul 2022 10:21:17 -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 90F9D6B0073 for ; Fri, 1 Jul 2022 10:21:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 632B060353 for ; Fri, 1 Jul 2022 14:21:17 +0000 (UTC) X-FDA: 79638743394.22.A78278F Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf02.hostedemail.com (Postfix) with ESMTP id D964780048 for ; Fri, 1 Jul 2022 14:21:16 +0000 (UTC) Received: by mail-qv1-f41.google.com with SMTP id z1so4160657qvp.9 for ; Fri, 01 Jul 2022 07:21:16 -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=0L1lQ7qYLPN2Zr8LSv6uJi2JemMPt1PVpZ7vPgS2oxE=; b=OJLd2Fhz8u/KfTg5kGe1GUZ9DYkfdkiHewbqrgGie9/cjlCPig56JEjwtNLknIdAMA MVbECvSIPnSCPpbWCN2NRtzN2aKLqMA8fB7lIvemGioXofaiyN2InFVoDgCw/vHc+Qac tEq+GguVlo6o1Sv4awunwpMc5o33AnsDB12pVihzC3WXH0jF9LzhG0nqkot5XpkHMZ5o 4N3vVcDZ3q1jUT3Grrw40KhKGULTbYnmKns0XOaLTsstDfEN0x42QxiU2M40T6JD3ICX rCRmi7cCP1E0VIwB8JXTrVvvoDlQk9bekO+sSlOV7esksPo+v1PYyGQhQ1jS31UQnGv8 KVWw== X-Gm-Message-State: AJIora9/1D6p3jQ+L3fuBaIb+VlFMQfIiKjtFZmfMIEwWRrzMCLkhhq5 B1QKfNOCk4TmfL4XJh4svd6nOSwdn68KHQ== X-Google-Smtp-Source: AGRyM1vmBTU74+UMFWxO1uqxhEvrLijCmXbPiK4NYwD1/4MtptYIhJG2Q7cFKssZ9RFCtoRHH7VNHw== X-Received: by 2002:a0c:df0f:0:b0:472:d03d:3c9f with SMTP id g15-20020a0cdf0f000000b00472d03d3c9fmr1641514qvl.99.1656685275838; Fri, 01 Jul 2022 07:21:15 -0700 (PDT) Received: from dev0025.ash9.facebook.com (fwdproxy-ash-014.fbsv.net. [2a03:2880:20ff:e::face:b00c]) by smtp.gmail.com with ESMTPSA id i11-20020a05620a248b00b006af4f9b77fdsm9819576qkn.44.2022.07.01.07.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 07:21:15 -0700 (PDT) Date: Fri, 1 Jul 2022 07:21:13 -0700 From: David Vernet To: Adam Sindelar 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: <20220701142113.w3vx67s7frkfwwiv@dev0025.ash9.facebook.com> References: <20220701104934.413146-1-adam@wowsignal.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701104934.413146-1-adam@wowsignal.io> User-Agent: NeoMutt/20211029 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656685277; a=rsa-sha256; cv=none; b=hOTPc7rHgUyap7g3BAyjYAUOHgFlMGmyZj0Jqq5ang5IaFMHlBYnZ+5czG44SM6WAGb8F9 gk221hS1rY0ijuIrIsPx5LxMzlHlJj5J/dB78MHw3eqe8McbbBXDNT6HAs4CDvx01Oz6lS rI/ZNepWrlwAx/Szy8BJ5w2lYw+rLE4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=dcvernet@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656685277; 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=0L1lQ7qYLPN2Zr8LSv6uJi2JemMPt1PVpZ7vPgS2oxE=; b=h0osp/hCEo9Kj8QK7gUk1el3jmPZzdqgqmLUrq6el8uXK19PhcaGHZzx8agAHaDmtivc8w 80E/8Hdhw/VWS3D/To/PCFL32g6FS/+vLN53tuOhqO3UHFR3g66YdePzdLoBGE9k9MInib tBcQAxzZq6HUPDi24tBon5vi6bufk0E= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D964780048 Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of dcvernet@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=dcvernet@gmail.com X-Rspam-User: X-Stat-Signature: oofmrqqtrztw3o3nbgz68bgt6fnogoq9 X-HE-Tag: 1656685276-807867 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 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 > < 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 > + > +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 >