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: 17942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7962885vqy; Tue, 12 Dec 2023 11:48:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcTqUIWn3h+MesocjLjQBTiPHUDwAa4hOQQJIqAiFS2cpRv2VksLz+8dvKU61Hop9syw1U X-Received: by 2002:a17:903:22c3:b0:1d1:d9d9:1fa8 with SMTP id y3-20020a17090322c300b001d1d9d91fa8mr3735589plg.49.1702410512236; Tue, 12 Dec 2023 11:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702410512; cv=none; d=google.com; s=arc-20160816; b=A4Ger5NtRwJKIGnapr7Vx4fAKaBl3QywxZst7YBug9xlaKA2z/a9X7wE9q4lhNR1cc lQefMWqktb710UbaYVimJ9Yyy6Nv66PxdiBjPOo0gftMQgLHUOF+xFxloWt/5MsymRvR aPOo9SO/lB7FSL6InvQvMjO541m8wiJl5oWWUIq1dnzQM9s46bl7MN+5apKqGPN0PHvS Prmx4XSLVlTWKL/SsDlBFHD80Gu1J9VphMQMfaLUz2piDUrFGni/HIGqCUnCH+SqB8B8 pEDFy7Uk1XbZpfOubSXsqbheqNUcYROXzH5l8qWr/zmS98SmovTzY/3l4ynCgJWWuM3l VM6A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CA4JbCE7YEQI1gyfHErRoU9KVI9hcIALel18KkJioyU=; fh=9H4z7/o7y4OLn0xLmjdSk9Pth53+ED/R+iGnGlnIr7g=; b=rp4VjAb6QMY1QtR48REXVdm5B9GfQOsWLjQYAE36cims97DkSvcOYkrCr19GS1JLM3 ceRhKNYhuuMer2tkIs81qXtVzN2K1pRtxBOMF92afbBeNL5mqHj/PyMbICZ/VnSKYE3D DzWe05YUC12PREhxJvxmnt28KAaIFpEP2QGqt1BSmJX47O5ej+3m/e8cb0UEkbxvAiMj V+cp0sC3+apqwDIebru4CLygD344VkLMiBXdbIKkjJTCznwbw8rFfWHZ5wQEWhVdIsoH 6OWUPqcJV8jj4bCf2KUFmNWy8B0PJI0TeyCLXYSXqR0pwqUJtk20ZTU7m/6w6XzVPNe5 O7AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X95NT4af; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e8-20020a170902744800b001d09b2d565dsi8230169plt.433.2023.12.12.11.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X95NT4af; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 0B22F80A97F1; Tue, 12 Dec 2023 11:48:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377123AbjLLTsO (ORCPT + 99 others); Tue, 12 Dec 2023 14:48:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbjLLTsN (ORCPT ); Tue, 12 Dec 2023 14:48:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAE39A for ; Tue, 12 Dec 2023 11:48:19 -0800 (PST) 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-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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:48:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785104526815327020 X-GMAIL-MSGID: 1785106805060120515 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