From patchwork Tue Jan 30 01:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13536657 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 57234C48285 for ; Tue, 30 Jan 2024 01:36:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279EC6B0093; Mon, 29 Jan 2024 20:36:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6B96B0096; Mon, 29 Jan 2024 20:36:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F23C66B0099; Mon, 29 Jan 2024 20:36:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E18B16B0093 for ; Mon, 29 Jan 2024 20:36:01 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8AFF31C146A for ; Tue, 30 Jan 2024 01:36:01 +0000 (UTC) X-FDA: 81734261322.01.FDDD925 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id E5423C0019 for ; Tue, 30 Jan 2024 01:35:59 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ar1EzV9w; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706578560; 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:in-reply-to:references:references:dkim-signature; bh=5mrOv/KaRHlajCAYRKUp9Gv9XtpHmCRS/i1xDUtovrg=; b=CCwc/hz4+FeYcx9rNoF3KLijv2sMBbW++RjuikPLr9vN/IsyrjCMY2NCa2CcWJ6f7S9yjq mWuK95JAJgWeso2M9lajwjZPpuCB1pgs55p1N6islhiqBG4cHjXGCoK9sUKMt+nO2PXBhd qcF/kUPy/nKwD3D6/7mx89mN0DXic/I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706578560; a=rsa-sha256; cv=none; b=cXmVrJvp/fZjrrcxHnPQpIxQJhj+qeslNvN4uoCVWbidbLWAoRkJRdZOs3x0ZHVD97NuAA 5NIUNn9mLTlWoZLJJGO270YHDg6mTnMwHE945dGEEbdXEMe9JTSWD8YLHf9mwJBOE+sjAL 87jtwyiFh9j5y9WvX1F2DmmaVy1Du4Y= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ar1EzV9w; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2C3C4625DE; Tue, 30 Jan 2024 01:35:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E7BFC43399; Tue, 30 Jan 2024 01:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706578558; bh=ZtqTd8FEkkcClpmqlfGDvu7x6/2aDbjjseJMMQvFCaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ar1EzV9wNYgpLqVA34gUAYP+W08RR2XTVvtZgE00US0nj7kI9ZKC/9C//HPb7yjPx 1P28YQXu6KYnZhxlnPAyRzaD3EoOMiaVBemIcYC0xbUylzOSVORSSk6jrcjA1FOhz/ cG/tuWrU4q4wEt4TNO4bk6MHsQfTZPYx4olpMaknqtNkDxF1YAv8djDsfC/HMrnrXi TD5uvIub3mm3mocZ4dVFSt2/xzN6eCDURNSZ5UJDVTu0ij5WT0G5X/M1nyFryHy/Cx R9c83IgtwWEXPgx8V5U7cFDaq/ZC4y7Ubvj4D3sG0UMkDRG1ezz8rcDh6O1XpvtMVr VUSdhLduqygrw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/9] mm/damon/dbgfs: implement deprecation notice file Date: Mon, 29 Jan 2024 17:35:42 -0800 Message-Id: <20240130013549.89538-4-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130013549.89538-1-sj@kernel.org> References: <20240130013549.89538-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E5423C0019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: j9itjgpdazpekhfjmzxk18nu53yjgdhr X-HE-Tag: 1706578559-29023 X-HE-Meta: U2FsdGVkX1/kNdp3Ex3oeXD7/XTd7B+BGbdoweBhY9IJK7yAcDmgLjokLImk7G+o+s629zcsZB4q5ALIHvQS0lote/7McGzSPnLEoF0+D84oJ+v/Fr3YrU36C8YzGTWTsTY/fq4uYFp2XFavIS/Kl5bHc5qBaiYRbm0/w8nRRWFKQvXwATT62HdqM9X+5SVTVsh4DQwYfmVq6pytzC08OdpJhWz8LEIE5r+97h8PBhBCmWD2E/0fn+v7Hg/AH1GiFPwD5dYoI+5KXupef5lYUwq7agqN8p4B14H++XjzWcpltmmZmYpFXJ074oBrkjwK6+lXUaSton2SWG5WA9UfL0N3VGx3+Amo2Fv2/5aMcacGs7MPQTXJGadZGqwLMxbAwa5ooP3GUUtRkrogjd1WjaKS8DHvwBzegUYVnpKKhJgLnDKHqRj1k5W8B4WoYIsuEEGnblF/ktqU+Z6pc9Yrc1gQfhixeULrAXzYCq06sMMb+C2jv6ev3EHwYYrrIdaNdm54brox1Ltzn2rXtRFwjDTODp0mboghFhPI0QbNk86aNYm3eSVAkylL4KHsFMeJscfNG7a9FL9ki+z15zya/RRzrmwA7R8gIfE7qdK/bN1YLY2ryL/FPcDgPPZw+VGDq5M6E9qOZ7dZ9S/K+BiOAyDgny99EHuWz+spELvEyyVfl1MS/XOv9J1MQOFIMKV7GXqpVqk6FURPhI/iRZKEDPAZuZgNfoabPONN345eN2lqInG2zWxpDQQOH3V+3DQwhhyXZQOiQcRA5sorLaxeuCuJbtOQaGrIR0xONz2LIhLG5iJwP1qdJlQ7cSc0YpCkcugw3aE8SblB3CI0oblA3pVFf7frRf7NmZOGTt/cgmf5rMhuQnJLc0ZzI5DtyPRMWeQvNwUIWg4f2Yvws2xtcvk3CiQePPlFY0nX4rnrx3Rd36eOT6F7i5PgyR7/JWfiA6Gl2jEqIIYxq9nsCMx 2p9NAXVm i3GVGTMvosdLBT5dlAN8VRKUxa/1u9K1CgP9Ep76vVCKUVIg9+8Wb0LacRtCtWrd4lXuv50yBX0YyEKVmXnSIG0ebD4i5mI8Fc4A2YpzvZv/28jluTK1dDBFur148dgaTYb94OLYFvBMRrQS3kZcJH1On5G6yPvTWm7ZhyMfkiVnGvnZ37idml2675BTdUL1XcDYmDXoThQpmRMF+Ft9FVECKntmWLlpnvnftAq/HQTufGGFwqi+Vl7tZyX5ShyTCfR6T/OI5v8Pd8LN05KkEJeZeweYdvynkZVCZz1MO6u5fDvg= 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: Implement a read-only file for DAMON debugfs interface deprecation notice, to let users who manually read/write the DAMON debugfs files from their shell command line easily notice the fact. Signed-off-by: SeongJae Park --- mm/damon/dbgfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 7dac24e69e3b..fc6ece5a9f37 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -805,6 +805,18 @@ static void dbgfs_destroy_ctx(struct damon_ctx *ctx) damon_destroy_ctx(ctx); } +static ssize_t damon_dbgfs_deprecated_read(struct file *file, + char __user *buf, size_t count, loff_t *ppos) +{ + char kbuf[512] = "DAMON debugfs interface is deprecated, " + "so users should move to DAMON_SYSFS. If you cannot, " + "please report your usecase to damon@lists.linux.dev and " + "linux-mm@kvack.org.\n"; + int len = strnlen(kbuf, 1024); + + return simple_read_from_buffer(buf, count, ppos, kbuf, len); +} + /* * Make a context of @name and create a debugfs directory for it. * @@ -1056,6 +1068,10 @@ static int damon_dbgfs_static_file_open(struct inode *inode, struct file *file) return nonseekable_open(inode, file); } +static const struct file_operations deprecated_fops = { + .read = damon_dbgfs_deprecated_read, +}; + static const struct file_operations mk_contexts_fops = { .open = damon_dbgfs_static_file_open, .write = dbgfs_mk_context_write, @@ -1076,9 +1092,9 @@ static int __init __damon_dbgfs_init(void) { struct dentry *dbgfs_root; const char * const file_names[] = {"mk_contexts", "rm_contexts", - "monitor_on"}; + "monitor_on", "DEPRECATED"}; const struct file_operations *fops[] = {&mk_contexts_fops, - &rm_contexts_fops, &monitor_on_fops}; + &rm_contexts_fops, &monitor_on_fops, &deprecated_fops}; int i; dbgfs_root = debugfs_create_dir("damon", NULL);