Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Bradley Morgan <include@grrlz.net>
Cc: sashiko-reviews@lists.linux.dev, sashiko-bot@kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob
Date: Tue, 18 Aug 2026 12:10:25 -0400	[thread overview]
Message-ID: <20260818121025.187b1a1c@robin> (raw)
In-Reply-To: <786EF401-1ECA-4ACC-BED9-764ADFAB9087@grrlz.net>

On Tue, 18 Aug 2026 16:17:20 +0100
Bradley Morgan <include@grrlz.net> wrote:

> On 18 August 2026 03:01:18 BST, sashiko-bot@kernel.org wrote:
> >Thank you for your contribution! Sashiko AI review found 1 potential
> >issue(s) to consider:
> >- [Low] The 'enabled' debugfs file is created using `debugfs_create_file()` instead of `debugfs_create_file_unsafe()` with a `DEFINE_DEBUGFS_ATTRIBUTE` struct, leading to redundant proxying and overhead.  
> 
> +akpm@linux-foundation.org 
> 
> I hate sashiko so damn much, best to wait for review!

I found sashiko to be extremely useful. 


> >[ ... ]
> >  
> >> -static const struct file_operations fops_kp = {
> >> -	.read =         read_enabled_file_bool,
> >> -	.write =        write_enabled_file_bool,
> >> -	.llseek =	default_llseek,
> >> -};
> >> +DEFINE_DEBUGFS_ATTRIBUTE(fops_kp, kprobes_enabled_get,
> >> +			 kprobes_enabled_set, "%llu\n");
> >>  
> >>  static int __init debugfs_kprobe_init(void)
> >>  {  
> >
> >[Severity: Low]

It is even saying this is of "low priority". That means it's more of an "FYI".

> >Will this lead to double-proxying for the debugfs file?
> >
> >Since DEFINE_DEBUGFS_ATTRIBUTE natively provides debugfs_attr_read and
> >debugfs_attr_write operations that already include debugfs_file_get() and
> >debugfs_file_put() protection, passing fops_kp to debugfs_create_file()
> >in debugfs_kprobe_init() will cause the debugfs core to wrap it again:
> >
> >kernel/kprobes.c:debugfs_kprobe_init() {
> >    ...
> >	debugfs_create_file("enabled", 0600, dir, NULL, &fops_kp);
> >    ...
> >}
> >
> >Could this use debugfs_create_file_unsafe() instead?

As this isn't a critical path, I don't think we really care here if
it's wrapped or not. But it's nice to know that it is.

Anyway, I'll let others review this, but it looks fine to me.

-- Steve

  reply	other threads:[~2026-08-18 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  1:49 [PATCH] kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob Bradley Morgan
2026-08-18  2:01 ` sashiko-bot
2026-08-18 15:17   ` Bradley Morgan
2026-08-18 16:10     ` Steven Rostedt [this message]
2026-08-18 16:41       ` Bradley Morgan

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=20260818121025.187b1a1c@robin \
    --to=rostedt@goodmis.org \
    --cc=include@grrlz.net \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox