From patchwork Sat Dec 2 00:08:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13476684 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 8FA95C10DC1 for ; Sat, 2 Dec 2023 00:08:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42BBA8D007B; Fri, 1 Dec 2023 19:08:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DBA78D0001; Fri, 1 Dec 2023 19:08:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CA8A8D007B; Fri, 1 Dec 2023 19:08:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 20F538D0001 for ; Fri, 1 Dec 2023 19:08:14 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0154C40377 for ; Sat, 2 Dec 2023 00:08:13 +0000 (UTC) X-FDA: 81519940908.29.B0179AF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf27.hostedemail.com (Postfix) with ESMTP id 41EF240017 for ; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r8GrkEMH; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701475692; 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:references:dkim-signature; bh=ovjBgyZCgseCEX5Oq1lZRYgY32VGTRqoe5THrvpWPpo=; b=g7fbG6Oogm7rs8MgvpiFvjSjt2G8OWPsMkNLHFXmzuMeD10Kr5I3BCaz2QJM5mF/uOUTdJ VnKDcpaFsG9xZoBG9iRupauhBIUE+4CaoUjhQlIohudB0votM7cu+pQGPgu3wg3BCUWYcE Q/fg4VcoBmvCzJjblrEEt12FLpbgCQI= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r8GrkEMH; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701475692; a=rsa-sha256; cv=none; b=f/HLQlTlgMYb+6GgjojbW6oQrj8y+/ubO0sBRXIiN0FksglavNRT9qo8QhPlK2BBJNt1nZ gNvyHul3XeuKye665Vs5aL0fTvx/zDoAkjQnTSl3eUbb1RfGMd8dhbR0wcGSTW/HnLwg1a ObwPgRg/JdSZwYcYN6EKWBMafQNQjtw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 7FAF3B84901; Sat, 2 Dec 2023 00:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CF17C433C7; Sat, 2 Dec 2023 00:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701475689; bh=A1C2zs2bNcPgxvWmPkcCx7AYSR8F7j9qABqqkUnLgSo=; h=From:To:Cc:Subject:Date:From; b=r8GrkEMHKqnkzCBxXV6dk0fxj2hTrFflggLRLPq6CrikzGUQ5hYicqP17L4pqk5NL Kvqe9zz5t9W1mV8znjB0kuJ4IkkBiUTPOonMYIk3B+hPQqFdmt9wEd6qBojTO6X6y3 VaF7fIoMCcnsZ6IuXrbJQ6Q22BzyAY+dfkcgJBrg76baKN3JK/XJx8b+rQimNIWkr2 FI0XLIJZ9d9eDnKddcwIzMG+PHxfpY8uOfAZBS92pH3kTqaovu87UFYYgPaoOV+2iX mUSzyhjCX3Be3paIV1thkachdpMZGQgEWmMK9DDpQFtn8QRq2Oz5CEE4I/GNzG/gyn Xg6V2D4b6/Rrw== From: SeongJae Park To: 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 0/5] selftests/damon: add Python modules for DAMON control and functionality tests Date: Sat, 2 Dec 2023 00:08:01 +0000 Message-Id: <20231202000806.46210-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 41EF240017 X-Rspam-User: X-Stat-Signature: kn7dpky9ijwaho34485cg34oewzupdw4 X-Rspamd-Server: rspam01 X-HE-Tag: 1701475692-290640 X-HE-Meta: U2FsdGVkX1+T9oo8l2tzZMuKRbWUfNpW5fgikfPxxQI875ocdMdx8zOf9W+YLR3Z4hcIon+XVgwfmT0igyIdfgeFI6NPm6HbR8M2mdncAZ4LhS3KUGenqdQsp8UJbkUz/nukALb+aoVddO08c+9jEbwbsYWpeYcbwrRvYavlDXMAnm7j5/aXWKMmx+FbT1K3I6RDuiS6vRkb3xCZfIV6gOeCjPxrKE7b+KEgk6A90BkzEFHgxUp527lk3OYevfjf2oae7pB+UeCiynYgpYbd9T/BpvRYdy3/mhhrAdaq/mgpmmSQR5dB8L5TrV9OuXkMHMAF6ur6EaDtJom6nOJK+RtpRSHHD4FrVka52rLsqh4tys/3galdhmwnKM1Kp7K7mp+20X6HuieYphnUA9TPypUss/eGE64RxLUcwX7FplV0B9WCbQsGTxPXN30+8QJW3srCmalVsX9gh0j0wKJJjvwjyVdJsPRmylbzLtSvvt4HzfQdPRnkEPvagFiba3aybOmRqM6BkBftczQpa3j9DyvfP3xsuIBxnpR1DHbY95wUi8yNo55oyjH34l52878lKcpQmGGmQWi6lk/6OISsVIvtfmO9BUYTy+edkFpcippuBHgerRg4fQCpdgUIMOgX7nS/GherKdDDsGPdqEVTnpbOq89Smw13BhQwuaX1Ovhgbxk8vhON3To2OniS7z7qxshfGWXqV4UqT2Yh/vx7t99GfpRyZlpbLGUPUkYRp9H2+YGlmN8cFU8Y8JHqxlVqrQI7Of7aVUHPEugsbTEIwLDWmdAo/CM7abDMU0JImP5BiJtZZX99cO67nqL/lDoTJk2Fem/Udz7KxkvknQ9lF/w6BxXeWhQ24Sc0eU2HACcl1vnaxeYn956Q9svupivYC5g0PUjn1oNNT9H1bDBABINBu203Dl9uPKWhij2yVzBQG71Bb8w8uwpC0sDfFWnCTETyCCiGo3WAaxBB3J/ 2pPZ7fAE i4V1zVoDuTh8xiLjMGsXRhsuPSyn36dvSqVXl7HQwJNas32UgI1aq+Acy1+4HAWJd9ItZaBNLFes4fRTI674+qB2hw42cHMREtu3ArIaMX7vlEwH1xFc6sJIO+VSTI9PNJqWf3QD+Z1CbecmuCEFeLV66nBzSI/Ri9jYUW2nDS5+ROjy5fP6Yn51KsYRWhRbBOE+SbqpLhtjVy0E= 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: DAMON provides almost all control to the user via its sysfs interface. For that, the interface provides plenty of files and hierarchies. The interface is simple enough to be controlled by shell commands including 'cat', 'echo', and redirection. However, due to the number of files and the hierarchies, doing that repeatedly is quite tedious. As a result, DAMON selftests are containing only simple test cases rather than real functionality tests. Having a wrapper script that can be reused to implement more functionality tests could be helpful. Writing such wrapper with shell script might be challenging and not easy to further maintain and extend for future DAMON interface extensions, though. To this end, implement a Python-written DAMON sysfs interface wrapper that could be easily managed and extended for future DAMON interface extensions. Further implement one simple functionality test and a corner case regression test for a previously found bug, using the wrapper module. In fact, the bug was found by the test this patchset is introducing. Note that the Python wrapper is not supporting full features of DAMON interface, but only some of those that essential for the tests that this patchset is introducing. The wrapper would extended to support more features, but only with essential ones for such future tests. The wrapper will hence keep being simple, small, and constrained. For convenient and general use cases of DAMON, users should use DAMON user-space tools for such purpose, like damo[1]. [1] https://github.com/damonitor/damo Patches Sequence ---------------- This patchset is constructed with five patches. The first three patches implement the Python-written DAMON sysfs interface wrapper in small steps. The basic data structure (first patch), kdamond startup command (second patch), and finally DAMOS tried bytes command (third patch). Then two patches for adding selftests using the wrapper follows. The fourth patch implements a basic functionality test of DAMON for working set estimation accuracy. Finally, the fifth patch implements a corner case test for a previously found bug. SeongJae Park (5): selftests/damon: add a DAMON interface wrapper python module selftests/damon/_damon: implement sysfs-based kdamonds start function selftests/damon/_damon: implement sysfs updat_schemes_tried_bytes command selftests/damon: add a test for update_schemes_tried_regions sysfs command selftests/damon: add a test for update_schemes_tried_regions hang bug tools/testing/selftests/damon/Makefile | 3 + tools/testing/selftests/damon/_damon.py | 322 ++++++++++++++++++ tools/testing/selftests/damon/access_memory.c | 41 +++ ...sysfs_update_schemes_tried_regions_hang.py | 33 ++ ...te_schemes_tried_regions_wss_estimation.py | 48 +++ 5 files changed, 447 insertions(+) create mode 100644 tools/testing/selftests/damon/_damon.py create mode 100644 tools/testing/selftests/damon/access_memory.c create mode 100755 tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang.py create mode 100755 tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_estimation.py base-commit: 1be383c41197b82cfd51b2edc7ee515c0b786496