Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4878065rdb; Tue, 12 Dec 2023 11:48:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFgG5LFjQugB8x21jSAjR/VVfhhFnkvpwmCaDweLhvQg9/wRGgiJOubLfpJIWQhTCT1Vh2 X-Received: by 2002:a17:903:110e:b0:1d3:176f:b045 with SMTP id n14-20020a170903110e00b001d3176fb045mr4307778plh.110.1702410533363; Tue, 12 Dec 2023 11:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702410533; cv=none; d=google.com; s=arc-20160816; b=X4ys9TrmlKjJ/XetsCiYoTml7LiNgMbkoTfx+fL52UBdjMJC/pWmo7XB8OOhHcPPYJ Fnv0174TZGhIvVN90brW8KzUu4BDvOejY734EXWofeocd/MqIcU/FwI07vU0AlzRk2bX gZfl+ccgvGBK83WIjAsqdmcDRG73loq4QM8OLP7VM1Goy4zJTQy7uOmgx1dVwNuWC5Ho KlgH8QRX02mEPObRgU+dA0pPTU1GixLuKSV2c7+rUO8iSBYKwwfA8YOXh/jyDM7HsHKI M9nNaPPXKqGDhtUWc8uPbogvNCTN7plDzHmd9NArt6Kbj4xCJo+bp/APZil+WxgD6Slu 8ZdA== 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=pQbJ5V3NxZOu7OM52vlX9DRPX5ZW4g4hS+7Mx8S3N+0=; fh=9H4z7/o7y4OLn0xLmjdSk9Pth53+ED/R+iGnGlnIr7g=; b=OxO9JzMN7xtevfVPyt7OIGgiykMYze6uJbHXYUVfB9oraL42Eb92sUt6o2lsQBdxDc uJdmUlzgRqexPV7H6GFKF4WfyaKbbBL0icXouLw+qhFjpQCELpQJvtZXX05SOx74f85z Pscp7SSZ/LgG8vZVU4i9qarCHqEMHOOlnROP4oUtHj5iIeIaznXUxc6t4iKXrjXDD6Wm s11Ma4qL70VOSiVeiPoNfpfDhLLVoATWBbvKAGkr2wjzsf1+IIfri+/xYUUcO2B2czAJ PMJQYWS1qeX0J40JJy0frG/mk9faIyjOxZt3QOfLACsR6wwXuNJ5vfpo4BVg1IEYbGnj nYvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tnzxvu7B; 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=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f15-20020a170902ce8f00b001d09c544508si8290508plg.420.2023.12.12.11.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:48:53 -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=@kernel.org header.s=k20201202 header.b=tnzxvu7B; 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=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B675E804C20F; Tue, 12 Dec 2023 11:48:50 -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 S1377318AbjLLTsa (ORCPT + 99 others); Tue, 12 Dec 2023 14:48:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377284AbjLLTsZ (ORCPT ); Tue, 12 Dec 2023 14:48:25 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AF91FD for ; Tue, 12 Dec 2023 11:48:30 -0800 (PST) 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 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 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]); Tue, 12 Dec 2023 11:48:50 -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 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() -- 2.34.1