From patchwork Tue Dec 12 19:12: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: 13489783 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 C858DC4167D for ; Tue, 12 Dec 2023 19:12:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D5966B0334; Tue, 12 Dec 2023 14:12:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 484B06B0335; Tue, 12 Dec 2023 14:12:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39A986B0336; Tue, 12 Dec 2023 14:12:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 28B636B0334 for ; Tue, 12 Dec 2023 14:12:15 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 03EFEA083E for ; Tue, 12 Dec 2023 19:12:14 +0000 (UTC) X-FDA: 81559111830.06.3CB3109 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id 47F5D140010 for ; Tue, 12 Dec 2023 19:12:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="nJ/ZB6cd"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702408333; a=rsa-sha256; cv=none; b=Ctajl5MMTVIHboiIO3dLrckc9moO32jpE7wi7mgefk34MX6M8bTv6lmjjwPS6ZDoEHDJJo D+ANuCeC5F9xa0E5wTioGuZxG3ZsC44YSWQIGy1BLQjydx49rPVRCLYRvmCkBvcU+qeSmv FO+Dc5i/wexWW2DotHAGwDHBBQ6aayM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="nJ/ZB6cd"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1702408333; 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=sWvEIlJSWFiw21NpTm+OaaSQ2s3/tHxIehSTv11tqCw=; b=x4B3auwNpSUTMAKyrfCnkY9OLDXtVQM3n8w1FUtZaC9z81QtAATqM5X9UGeC7xd2+pMLj2 pYw/gaAKKNt+XnbwgkJDVcQfAEG1Y1NZQdddQIyTnTrD6BpH3quE4I0DXglqTa7I/1z2IU bspBGEghXQDNlfucfYm7CtqQaG4PIlA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id A1A17B81097; Tue, 12 Dec 2023 19:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67E6EC433C8; Tue, 12 Dec 2023 19:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702408331; bh=6tke9Mw73/PmV6sucCIPXGu5OGZe4EV0PkE+FQKIYKI=; h=From:To:Cc:Subject:Date:From; b=nJ/ZB6cdaAzYm2iVfPA9pB4Kwf3IsNZ2cd5012uIiLCKnE8RjQKaTJKbdn/8HggFL JvHxekh3fKJhlTDeQ/zSEfKQ1OWLhCItYUItlw4h952ge07YwQt/pxbaaLZkUKcSO1 y2M6qwdV5GYGwNYGUk0g7gmKprHI11sKdJcJnpMJPY8ObZmVgS9EQW5V3IByuGOUMA srxSoN8X7xIHv06AGfa73Sp/Fjt1qzTEbq10E/vnpXFmnnPTRvSE4JQxCHPOzfM5nX 0NAg5wdjmhAJ3TTdZGF0MpX27kxvyl+Ra8R4VU2barlWQvfHh73WyMAWzgahAqKX/C f2pV37Ciqcc1Q== 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 0/5] selftests/damon: add Python-written DAMON functionality tests Date: Tue, 12 Dec 2023 19:12:01 +0000 Message-Id: <20231212191206.52917-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 47F5D140010 X-Stat-Signature: k6fj4i694c6yw4kuh55ifdyy5xrpsf9m X-HE-Tag: 1702408333-482381 X-HE-Meta: U2FsdGVkX1+1uApYhdU+1wkdPWahTA27lJDCnMIMI1Kunv61RtNLD/e7kDa2pmNFfYP2jIURZFXQ1b0otZJN40KzAEcNSdDZdmi0Xec3pDCJRk5cp7z2XZc6hGNAFDFEk6iKCnGhshFz1Fm8HSxEyhOURSpaPjkUTyA2XfRjAEnJ0HGLHdcYhaP7uMjiW55EPF+MMKflAiWCjOJNLWM4nNnfrQB7Mf9ilvpzwdNpPvvls5UPNX10kr21oBBneq0ZQlutUUv/qkGm0tgfpm6jPGbt99ZsWbFo5Yz3HeWLj5I1HVOP4b9kuHlHa3wNDAmd2NG8z+tjj4FjCCXIlhBbZ2B0dF+JspAN0v5R6AABIpqn9RvQ3/lMQ4WzrKTgy4t4w83iYy9M2+FVfoofUfQ4Drxp3oMXRhu8r9wo0xWQ07eN4I9OwhLpxiFe0G8T8NAMozxC2v0OXVCajgPuYSi0RM9PpIg8e+U4LIx5fv8z0U+hK82wj6QW6RDrfaaxnSqPkQGoY4svZuqdw3bSDmcWS8lqvrgQhNJOGiVz6ZXpe2jQcF3Uj13FMHIITM7OLsFeZg3/lwk11MGGeYBzer1IwnFculpEe5a8RwnFOSjPBImGg9g/f7WAlYHhLtydBq1A+n9ydy97LPTDCo93S2XBpOjaT+7QAoO0tAKbRUx3pvgyeoQ6VwYom9FY0kJRvkKkG7oLncoaE8fBrBWi+PsF/8OBeA/3iI+VFUQox/Nxw+llRWATyvds7fob8vGb+Z1VaPcGXrQpgz6s8A8lkAibQj5PPUpqVlVEnOR2FYXM39JCPo0s58TTOIhco3TyQYg62LtOnRiz/inNeHiXXtN+Gw4uSbf5TV96C9xmCKlKrifHkrjQNprE1qLMQoAjlvrAzbvQu/9uZjw0F6Lj2bN/zCIE9qoIfxSivziWUPQr5HPmnKWXhxtHaqngXHmyz5/T54Qo0U43kq7EcBBKzoD /jfCUkF0 NXn9yVSxp387sIPW05W0DvV1DFA9kbFZ2GsL51UTKf0D8RlkGZPJspP6k0y9amUfomTfTfsoq+x1ogrNPGtd8ljdosVdIBnW1zg2y+lDLAmBtuqTIe+vrHvF+hIs7HMlgF0PQ8Yi0TEglK7qscHAmY8DpBBquoHohizyA11giRD+KkBNPymP7OTK92bEHUsRjwbulJt6BqtF3RBHwunC9bkBuhsdFror77LYkywhPi3LbXPX+mqaApt1Pu37mf+oBMgxL 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: Changes from RFC (https://lore.kernel.org/damon/20231202000806.46210-1-sj@kernel.org/) - Make the working set size estimation test more reliable - Wordsmith coverletter and commit messages - Rename _damon.py to _damon_sysfs.py DAMON exports most of its functionality via its sysfs interface. Hence most DAMON functionality tests could be implemented using the interface. However, because the interfaces require simple but multiple operations for many controls, writing all such tests from the scratch could be repetitive and time consuming. Implement a minimum DAMON sysfs control module, and a couple of DAMON functionality tests using the control module. The first test is for ensuring minimum accuracy of data access monitoring, and the second test is for finding if a previously found and fixed bug is introduced again. Note that the DAMON sysfs control module is only for avoiding duplicating code in tests. For convenient and general control of DAMON, users should use DAMON user-space tools that developed for the purpose, such as damo[1]. [1] https://github.com/damonitor/damo Patches Sequence ---------------- This patchset is constructed with five patches. The first three patches implement a Python-written test implementation-purpose DAMON sysfs control module. The implementation is incrementally done in the sequence of the basic data structure (first patch) first, kdamonds start command (second patch) next, and finally DAMOS tried bytes update command (third patch). Then two patches for implementing selftests using the module 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: implement a python module for test-purpose DAMON sysfs controls selftests/damon/_damon_sysfs: implement kdamonds start function selftests/damon/_damon_sysfs: implement 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_sysfs.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 | 55 +++ 5 files changed, 454 insertions(+) create mode 100644 tools/testing/selftests/damon/_damon_sysfs.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: 5794dfaf6d1be564b0912d51d8a714baff329495