Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4859824rdb; Tue, 12 Dec 2023 11:12:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxygQyeXw5ksO4lQm/+xFd3r0lfbX8PGjKPb6o057UYvPu8EnTZ035tWk63ToHXYeRISSZ X-Received: by 2002:a05:6a20:918d:b0:18f:97c:384c with SMTP id v13-20020a056a20918d00b0018f097c384cmr8642709pzd.38.1702408360586; Tue, 12 Dec 2023 11:12:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702408360; cv=none; d=google.com; s=arc-20160816; b=LnVyjkY2+BnzRlM+8qkTwb7BiJUkOaUHxoRxp5XNuW347GEMLkiGbBuvCpL3Zmv7Hp q/5x3fzaw9L0LSJpvwS8So7M5l523Jz+m7WlXVlF0MdCsETaLygPVH9dSVT99WJa8h9w 6PBqsz2PERAXHuOqUSa51OELZz7HYJKGOBIikMzbZ/ntgJepcMJ37ZDVnfnUKqXQPyXA JZRpAW7oeB8EBBYG3yN4BwQGI0g7pJjJJL6H4/5+xiK3ucZ/p+nkP1qxxrjACQE8288H dWDBvUjfCBCjgmwqVe1G3RQTb4YgHVHsKXsa8pJwWF2ZnvQZcBbheu/2o/f4bi2J5Lld VpYw== 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x34-20020a631722000000b005b9a4673310si8105272pgl.326.2023.12.12.11.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:12:40 -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 6B63C80239B8; Tue, 12 Dec 2023 11:12:36 -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 Content-Transfer-Encoding: 8bit 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:36 -0800 (PST) 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() -- 2.34.1