Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1407963rdb; Fri, 1 Dec 2023 16:11:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeMPvE/S/KhZS+qSC5cdcsnmk3DomCLRlyvY2ED6COPkXaOTIKloMmrYsfmqiiheh0bzSF X-Received: by 2002:a05:6602:68f:b0:7b4:2c4c:a074 with SMTP id dp15-20020a056602068f00b007b42c4ca074mr16818iob.28.1701475866209; Fri, 01 Dec 2023 16:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701475866; cv=none; d=google.com; s=arc-20160816; b=qTjF7qCeVZW3CzXSqpKC81zL+Tu/PEyXtOc98Uv6y+CSEzcrbontBKnX2C/j02gw3I xN+PIncSjSs/hDedr50QfOLaWXVtqN5ZmCXJD7CrV99Ur9FOXRiB/JGUXEPk7VkY8pFQ mtVK8CB9Mps1L8BCHvC+Q11SLyzxptY+xk4MfUu/zFv2H0wlirRAV0HwumH+oXaMJ3HK DFjwF8KfxtjEnU1Sdfhm5BvPqFOYP8flyyXEYtTd+emcEHorwGLHWCQ0bqWaaRKybSCv BnHJe5xjwQfSp8AsoksPN/ao712VITP7tvm0B9xKYYilibyUOJEml1PaONwz0+sMzkUX QASA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=SFjOn3zCIEsHhiaspJ6pQfeVLQd0iPHQgxP9v7/t7xw=; fh=W+de0FjxL1MlRh6Ly02q9tA2/xTz2DOJsg1VkI/mHfI=; b=bYOOANgNGjATZi6JyXWp0ecMgzqZGtS2O5d8BVuAi8wPyYMojogBilUpvY3wQD9aip brC7zpw1wo3lc+GKKsdqYUONgXb1Up5/776XqH4BLGX+XGP+xrY+lEtmoi9rwO+lXkEX bXA+Ggh3ot8dFh3FxAxzvDFIYj87mpeJc4HJ1MyyGJDjJ9T/C9+hsC1PP82ZeXWrrOeS GCkSYiGm3w0puGcj3xnz1Zc/EaZncNVpvFHfEAOxUK7zhP6MJZc7Qb1pkCBLKWA/7d3T dedmoeMOD0d5v+JxOIZenmZus6z0ybo4BO2N1++7/L2WPTOizUtKDlmvE1Xfmef9wXwm 4Dbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=lgHf7Eo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r7-20020a63d907000000b005c278464e08si426480pgg.275.2023.12.01.16.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 16:11:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=lgHf7Eo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 6D1818184E15; Fri, 1 Dec 2023 16:11:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235363AbjLBAKy (ORCPT + 99 others); Fri, 1 Dec 2023 19:10:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235389AbjLBAKg (ORCPT ); Fri, 1 Dec 2023 19:10:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45F7B2D41 for ; Fri, 1 Dec 2023 16:09:41 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA99CC433CD; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701475693; bh=0o1OidTQa+jBmmayVqOJ5Gh8ghc1rg4/WI7HWKTJJqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgHf7Eo3aY6hqilQ6vhoUxZZ0Dc2Zeu3gG4+W5pxm7RRYGGlX6sRPfdd19Ii+dGRU 3b9OCW1b8U6a+3cQY+1RZWwDJqfWWXvPCDWx/MFMLLBT0neQjeR8jtY/JV+Z7x03qx dYbsUMgMGYcmq39jD6IJoUmkxwT4DwdLsNjOBAXOkWcfOuei2nWCGBKrbOs8JoIrY4 OieJhlPmDjSE47hOJ9n1ygykcGnoQsGp/C/DuZ20al10JgSmXbU7X+xkKJOxRh51Ie kBxeDsvx0mPcaXCorB5l6mp4p/vYCUQ0vBhkwzggPNMJ8/arJWGiklqERGlbq77zk6 3PXJSOLrvCU5A== From: SeongJae Park Cc: SeongJae Park , Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 5/5] selftests/damon: add a test for update_schemes_tried_regions hang bug Date: Sat, 2 Dec 2023 00:08:06 +0000 Message-Id: <20231202000806.46210-6-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231202000806.46210-1-sj@kernel.org> References: <20231202000806.46210-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 16:11:04 -0800 (PST) The update_schemees_tried_{regions,bytes} command was able to be indefinitely hang in some corner cases. It has fixed by introducing a timeout for the command[1]. Add a test for the corner case to not introduce the problem again. [1] https://lore.kernel.org/damon/20231124213840.39157-1-sj@kernel.org/ 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..14187be3b004 --- /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 + +def main(): + proc = subprocess.Popen(['sleep', '2']) + kdamonds = _damon.Kdamonds([_damon.Kdamond( + contexts=[_damon.DamonCtx( + ops='vaddr', + targets=[_damon.DamonTarget(pid=proc.pid)], + schemes=[_damon.Damos( + access_pattern=_damon.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