From patchwork Wed Dec 6 10:35:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13481424 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 7A495C10F04 for ; Wed, 6 Dec 2023 10:36:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B0546B0080; Wed, 6 Dec 2023 05:36:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 162236B0082; Wed, 6 Dec 2023 05:36:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 002386B0095; Wed, 6 Dec 2023 05:36:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E61EC6B0080 for ; Wed, 6 Dec 2023 05:36:07 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B700AA013A for ; Wed, 6 Dec 2023 10:36:07 +0000 (UTC) X-FDA: 81536038374.26.E8BAE68 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 1B9AF100005 for ; Wed, 6 Dec 2023 10:36:05 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Uyj4DEJD; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701858966; a=rsa-sha256; cv=none; b=Dy+xEwePhUOgaGwmgykyoxerhf67VW/5g8ZOQODQW0PkvsUFo3vow4s7rkZ1rPg0FJYy7W orgz8H0u0A39w8zpiDFMDERM/afovlH/JAyRMBi/6LBlGPVZ0+f5GJIeug04TfhCHHkgZ2 bl12YwKUG8Gu7InG/PoLuT1q/FydLpU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Uyj4DEJD; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701858966; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=WQ7x2ePi4wPqgcy9UtrNKCA+HmaOdfg4ZJ2pa42/YJE=; b=gy2nkao8Cp7l6jOZjb+dXrhEaB2Arg7jefOzD/6Gc/VHZrtR6MmD16Bm14m4Cge/i18c/E 5vc3F2KHCtNhohPoQnk+3DWVs/dxnTDYlmjbPM1aQckCDhLtYrw9eDrsiFqBqXZM5+gLYw T35GGDI/pvZewb+R0H0D5SPRK+k/4zQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701858965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WQ7x2ePi4wPqgcy9UtrNKCA+HmaOdfg4ZJ2pa42/YJE=; b=Uyj4DEJDTWnXIUb96iYxXRbGZzvqQQpKI1LX/7lVfCT4d4Nt2YtAuNSf1TPX9R35nZTLsg rgGEZCrNahWnZripPYrleo5W6K9ajwZs8CsRUcRKr8QP8ouCH66BVagmgMXTreWNXVVZJs n0KpORhjowKF9EtCe2tLrVRDM7V1xS8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-G62fAps4PdW2LwnnG9nc_w-1; Wed, 06 Dec 2023 05:36:01 -0500 X-MC-Unique: G62fAps4PdW2LwnnG9nc_w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45FE23C0F363; Wed, 6 Dec 2023 10:36:01 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.194.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA69740C6EB9; Wed, 6 Dec 2023 10:35:59 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, David Hildenbrand , Nico Pache Subject: [PATCH v1] selftests/mm: cow: print ksft header before printing anything else Date: Wed, 6 Dec 2023 11:35:58 +0100 Message-ID: <20231206103558.38040-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1B9AF100005 X-Stat-Signature: 7p13j5bttsoc5hri6teqtbbh17mk5sdu X-Rspam-User: X-HE-Tag: 1701858965-396916 X-HE-Meta: U2FsdGVkX1/VHqanaYJyC9gKKF2M9XckLACUUFikbEtr/oQlYiU9EM4u4miiPLwrRTcg7bYBkzaVYRvpzkc6AyBhREtH2gFbZ+q3Or7vX4U4vOzKQDAueKlflRYdRjZqDglwQWTzBup3ZtZhUV8RTYI2HOx6l/HgYO5Dmyas3EwDs+q0dXW1QtEXItR9wXl+NTuY4H+pmaMPD61bVK1u7rK3u1N8YuvXlPlNDkogUbKmTKrMvhIuVeCqG6pLqB48+qi1FDmT0Ffngqkuwchr+iNfsnUSE/vv7qcA5CzemQJiHxmPtMgFARIpkSNIu4K/hgtAT8a6Z4aqH9hWMGJ8p6gVcyKNPg7t1wymWlkBic697/6Hb7rTclsBN4eV6PJvBbXQe35SOhg7AeUpP3UWtM1w8yMvGdPUOfYyX2ps//Sweq713pFCfUSOiRvOox3HqTQbZVF6BjD1b8V/Hr2mAsomuAZtrpNrNWLC3bhN/hXdGTAHJDzEC8Bbe3LHrPLrsrjw56GYZMXlC3x21to0gk1gP6uB6tTMnAhdOmf4nGl7iYiKOszuGPFWFclQ9IwMmtzzQ8P9YXJz8aYuEcbnuGOl0vJcFhN0OBAiCaq19fXgH8oIVgzY6cYIz2G+rJfQY9+9jE4K9xAov3lmdmWZi0epYpWBJrtDkOg7SrkYgGKyNs39cg18CqaQsgQMEWRu/2KNwz1U2fS178DHA3AOhOk27o3E2HIiMhQ5g1i/wtUeu8eqPb4xAz9p5YXPMxXvOl/rL1NwH3mFs+/Tf09b/lf15UJqrl9Ee6g79yf+aM+bUuEg07yK8SdXSINTckn6hkFfJqcs2L88HIAcDln1ODSkXubNWOPxyJaEDHXGeyfecStwwSNidST16YRJ2tKUTryxpCcID6mUSwsWck/CTS2seuW5Rzpz4cDg0GxG00sGBZY1+QByBZajlDULG11l3SYKtFZ2n2L/seSq+Mp EM4bgBOu 8RR4SJe5K39j3Ua6jJO1CqR+uGvPJ/mkiqgPnyX1l932Uw5EYGapRA+orP/2i5OnUrnipbFplZW8HMfl8AU72PpoYD5rd59TvKMcB9DdJ+cf9gC6Dnr51ZHLJwFrGP2cAlO4so757orj/4MIOyi1baPYxdDKHhlahrtEi+nWS4Ogqhe8= 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: List-Subscribe: List-Unsubscribe: Doing a ksft_print_msg() before the ksft_print_header() seems to confuse the ksft framework in a strange way: running the test on the cmdline results in the expected output. But piping the output somewhere else, results in some odd output, whereby we repeatedly get the same info printed: # [INFO] detected THP size: 2048 KiB # [INFO] detected hugetlb page size: 2048 KiB # [INFO] detected hugetlb page size: 1048576 KiB # [INFO] huge zeropage is enabled TAP version 13 1..190 # [INFO] Anonymous memory tests in private mappings # [RUN] Basic COW after fork() ... with base page # [INFO] detected THP size: 2048 KiB # [INFO] detected hugetlb page size: 2048 KiB # [INFO] detected hugetlb page size: 1048576 KiB # [INFO] huge zeropage is enabled TAP version 13 1..190 # [INFO] Anonymous memory tests in private mappings # [RUN] Basic COW after fork() ... with base page ok 1 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped out base page # [INFO] detected THP size: 2048 KiB # [INFO] detected hugetlb page size: 2048 KiB # [INFO] detected hugetlb page size: 1048576 KiB # [INFO] huge zeropage is enabled Doing the ksft_print_header() first seems to resolve that and gives us the output we expect: TAP version 13 # [INFO] detected THP size: 2048 KiB # [INFO] detected hugetlb page size: 2048 KiB # [INFO] detected hugetlb page size: 1048576 KiB # [INFO] huge zeropage is enabled 1..190 # [INFO] Anonymous memory tests in private mappings # [RUN] Basic COW after fork() ... with base page ok 1 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped out base page ok 2 No leak from parent into child # [RUN] Basic COW after fork() ... with THP ok 3 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped-out THP ok 4 No leak from parent into child # [RUN] Basic COW after fork() ... with PTE-mapped THP ok 5 No leak from parent into child Reported-by: Nico Pache Fixes: f4b5fd6946e2 ("selftests/vm: anon_cow: THP tests") Signed-off-by: David Hildenbrand --- tools/testing/selftests/mm/cow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index 7324ce5363c0c..6f2f839904416 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -1680,6 +1680,8 @@ int main(int argc, char **argv) { int err; + ksft_print_header(); + pagesize = getpagesize(); thpsize = read_pmd_pagesize(); if (thpsize) @@ -1689,7 +1691,6 @@ int main(int argc, char **argv) ARRAY_SIZE(hugetlbsizes)); detect_huge_zeropage(); - ksft_print_header(); ksft_set_plan(ARRAY_SIZE(anon_test_cases) * tests_per_anon_test_case() + ARRAY_SIZE(anon_thp_test_cases) * tests_per_anon_thp_test_case() + ARRAY_SIZE(non_anon_test_cases) * tests_per_non_anon_test_case());