Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp880770rdb; Wed, 6 Dec 2023 02:37:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1HNlAOtPyXhrvQtjftuFo/LOzG5SmuwPvX9M/094z+F326YJPtoObq2RCBRHcxEILXQQC X-Received: by 2002:a05:6a20:2d12:b0:18c:770:4578 with SMTP id g18-20020a056a202d1200b0018c07704578mr934354pzl.30.1701859020333; Wed, 06 Dec 2023 02:37:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701859020; cv=none; d=google.com; s=arc-20160816; b=pp4p2X6npEu65tzwRy7ptRkpZ2qq2N0jJdu2TPRQbUSrhkK33nsbXFPJ6WL9x7xkgJ BGGW1IK0h8qQs/b7kQiRn6ZfgrdtKj2sV0Q2++4RYupedi6cArztNuC2hbvfdoJLdmcv s2bR/hf4cDXOF0f5wRNwgKzwcSqtsag5yYRGAHU4/HZNg/30gquEL24pkeNMhaNejfKM kmsjM+xi615oT5aBW2LU3puk+Hbg9YPG4YolTWE57DpfEgedtk+Ee7MN8aP8iEl/MJjV EV+aA0Sd10VS4gJOVmXNpRGKC3kDkFJ6sU5y4aZK8ZJCYh8WhQ5K41d1E1SiqprkSGqV IEvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WQ7x2ePi4wPqgcy9UtrNKCA+HmaOdfg4ZJ2pa42/YJE=; fh=kVQY9BUczRxE7o68otADa28ITkTj2aajsHFNX+NLm38=; b=jB0RfIjohZtrcOEWvBmscqTtkRudlrV4G5iqtktjKx/rocsS11xKm8bXG0DvAwxUe0 sfBEnbUlmKXKOBabz/WWBpvEwBh41LXB1yxt/3M2Hev/6YpXVtjDim6siwvq72A9UxUh ZUD4/Ph08/ZrpkZIe1hhe2Ok8zrkMLBqihYeHIoXB8USVgPh531Lr/APtUoA7zBqpnRZ NVbLTbt4RPKNznxiTlcN3Vr4pUJ5N/n8pPaCePLLJHvYhQwARAJFgGRmm+KWFzk3iIIv xgWr6r1+Dp6YHe3zFJRFJ+PvrSuftBSvHdGqMc8PNfkqS5wQF9dG+HH7FEtNRM9UiKS4 YbTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a3rWuPCI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id o66-20020a634145000000b005aa644010a6si11189145pga.205.2023.12.06.02.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:37:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a3rWuPCI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BB888807A594; Wed, 6 Dec 2023 02:36:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377463AbjLFKf7 (ORCPT + 99 others); Wed, 6 Dec 2023 05:35:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377453AbjLFKf6 (ORCPT ); Wed, 6 Dec 2023 05:35:58 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2460218F for ; Wed, 6 Dec 2023 02:36:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701858963; 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=a3rWuPCID7jd7dlwUOn4I76Jaglg9yI4H0uDvwEqZaO2ucnKXx5BgBoN8OSRVWYHam1TAk sQ61OQkdzaUo1KtMMcTwBwq1UwXucMW71I5GM+0gTFsQ/3Bw3fp5otZmxCDBwwA9wtcIf3 qBDW4bRczu3GngeLk8rxsQiYEcTpSqU= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 02:36:16 -0800 (PST) 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()); -- 2.41.0