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: 13489788 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 2C637C4167B for ; Tue, 12 Dec 2023 19:12:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9B0B6B033D; Tue, 12 Dec 2023 14:12:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E24386B033E; Tue, 12 Dec 2023 14:12:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C75F76B0340; Tue, 12 Dec 2023 14:12:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9B8056B033E for ; Tue, 12 Dec 2023 14:12:22 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7572E160A28 for ; Tue, 12 Dec 2023 19:12:22 +0000 (UTC) X-FDA: 81559112124.03.2B59A7A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id CDCD2C002D for ; Tue, 12 Dec 2023 19:12:20 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fe548kOa; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702408340; 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:in-reply-to:references:references:dkim-signature; bh=fp5HxzyF6S/z2fq68uDyd4yJNWOejRgp8f1FakCdznQ=; b=2oMRbSKvJ7HiJBJgRtFwooAeUmVDC08/X/9cp8yL4Xdix1iAzWdjxjgbnybT45yrGtMyEj R6CbwSmXQbk0gnNXmez4glWtQB1fonMMyc3Cbfir6IsSuS1404GRIXSGVxpmLIhtfqdajQ ghYqpKdzomk3VfCDjWeVi4E8MfzE8WY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fe548kOa; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702408340; a=rsa-sha256; cv=none; b=JYJW/DLh37ZLwCmNAB/4Org6yb4b44KAH7/DJoP+s4uAS5TlH4mx8cvUxABkLKQBMv4S3m nRW6hbBpLqtn+D8scp0syMaJ2IDtbsXv4o4haVbPM4T9ADdqq33CAl70vMZMYzJZMoEI44 1mWxPH+3QOHLAvHIKdwSAQIO8LBM2/A= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 16A6D60F57; Tue, 12 Dec 2023 19:12:20 +0000 (UTC) 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-Rspamd-Queue-Id: CDCD2C002D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: d7bp5yqau3oe8i8nje1d6aapb9b5ijqw X-HE-Tag: 1702408340-626997 X-HE-Meta: U2FsdGVkX1+Wv95OeWaiBfD0+7QNCK8Q0GKBq/VokfI4qyIQxYICdQ2uAaYpvOJB73IC243v1nSlNYCzEQby/agM/bDWm5MSmmDEho6I3H6exLJbejfh0TSXxR8h1gkei57HA67t3Vaa8BLej0VmPJIoFF5BohoNat/9byFs8uVAFg6YfVrBu7ycU0cMLNuO2ugEOqvXLwGQoSv9rMNL1BPbsfdb5+IW5VnGF/9LETrJWGI+SOMQ95I/mei9RSM4vw0+hry4Rr/Bk7TcBWqY3kvs5+bdsZl+U8nbCv2ie6di6cVKJmhqcA1KhjAtm7xHeyw5QeubtI7MBh34D9arXjn13aPlRxz9Y2Pm/l4m5k6U99pjFw1t93WwuzzClQw7PgdThlYRpTGKVZGk+U4/FtAeV7dRfwYxr1YSUoeR0kwSfYAJ8C4dONTLfg890nwgrycOVQM8Lhmoz6VeD+L8eFxrp8sugRCCtuZ3cQri4JWvKkiIrlt5yv10WqaYX5l7bMO1WSCIQK2mmZCFiIEpVto3MBOgn/b3eK+qVvNPNLjIw7mkAVP98zFn1qjjxa3EE3u/pj/82jsqkEEktDWnEIshV3MLmWxnWvQ9deiIBDB1HnhuHLLQsXZwXIGz7sxN4/5JERrgJkVRJ1UgHYCxkROJym3/W2PINnfJ0wRfOsNimpxCKR7mfuPUDnwI4x44cDGlD1088UYpWubnvCJwC9l3FhMJbAMoDegO3iDmRTu2con+RXVydXHmI2gFDEO2duTe6jJJSmHTa0V1uUx1sNK8CzsaKEugswmCh2VBemf0/J+faES0LG/cc+66+f7n7TyY1/itX6Z/gjenV7cmIL6/ngYi1GAngfWcCy6MzYvFDcAFO9nvnLVz74bc028PbflwMhRxF0HaQjMy29XXhYbQ5VTAy63Iv+FTqU8E6G60TQdzAUvThc8UfAtM8IX3Uc7HsJEol24dRtYxSD+ ISESNHlp D+Sk4Pw+HdNMaluIMCjU+rEBx54XXX0ZuXa0LeCZYSUe2ePUJPTWacfngZ0GE4QwT5UX4YXmZ6ZIr4ujHr1hXlgWWN5pRGssFxVPuBZZnVkg7Gjpnd0j5rPqSzhWGQ9poTZ33U2t91d1xZoD2R8pqNmHv5e9vn/nfmDTAtvZKAc0KSRyM1Gvjd5ULbY254jlQidEiBMKDVOgtOwgxMmRWyiUcsY7QUaT6/BgdoN2ectRbkj82VEyZH4A/duEGX4rIH6z2UM2BCOtg4N7mEVesrj6I3WQqwlW4vDPL 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: 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()