From patchwork Mon Nov 7 16:50:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 16575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2168158wru; Mon, 7 Nov 2022 08:54:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM4blUiR4hKxBR7sZdXZM1fQ9/WJN6Jd7TtKw/+/PNSOTufEX9cqdxNuSXhOsb75ndV9PvZJ X-Received: by 2002:a62:5e06:0:b0:56b:e3f8:824f with SMTP id s6-20020a625e06000000b0056be3f8824fmr51692003pfb.84.1667840069944; Mon, 07 Nov 2022 08:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667840069; cv=none; d=google.com; s=arc-20160816; b=GTZ1OtORCWvRuOwQcAn0nDUaqRWaOsSr93UBeROFQ/fjIqKoaPWSu8uH3qlcDZ5h70 Nl5r6OyMyIthPCUFQCUQMeoZGSkcXAgplpyijdXbMX/o9a6+nSKd/7yRINKSjH0WzUJy ebtJpmRvGw++Mip9/W5KEIeRcYMfltOBmR4uWfWQVopyk+tmEeZ1kUJVO4cv7kGUTAHF t5GhDY2BjXBTNdng8eUDaSoyzvQLY782dCDtmEfDKifcRd1wmH9VyPIodtEg7lhX0Bnl Z0Zt+Zi5gg+y4IuEbQlKqySQypdltvCeGPgIOFBYJUce3oKCK7pCnvefbSrfwWj6POOq dqzA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VgubQM217VrfKa24NsReiE9VfnfZxpk1OkuE3vLK5tY=; b=DtJJcRVaNXpUobfsYpw/oJ5igGNJ1rQj6jTZgxV1zj8UV9QZxgwXL+yZKH7TU3YIWu GxDvmnKYI0Rl10Dhu4STQCFhz+y47JfJzE5+w4Pl2GLpgC9h+j/thyAt802cl34ZtiFD Jf0oQeJ5EOac4xoEoJw2hTifGEZhz23CB8wzygxQHeyke1eabz544JwpLKmpYc9nmkNO s5cx3B7zzqHwdWpVTeHwnQqlyLUqDgjhC7GZrpdtgsK75lTjHXCt9CN2cmI+mJqCE3m0 sVjlOCHLwbkfPOj3AaAPhSkdoyheQ4SBxOxZFmRFaWheTecYhN9R0iObP672Vfee2sFR F2dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nPectMM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a056a000a8500b0056e4c95266bsi11406197pfl.77.2022.11.07.08.54.17; Mon, 07 Nov 2022 08:54:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nPectMM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbiKGQuc (ORCPT + 99 others); Mon, 7 Nov 2022 11:50:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbiKGQuJ (ORCPT ); Mon, 7 Nov 2022 11:50:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A226E20BFE; Mon, 7 Nov 2022 08:50:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5ED08B815D5; Mon, 7 Nov 2022 16:50:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D3E2C4347C; Mon, 7 Nov 2022 16:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667839806; bh=9HGMZvb82sypIRoPvUis/kF/0CFkMhQKBGHkFijQToc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPectMM1/5QJ1zmK7cZ7bFJgbJp7443q6YznAqCicO+0SL7aIL9Ou2v5xPpXfmSAr 0t3jEcSv68Hquf8wJKa8BFtg1tdZKx+GZV+3JQksHxTobX2UIy36CKcbe8WB6mSjHX LVA0JKqVZ7dGy7I5p6DnZ+XgB1Y9bUONIy2kwYw0Z5WNEng7FgZzKdSsSjdNP7AeyE HAwkI+upl+9Z3udy7DsKPi72rtgbiRJ4XxS1eDPBrlIch1b3WYrELHSZ/i7k5X3yLV vvV0sSmOfuqImb6yC++5lvOQ338tCW1j8ooYAfkAQRvzrhqoxYrCDMdoXC1XvfP21k QbWp0n7zkh3Kg== From: SeongJae Park To: Andrew Morton Cc: Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH v2 2/2] selftests/damon: test non-context inputs to rm_contexts file Date: Mon, 7 Nov 2022 16:50:01 +0000 Message-Id: <20221107165001.5717-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107165001.5717-1-sj@kernel.org> References: <20221107165001.5717-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748857069110768160?= X-GMAIL-MSGID: =?utf-8?q?1748857069110768160?= There was a bug[1] that triggered by writing non-context DAMON debugfs file names to the 'rm_contexts' DAMON debugfs file. Add a selftest for the bug to avoid it happen again. [1] https://lore.kernel.org/damon/000000000000ede3ac05ec4abf8e@google.com/ Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/Makefile | 1 + .../damon/debugfs_rm_non_contexts.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 tools/testing/selftests/damon/debugfs_rm_non_contexts.sh diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index af490acc5348..838a8e49f77b 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -7,6 +7,7 @@ TEST_FILES = _chk_dependency.sh _debugfs_common.sh TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh TEST_PROGS += debugfs_duplicate_context_creation.sh +TEST_PROGS += debugfs_rm_non_contexts.sh TEST_PROGS += sysfs.sh TEST_PROGS += reclaim.sh lru_sort.sh diff --git a/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh b/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh new file mode 100755 index 000000000000..48b7af6b022c --- /dev/null +++ b/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +source _debugfs_common.sh + +# Test putting non-ctx files/dirs to rm_contexts file +# =================================================== + +dmesg -C + +for file in "$DBGFS/"* +do + echo "$(basename "$f")" > "$DBGFS/rm_contexts" + if dmesg | grep -q BUG + then + dmesg + exit 1 + fi +done