From patchwork Tue Dec 12 19:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13489824 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 6B2FCC4167D for ; Tue, 12 Dec 2023 19:48:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6E966B0351; Tue, 12 Dec 2023 14:48:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF6176B0353; Tue, 12 Dec 2023 14:48:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A706B6B0354; Tue, 12 Dec 2023 14:48:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9261B6B0351 for ; Tue, 12 Dec 2023 14:48:22 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7301FA074D for ; Tue, 12 Dec 2023 19:48:22 +0000 (UTC) X-FDA: 81559202844.16.8D47065 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id BC08C40015 for ; Tue, 12 Dec 2023 19:48:20 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=X95NT4af; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.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=1702410500; a=rsa-sha256; cv=none; b=S3SRC7BYOoHOe5tZUiQfXIr7HFM/7IBlLoXfz6FXmvzCUL2lg9yVEo8m4ljCu/0DDz3BZI 8lm2KlHsmAqP5uNs/dgQNpmxXaeCVl3BBVcav/4LNQXzxgC6JYW0TBppI0ifNgVAdKNAQ8 Iva6ztd4XzDZXrObmrL+2JRuWIa8IeY= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=X95NT4af; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.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=1702410500; 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=CA4JbCE7YEQI1gyfHErRoU9KVI9hcIALel18KkJioyU=; b=2InUzNU3L6VFscluPvvdV9iQMhcspBPzdUJgFQ1DHom84xNHxhHGYDUKpPnX5OlD+q+xTO wwK67Dzivo+leoX0pw+eLULRypujeH+TWW4d9jJfWGxYTfFVZj8MZoe/MGH6KDiiiXGv1j yII7khmY49JEHszabM4lEDqJ/sn6xfE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BBF8961300; Tue, 12 Dec 2023 19:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCFA9C433C8; Tue, 12 Dec 2023 19:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702410499; bh=igd2RnhMFXzUjNiscTu9eDHYyW+3+ewG3ZKhV0p4XGo=; h=From:To:Cc:Subject:Date:From; b=X95NT4afRyAWsTbccHx94B2W6zzknjz9JqcA0ko1z5FUEoNTBl7Ci88oljGXp5l9U +MDcVdzohghe0yxN+qav+YX16YRFRiO+7n0a8yfPKE5Uv67CS+rgZwxKw5LG992pcM lbTYfra/SJ7b4EozxyjCKF1bAGwmlHxKPhxXy1v2Nvs2LbNJMePXF0xOTsZQYoCqfe 42knU6Y/QcMzxziq4TBYGFQRm/HBIjSLfGUfqDg779PmkHUf0g4D2seuunMQv8Iko6 TbOwyb4nfQfs8hqd+lo5mt5Lt7Zr899nMncYM4jKYErwoVCVsm49Znn3CKIpO7n9k1 FjYLmCmvp/u8w== 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 0/5] selftests/damon: add Python-written DAMON functionality tests Date: Tue, 12 Dec 2023 19:48:05 +0000 Message-Id: <20231212194810.54457-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: BC08C40015 X-Stat-Signature: m9rxa5thz9t1okbrjtincr4snfj1meng X-HE-Tag: 1702410500-305109 X-HE-Meta: U2FsdGVkX1+xD/4yK1PsE9T/XdROwOL+Kj+lQoS0ZaM5yxiLS4zaOi39A5KoCVgOOjz4DjFQ1StMKxu6eIgI2WNzheGExW3vHa6VRungmMzmwYW6CuDSsQkdIWskEtUuBfUAwP3jtxm5buwvVt2W8H1tKLW8lxtFZzwnm/VexMAq4ddKgvxBHSvyjCG3Pl8ZwPfGSLYSx7pjLmdbMgTgHmJEvrpRH75IyBHkWZgwOjbdrGOz2l9zRBag/SmxvwVzxxKHiOLflXpoWcqwXWMi1nEKGNjKsg+g85ZCcfGjYQmJOo2TdoMPGx2XM7R1V0aZuhS0eU+0uq1ifPPo7NyIeXOnNbNCjVyrNb+l0SYMoIoFLOi2kCq20yvYgiCZjEHDd5///UxJ9P/ddW1Vp8CR/gh7ZyCSXuRahyYfnKni2IPCFqR5Bn3CVaeO0hqJwg2ehw7wMib+yfN3x7XB+WP1P38ULjPgsKrnNsmKvWuW9t6gW2ZH7dxGNThy/fi6JyjXxQWU3A4BNKybf8I+rc45hVySOJThUsHHJB5AaUvlpMLdmPzV2Bf4x6rCyDw3XKAIsBhyNFiWK/aLIRwsSg/Xt0bLgbecVc3OikyvHHe+M5btdyyOQCC3+Iq43ZmjxFTE4/wu7rO0TSm3v/7KNFTYTM+X5gEbw/sCEc7/2lWVyd6erU284FSpgNT7lZbD4wS7CYtpJRYdYlR1trNydD4srQ1Itz+mjITH2u21HVoH3v3y2weWrftl+e2IuxLwcIPrxpcn2sTE2dIJzpVa1wR/7j+lTbpetnP2Mua+/3i7ULHu8Zh2ZKV2h8/U+Lc8H8gPYJakpFS/D/3WES3Bj2tz6vlU0DOoA07o6nywQKgJ/6yIWKfdpEcxDugFzurLUtI0SQudXt/h3nj7IDRysCT9lOk8hSpfFy2YpTmcnPCSs/CNFKxZR7dbsKsAv5ISWySxqXzRUgYnkbf0zeqfMfR cLxJP3BO LMV1MMygDa44Z1awfNCTsclAYat2MAmNDqskUoPUpGOFvjVaw1UkO06d8sJ4NgT8qsKgLC9d4a7UJ8zjP+BJktlunHMZ5zGDzU4cYiIveFLNfZqSnOF7GshbVDeRFWP6I443xTZ+VsuLtQYbV7H6i6PFOf4g9nnhdOdDQdV3/ZKe2Uq0KQcC4wQMma6nM5cUR/x6Sd3cQMOWpanpeQukn0tUaxi2/lOvtbSuuYl+43L3KdbaFqLg5JJTSB46lmJx+9Ev65eKOWEwv8/o= 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 v1 (https://lore.kernel.org/damon/20231212191206.52917-1-sj@kernel.org/) - Fix conflicts on latest mm-unstable tree 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: 091b8c820de390a6235595bdb281edab63b9befe