From patchwork Mon Oct 28 23:30:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 839233 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 354FB1F8918; Mon, 28 Oct 2024 23:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158266; cv=none; b=Y/13aaAQsltuP4GxPF3yMsD/NjAxm5UP2XnglhOXnUZnK75M63zKKgYCQeUYthi7m2GQch1eE9EffZaPRmLV1hOHoWRj8oDsfObvk69/cxp5ymaFkZnaDVtcUiBQyWFmc+7egdtob1IhnfwRAlsKSK7mAF7UeHl77Dt8TvvwqfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158266; c=relaxed/simple; bh=xqdqcFrJAdIHqtvRzPwvhIaKJQv8dhV6x+KleToE+hw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AZeyjqBe229qajlo1Eu+SQ8lzMUP3GyR8OCS7uakB2amFcvnPmH6O8OXfdrw/u7p5dBxjXhuYUSWv88xUG7f15IcUJecnGzgkkDei2gWMMW6tXvpK5dB7GBkdqQO1vgBCpJ/C+VXcF1q7XlbG/Rp+6+AvKAYrxH0W8gvCBqVex0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sluuL5Qf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sluuL5Qf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1D40C4CEE7; Mon, 28 Oct 2024 23:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730158266; bh=xqdqcFrJAdIHqtvRzPwvhIaKJQv8dhV6x+KleToE+hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sluuL5Qfuq8491dKARsQzWeCtUedCMTYGcyGjvxjlRv5WlaXuUh/5QlkYD9CgXlCZ QTkVugJy4hHJGuxbXmKHkCzJfV1HSeIeqOG+0I46pnvhANoxtU0z+fA91AQFi9bgAB hA2br121iIiFL/DihHj36y0zePO0y/8ewlDotbHHO7pnjTKFOKfsWAVXDkgyhsZV1a qP9y8Mrqymaf2EsCdsYQXPKdz8tf4JrFHyaHYLCl4w7tIwA5/UXkDwSrj7W48cX1Os Z1aPgduqXj62mbPP60QuPCviIf/QpxLDJC4vlqTscmP7uvdlzFuEyEa1ZldsyviNi1 zrY+2zZWJhBzg== From: SeongJae Park To: Andrew Morton Cc: Andrew Paniakin , SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] selftests/damon/huge_count_read_write: provide sufficiently large buffer for DEPRECATED file read Date: Mon, 28 Oct 2024 16:30:53 -0700 Message-Id: <20241028233058.283381-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241028233058.283381-1-sj@kernel.org> References: <20241028233058.283381-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Andrew Paniakin 'huge_count_read_write' crashes with segmentation fault when reading DEPRECATED file of DAMON debugfs interface. This is not causing any problem for users or other tests because the purpose of the test is just ensuring the read is not causing kernel warning messages. Nonetheless, it makes the output unnecessarily noisy, and the DEPRECATED file is not properly being tested. It happens because the size of the content of the file is larger than the size of the buffer for the read. The file contains about 170 characters. Increase the buffer size to 256 characters. Fixes: b4a002889d24 ("selftests/damon: test debugfs file reads/writes with huge count") Signed-off-by: Andrew Paniakin Signed-off-by: SeongJae Park --- Note that this fix has originally wrote[1] by Andrew for the downstream version of the same test. Because the downstream version is hosted on GitHub, the original patch was posted via GitHub pull request, not to the mailing list. [1] https://github.com/damonitor/damon-tests/commit/fec6e1f4559a tools/testing/selftests/damon/huge_count_read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index a6fe0689f88d..f3c199dc8eba 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -18,7 +18,7 @@ void write_read_with_huge_count(char *file) { int filedesc = open(file, O_RDWR); - char buf[25]; + char buf[256]; int ret; printf("%s %s\n", __func__, file); From patchwork Mon Oct 28 23:30:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 839232 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 599A61FCF7D; Mon, 28 Oct 2024 23:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158268; cv=none; b=OzQzvj6AYfBe/0X8/rzMuohasZSYQpOxghyjv2qKqAd4hSHPvivB8ibupqG0LzsJqOBMRCCgGT+JKidCWc5shWt3b04rWxiEs5Daq/dMOdHefha8p9rLbBsy0GKB2oy7v1E2Vk5ShBiWxPLifQ47nYV2d1JJTuUQjMXW16I36Vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158268; c=relaxed/simple; bh=idVdmUJpd0kKngTICLupdXkDOcOuKWqMVDyDAZgda68=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YXSDjDS68GEFQY+A3iQlPf2Lgjan+FddP/mPs9Y5cJDoJ/hxrjuATxcpXm+l2/4OXR53/X56YEFDWPWbe63RgznvuP1GGwj00//FJxg2VUtho8vNn2xrKlLQ3EgU72KSRJ/Z0Cx/RkJQlnFnoaMYi0be83YE+YIGmrsE5Vbrl5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BYTIyDSi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BYTIyDSi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8D06C4CEE8; Mon, 28 Oct 2024 23:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730158268; bh=idVdmUJpd0kKngTICLupdXkDOcOuKWqMVDyDAZgda68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYTIyDSi6xXgUW8HyyzmFDNShNtw1yPARHNH4+iwKE/ioypAD4Au97MUfw9t/f3wn dqisBPpIwXaVZb8AssUCwu2/nv8KS913DqCXg+Gk+CVZAP/us4MGSO84A573tivlzH aC21hEF53GSoRnTzeCJEuONfHBAuVcpf2xeZW4lIjKClH/EB6IwdorDKHvHlHzquoM JKTeMs/DzLjkD3cYpkDvB3hi+KskrlR1rrkMr+P1LAvNVB27iEJVG84Ir3nn1Krq5D /4pUSxYlO2gg6TrpETVbN2TIF3NGCH146rbbe4+Gx/nzc8eu6t/MmfDGd6as6qjdfd +NG1uNGNAI/1A== 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 3/6] selftests/damon/_debugfs_common: hide expected error message from test_write_result() Date: Mon, 28 Oct 2024 16:30:55 -0700 Message-Id: <20241028233058.283381-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241028233058.283381-1-sj@kernel.org> References: <20241028233058.283381-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DAMON debugfs interface selftests use test_write_result() to check if valid or invalid writes to files of the interface success or fail as expected. File write error messages from expected failures are only making the output noisy. Hide such expected error messages. Fixes: b348eb7abd09 ("mm/damon: add user space selftests") Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_debugfs_common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/damon/_debugfs_common.sh b/tools/testing/selftests/damon/_debugfs_common.sh index aa995516870b..54d45791b0d9 100644 --- a/tools/testing/selftests/damon/_debugfs_common.sh +++ b/tools/testing/selftests/damon/_debugfs_common.sh @@ -8,7 +8,12 @@ test_write_result() { expect_reason=$4 expected=$5 - echo "$content" > "$file" + if [ "$expected" = "0" ] + then + echo "$content" > "$file" + else + echo "$content" > "$file" 2> /dev/null + fi if [ $? -ne "$expected" ] then echo "writing $content to $file doesn't return $expected" From patchwork Mon Oct 28 23:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 839231 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85CB9200CA6; Mon, 28 Oct 2024 23:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158271; cv=none; b=agqM0lpQ7zDhkEB/SceU38ClW34ayse/daQQfQCKPpmrJopoY4yaSvsy8WGryntnxKzbUawtc6XtkVWA34Z1pX5pMkpQ2eLHXNTB56T8X7ebj0zpU4Yjh3JO0mxRl8TZkiVC7nDJq4oQ1tI/nplrU2scsYmQ69hspK3WBU1VYss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730158271; c=relaxed/simple; bh=SlHvDphEAy4awEmwSNRWCo+v7tVbgoHm+S7EddVhM8A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X4aOF/y7P61JZULALLwk2BZsgmPadio++KNci5AnI85gHIyBmLgb5woH1Pz3twsqXw78Q8SXAx0vtFSd/IuGhuXLGIwsGcQ7+W9xZ7xAHrdVheOQY1TSLBhYR3MCy/DSSVSij/uXHvIDLY3qKc9hHR/Gyxf/uzIdZTu7pt2sCLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qxwS+Q8p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qxwS+Q8p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB4E6C4CEE7; Mon, 28 Oct 2024 23:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730158271; bh=SlHvDphEAy4awEmwSNRWCo+v7tVbgoHm+S7EddVhM8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qxwS+Q8pmd+EYvpeVmCCR+TKdaMXzXDJMb3D5yUmekm8IKdyHe7kh5nwzljScU7D1 J4Xb2hVbWrJn0hnZmw1GSWp9SRkvqjwMCSoNjtqtH+qHlJQRfMV8r884RAGKUIDLXO ioD+vStofbYdL2pEuiMzOcjuHPLF8DOmnR3e/uEIqALom7LrOp3o+H8jDEGJJn6z8h 08SKZfH4EwsT8HRzEX6T5Ms0jDrsDbSwzmoRBJNJ4GptWDglY8LfjB9rcwPkRdp/32 L1mQ+Mrxxq2tVhO6LuvN9p+8g9VecLGAOg7pujKDjgB+ZI7PccBd1lReJdLkB+Xu24 l67WbyVEiPFxw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , David Gow , damon@lists.linux.dev, linux-mm@kvack.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding ifdef comment Date: Mon, 28 Oct 2024 16:30:58 -0700 Message-Id: <20241028233058.283381-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241028233058.283381-1-sj@kernel.org> References: <20241028233058.283381-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Closing part of double inclusion guarding macro for dbgfs-kunit.h was copy-pasted from somewhere (maybe before the initial mainline merge of DAMON), and not properly updated. Fix it. Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") Signed-off-by: SeongJae Park --- mm/damon/tests/dbgfs-kunit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/tests/dbgfs-kunit.h b/mm/damon/tests/dbgfs-kunit.h index d2ecfcc8db86..087e53f641a8 100644 --- a/mm/damon/tests/dbgfs-kunit.h +++ b/mm/damon/tests/dbgfs-kunit.h @@ -168,6 +168,6 @@ static struct kunit_suite damon_test_suite = { }; kunit_test_suite(damon_test_suite); -#endif /* _DAMON_TEST_H */ +#endif /* _DAMON_DBGFS_TEST_H */ #endif /* CONFIG_DAMON_KUNIT_TEST */