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: 174460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4015469vqy; Wed, 6 Dec 2023 02:37:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4V4qzWG0p02uW7SJCRrAn+ohbF9AoTMAOghk51OU3bnPwd3XXepPQhE/lR6Oda/NbdnTG X-Received: by 2002:a05:6a20:12ca:b0:187:df72:48ef with SMTP id v10-20020a056a2012ca00b00187df7248efmr676227pzg.0.1701859020059; 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=xh/xogb6clocnVKX9qeeu1zLYmRfPZZqaOK0QwCKS01vfIQaNcRKZUCNucGO7Dv5+B SpW+K8o4wZVMeBQfbM/u3BMfAOZBW7w4HTl3OHlBSEbthFWsyk/dLAZyEe7/Fz2rDK/u Bpw51EPBAf6NAjEAJFmfr3awefNgV6mLYWdKM3pKwnGZCP2f8FTbCGbTTorM+pI5Vjvs DBsLzbi30FkEjXMyunK86gKBA71RWK+PedUCQNDLOmEavr/HrKAzq+q3PW12D1S9sBr4 TmLzbk2rAC33U5tkzzpxeyTQsK8wDDFLO94mou3SkaGJKLEGiVipzxMHPlcwazXwq7s9 5/5g== 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 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bq24-20020a056a000e1800b006cbd3f3a2fcsi11268980pfb.77.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 23.128.96.32 as permitted sender) client-ip=23.128.96.32; 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 23.128.96.32 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 4F9EF807A5B1; Wed, 6 Dec 2023 02:36:08 -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 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:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784528523698279118 X-GMAIL-MSGID: 1784528523698279118 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());