From patchwork Tue Dec 12 19:12:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 177524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7944140vqy; Tue, 12 Dec 2023 11:12:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFvvaPKdy2fsCzGw8xv2l47UdKUAstyu5bCMMJ03pI1uTxyhsD2BoPvT5TicZ5n106PWOC X-Received: by 2002:a17:902:eb4c:b0:1d0:700b:3f69 with SMTP id i12-20020a170902eb4c00b001d0700b3f69mr7384562pli.35.1702408354071; Tue, 12 Dec 2023 11:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702408354; cv=none; d=google.com; s=arc-20160816; b=KMdpsq6jdj01zCyr4g9mco3GTEsg8Ihyy+bbeFU93b8OB1DO4t/oEfuAsnFXAgGXT0 I5w9ue4usnJot4Oxf1LIk3U9wreHsgxcveO7ebsekkuykdsW2stTIuqTpJ2QuSjkyLhr AsHpCnMI1SDoKD5y8THDVGpL56bzRWAgPDkTW5XQYRw7ok/z68HVFDOJSf2DEBOh8yui kjIA2nMpZPq34U8RO6/MkJAz23iCNTK4SGx88fcyroSAW23XyDhqAJXR3z0FDecqoPy0 cI0/x9tc6jNC/iioNoMHPOaXwqn5hayq8aL+w27lfeeWI1BZGYEudgBeqVQ5Toug74Jg sTbw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fp5HxzyF6S/z2fq68uDyd4yJNWOejRgp8f1FakCdznQ=; fh=9H4z7/o7y4OLn0xLmjdSk9Pth53+ED/R+iGnGlnIr7g=; b=0OFG7CQUe2XxxmiI0ADhdw2q0eqgmYImxfsE69PX3e5cMX4Bt4dWRQTRBo60xzRG6o ciyj3zq96ypC6IgZ6hWzLD94XZaonMqM880zjCfHWrmhO3kwEEn/b6nnJvSonQls2Vfk tvZW/8icjsuBXNNKOgeyPS6YcXNIsCjOetMRnsEsUiJd8SAeKEJntdzLzDuS4b6FQS+K C4O8ShL6iv2oUxXBVNkqW2Pz/4kkw77T4L7+aaEyYYG4tNdtnRHcgygnMWiWWdxhAH/6 /ebXKnpgljkVWgjO27h0mP1uyRoe8tOz/vGRAqEQjm1eZPv8/EB1icGJDaec89NYbJNj JoTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fe548kOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l21-20020a170902d35500b001d09b00de2asi6059461plk.587.2023.12.12.11.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:12:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fe548kOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DF66880239BC; Tue, 12 Dec 2023 11:12:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377213AbjLLTMU (ORCPT + 99 others); Tue, 12 Dec 2023 14:12:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377128AbjLLTMN (ORCPT ); Tue, 12 Dec 2023 14:12:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD0691 for ; Tue, 12 Dec 2023 11:12:20 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED58C433CA; Tue, 12 Dec 2023 19:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702408339; bh=qDPLpQDef/itGfo/TklI8cUVBWxVqosgPn9XJfgMvTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fe548kOa1eEySWtrJregkohnvqpY7vdWjKKPCudLgwBBb+9e6xzFaoH0+WvaqguDx ZxHypfeWg97/jfKcQUaCtcorEwUUrssWyeoUMuUvVxoY29wGmcPyZaQ4d5OkrgcOQQ nwazE99GcCCIgiV9RdLrxpKwqnWVZkALMeRr12SqAa7yasIzFnoe1Q0QoJaWQcEGlT Jlo2peINZz+lkxp29aM3YkyyG5n4FTUmspwosyQOf/nseLqoytIJfrmMQbYV/TRVlF oDFD2WIHnDmjMVKO6nUxpOcT9jfgLqN7yAQkkWCYXqizU4d/Rn/otkz6LJkXh+KWKc dvC8vmZur3sZg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] selftests/damon: add a test for update_schemes_tried_regions hang bug Date: Tue, 12 Dec 2023 19:12:06 +0000 Message-Id: <20231212191206.52917-6-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212191206.52917-1-sj@kernel.org> References: <20231212191206.52917-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:12:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785104542117940100 X-GMAIL-MSGID: 1785104542117940100 Add a test for reproducing the update_schemes_tried_{regions,bytes} command-causing indefinite hang bug that fixed by commit 7d6fa31a2fd7 ("mm/damon/sysfs-schemes: add timeout for update_schemes_tried_regions"), to avoid mistakenly re-introducing the bug. Refer to the fix commit for more details of the bug. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/Makefile | 1 + ...sysfs_update_schemes_tried_regions_hang.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang.py diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index 1363987709c6..d90bdba28ff4 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -12,6 +12,7 @@ TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh TEST_PROGS += debugfs_duplicate_context_creation.sh TEST_PROGS += debugfs_rm_non_contexts.sh TEST_PROGS += sysfs.sh sysfs_update_removed_scheme_dir.sh +TEST_PROGS += sysfs_update_schemes_tried_regions_hang.py TEST_PROGS += sysfs_update_schemes_tried_regions_wss_estimation.py TEST_PROGS += reclaim.sh lru_sort.sh TEST_PROGS += dbgfs_target_ids_read_before_terminate_race.sh diff --git a/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang.py b/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang.py new file mode 100755 index 000000000000..8c690ba1a573 --- /dev/null +++ b/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 + +import subprocess +import time + +import _damon_sysfs + +def main(): + proc = subprocess.Popen(['sleep', '2']) + kdamonds = _damon_sysfs.Kdamonds([_damon_sysfs.Kdamond( + contexts=[_damon_sysfs.DamonCtx( + ops='vaddr', + targets=[_damon_sysfs.DamonTarget(pid=proc.pid)], + schemes=[_damon_sysfs.Damos( + access_pattern=_damon_sysfs.DamosAccessPattern( + nr_accesses=[200, 200]))] # schemes + )] # contexts + )]) # kdamonds + + err = kdamonds.start() + if err != None: + print('kdmaond start failed: %s' % err) + exit(1) + + while proc.poll() == None: + err = kdamonds.kdamonds[0].update_schemes_tried_bytes() + if err != None: + print('tried bytes update failed: %s' % err) + exit(1) + +if __name__ == '__main__': + main()