All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: "Pulavarty, Badari" <badari.pulavarty@intel.com>
Cc: SeongJae Park <sj@kernel.org>,
	"damon@lists.linux.dev" <damon@lists.linux.dev>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: RE: [PATCH] DAMON dbgfs_mk_context() error handling
Date: Mon, 15 Aug 2022 23:42:10 +0000	[thread overview]
Message-ID: <20220815234210.95016-1-sj@kernel.org> (raw)
In-Reply-To: <DM6PR11MB39788257B26A38FCD9DA4F449C689@DM6PR11MB3978.namprd11.prod.outlook.com>

Hi Badari,


On Mon, 15 Aug 2022 21:51:04 +0000 "Pulavarty, Badari" <badari.pulavarty@intel.com> wrote:

> [-- Attachment #1: Type: text/plain, Size: 350 bytes --]
> 
> Hi SI,
> 
> > Nice finding, thank you!  But, the return value of the debugfs call is intentionally ignored[2].  How about doing the duplicated name check in
> > dbgfs_mk_context() itself before the debugfs_create_dir() call?

Please don't unwrap wrapped message.  My monitor is not so wide :'(

> >
> > [2] https://lore.kernel.org/linux-mm/20210205155902.31102-1-sjpark@amazon.com/
> 
> How about this?
> 
> Thanks,
> Badari
> 
> 
> 
> [-- Attachment #2: damon-mkcontext-fix.patch --]
> [-- Type: application/octet-stream, Size: 858 bytes --]

Could you please don't send a patch as an attached file of the mail but put it
in the mail body so that we can easily read the patch and comment in line?

> 
> damon dbgfs_mk_context() should check to make sure there is no existing 
> context with the same name. Otherwise, it will cause failure when we 
> enabling the monitor.
> 
> Test case:
> 
> echo "off" >  /sys/kernel/debug/damon/monitor_on
> echo "abc" > /sys/kernel/debug/damon/mk_context
> echo "abc" > /sys/kernel/debug/damon/mk_context
> echo <pid> > /sys/kernel/debug/damon/abc/target_ids
> echo "on" > /sys/kernel/debug/damon/monitor_on  <<< fails 
> 
> Signed-off-by: Badari Pulavarty <badari.pulavarty@intel.com>
> ---

It would be good to put the changelog of this patch here:
https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format

> --- a/mm/damon/dbgfs.c	2022-08-15 14:27:38.308806431 -0700
> +++ b/mm/damon/dbgfs.c	2022-08-15 14:33:31.661163048 -0700
> @@ -817,6 +817,12 @@
>  	if (!root)
>  		return -ENOENT;
>  
> +	new_dir = debugfs_lookup(name, root);
> +	if (new_dir) {
> +		dput(new_dir);
> +		return -EEXIST;
> +	}
> +

The change looks ok to me at a glance, but the attached file seems not an
appropriate patch.  Could you please repost this as a formal patch as suggested
for a better review?

Thanks,
SJ

>  	new_dir = debugfs_create_dir(name, root);
>  	dbgfs_dirs[dbgfs_nr_ctxs] = new_dir;

  reply	other threads:[~2022-08-15 23:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 18:01 [PATCH] DAMON dbgfs_mk_context() error handling Pulavarty, Badari
2022-08-12 18:07 ` Pulavarty, Badari
2022-08-14 16:32 ` SeongJae Park
2022-08-15 21:51   ` Pulavarty, Badari
2022-08-15 23:42     ` SeongJae Park [this message]
2022-08-15 23:54       ` Pulavarty, Badari
2022-08-16  0:12       ` SeongJae Park
  -- strict thread matches above, loose matches on Subject: below --
2022-08-12 17:57 Pulavarty, Badari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220815234210.95016-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=badari.pulavarty@intel.com \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.