From patchwork Tue Dec 12 19:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13489828 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 701B1C4332F for ; Tue, 12 Dec 2023 19:48:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 349C86B0359; Tue, 12 Dec 2023 14:48:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D0526B035B; Tue, 12 Dec 2023 14:48:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 012496B035C; Tue, 12 Dec 2023 14:48:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DC5CF6B0359 for ; Tue, 12 Dec 2023 14:48:33 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B45C712030E for ; Tue, 12 Dec 2023 19:48:33 +0000 (UTC) X-FDA: 81559203306.08.673F747 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 0023120002 for ; Tue, 12 Dec 2023 19:48:30 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tnzxvu7B; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.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=1702410511; a=rsa-sha256; cv=none; b=EcgnYhnGoDMXn4yRQwBjbpzmp5K8icmXe1AbHrVmiWH5jJ6b/WaNgH6I3guYxAp/K7gKPb kWFYsJyoaYWH1WrFFMsxxAI3sAL8BW3zzEaTChlfvxUQFqBMJqv1N/+i59tKnil03pB+6q uyMcFyndnmpD4l+mWqYN8wF35w6TwW4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tnzxvu7B; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.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=1702410511; 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=pQbJ5V3NxZOu7OM52vlX9DRPX5ZW4g4hS+7Mx8S3N+0=; b=xEuXRxafovddCPV7M5IIHcDl3+NPXiizgmSjQg3BHnG3tu+PrVZAyaKcfzekhnB9BekEFB 27ybCFQbAzjd4mNRU3UK/z3riqhl5sbxUztw5K0V/efL0t4Yt3fNcwRaHHVfs4SPdwn0b+ zpc5cK2M5BxK/4BjqQyr+ZKi7Qy1hvI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 422D561998; Tue, 12 Dec 2023 19:48:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE7AC433CB; Tue, 12 Dec 2023 19:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702410510; bh=oqY4K6jG5BE7MOa8w7xZ5OE+AG4WMHalMWId0VgXocY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnzxvu7BVIdvv9Ic+qurUQy08ciyvLKjizQmFRbi04fR8a3sqd6LqpKeq6mcwP8Zv eY8cV+zJH2kwV7qi4LahoFIcN6NrYshFn3VFzeTRsSaFBX1dabyreTm1nT1+HBv1GC ZnNAHfBSfmGfvpivfX7vkQPeAH/oaxqWKKV8I3s0HzfGGxwSQPV/XYGGYkCmjERBzT 5KPrWUvNUwetqb/syAj2X7gA6u/ovpEZvvE+CbPXzeHzsPZxyuFCPIkubXJ67Wh2sT 9/6duqy8LuyB7t1zMc27sMWSH0zgFXE3L196jMplrgOlGxLivrxPKOBgWnMkbQULsF nlhSNbD+4hbWg== 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 v2 5/5] selftests/damon: add a test for update_schemes_tried_regions hang bug Date: Tue, 12 Dec 2023 19:48:10 +0000 Message-Id: <20231212194810.54457-6-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212194810.54457-1-sj@kernel.org> References: <20231212194810.54457-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0023120002 X-Stat-Signature: ac76fmyo5boqdk7deeqktjumznzmycu8 X-HE-Tag: 1702410510-880607 X-HE-Meta: U2FsdGVkX18hqT00y/wdfqnScumJE0IJnwdujRBK08BYs0ZBVY9l1/h6lZXR6WMIIGkhv28wq4bf5QxjsKL0o+QA+du9ZuFmRwA12pVq81Z1kU51vit4SnxldtbEYdMKstbks2Z9Had2RYfCen4BIEKbx6Ajiwi3R0R5CY9wkYFIyCibSZcNT7qnCQRJ9wApArngoe49p/11Gb1cyE3wxPJMWBm9abzqmbmUcWfPMy+FfW4r5b84cNu40K8XkG5JJCHEEBaYbtyf/Yb5D3WzBWUfGUD3TUeb3mbHs4nU3oeLmy+zOkSpo6w+ioo6n3s2CWyoEdOgmYyi7TtuIiqB+nreWQ3SD0hPjRh56XCMBYoI2cmmSPDsvQX3BQcza40eIrX1ErFaImKHWsl7ApSPmJjxgIL4WBgc9Kg/kkCzKMgQNQmsYJooMetZavT0c9fY6ttBrJlOZo/22hbvzf1gH3+UYOwmHIUlhIUUalxOy5xnVICmtNDQv/8PeTuHWT5cPqRbIqYakQpFZAWaKEowurzfRiCphkGaPxSHnxHhLWCEzJez7pHZYnpJkVhdic1lAhigYs6hgZdq8CxUHKM+aGTiJ2DiQODZIm93GwdIDBzBCvnqN1qG6pNhbSKAQ+eRHF6dlVUttppifkVePNBP4Iv3472HFo8pUiB6e1XbXcw3cYIJ+FDlYrG+MytIInkL2psACK6GV4i6rq8YfoGRue7AXojhP7CdoEO01psY03LJMoUKIBSqtgrklFQG+eL+xekUD2C4fzJIBUsOuHrO+mX438qDhGf3Leanq9461UDdcC34ykUjt1iPWm+A7m/cFeQxu/ii7WBU3+2UQBzy1auj3ePQPUtKqGiqpDGxK0Ssy0ybEvZjV1pPOnK/mX+GTsHGHSx6/UBGodC8nGfOxnl9OjGgEKT1+aK5mjNlZefn4qx/Tpy0KGcdMAQdJYSv6mra35HJ50HrFjuP/3w QO7sWI7p WdjDz9uC4ffR09LYziwl/gCHa3Dd4doEp1FBEyRCXXFifQROJWWezDE1bNd6jY7NrbaynQXPKBJPLW6vdDZtK1D4IVKdljvZ17o+49mN5O06faiqJ7wlJB05DrFZoDvqfTXgsHoH5364RI8eiG+w7C8KPb7kHzik3ljx8qdPvzSV0dsATfmJ9M3G50flAg60VayVCb7fFGgy63Luv7+/9gBjjvWpq9U3Fxj+E8drBcozRBDqTYAatoGuANfmIbLGNkGRl8AknyaLd7izZ1z7KozCAUgdKcDeIkVd+ 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 90ffafc42c5e..8a1cc2bf1864 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -10,6 +10,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 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()