From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: YueHaibing <yuehaibing@huawei.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
linux-mips@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings
Date: Fri, 25 Jan 2019 07:54:41 +0000 [thread overview]
Message-ID: <20190125075441.GA14522@kroah.com> (raw)
In-Reply-To: <efbbf61d-0c4a-e7f6-8ce1-b5e6417afff1@huawei.com>
On Fri, Jan 25, 2019 at 03:43:21PM +0800, YueHaibing wrote:
> On 2019/1/25 15:11, Greg Kroah-Hartman wrote:
> > On Fri, Jan 25, 2019 at 02:42:17AM +0000, YueHaibing wrote:
> >> Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
> >> for debugfs files.
> >>
> >> Semantic patch information:
> >> Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
> >> imposes some significant overhead as compared to
> >> DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
> >
> > What kind of overhead is this adding, and how are you measuring it?
>
> The log message on the commit introducing the semantic patch says the
> following:
>
> commit 5103068eaca2 ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage")
>
> In order to protect against file removal races, debugfs files created via
> debugfs_create_file() now get wrapped by a struct file_operations at their
> opening.
>
> If the original struct file_operations are known to be safe against removal
> races by themselves already, the proxy creation may be bypassed by creating
> the files through debugfs_create_file_unsafe().
>
> In order to help debugfs users who use the common
> DEFINE_SIMPLE_ATTRIBUTE() + debugfs_create_file()
> idiom to transition to removal safe struct file_operations, the helper
> macro DEFINE_DEBUGFS_ATTRIBUTE() has been introduced.
>
> Thus, the preferred strategy is to use
> DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe()
> now.
That is true. So, are you saying that you "know" when you remove these
files everything is safe? Are you seeing some sort of problem with
these files as-is? If not, why change them to the "unsafe" method?
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: YueHaibing <yuehaibing@huawei.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
linux-mips@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings
Date: Fri, 25 Jan 2019 08:54:41 +0100 [thread overview]
Message-ID: <20190125075441.GA14522@kroah.com> (raw)
In-Reply-To: <efbbf61d-0c4a-e7f6-8ce1-b5e6417afff1@huawei.com>
On Fri, Jan 25, 2019 at 03:43:21PM +0800, YueHaibing wrote:
> On 2019/1/25 15:11, Greg Kroah-Hartman wrote:
> > On Fri, Jan 25, 2019 at 02:42:17AM +0000, YueHaibing wrote:
> >> Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
> >> for debugfs files.
> >>
> >> Semantic patch information:
> >> Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
> >> imposes some significant overhead as compared to
> >> DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
> >
> > What kind of overhead is this adding, and how are you measuring it?
>
> The log message on the commit introducing the semantic patch says the
> following:
>
> commit 5103068eaca2 ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage")
>
> In order to protect against file removal races, debugfs files created via
> debugfs_create_file() now get wrapped by a struct file_operations at their
> opening.
>
> If the original struct file_operations are known to be safe against removal
> races by themselves already, the proxy creation may be bypassed by creating
> the files through debugfs_create_file_unsafe().
>
> In order to help debugfs users who use the common
> DEFINE_SIMPLE_ATTRIBUTE() + debugfs_create_file()
> idiom to transition to removal safe struct file_operations, the helper
> macro DEFINE_DEBUGFS_ATTRIBUTE() has been introduced.
>
> Thus, the preferred strategy is to use
> DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe()
> now.
That is true. So, are you saying that you "know" when you remove these
files everything is safe? Are you seeing some sort of problem with
these files as-is? If not, why change them to the "unsafe" method?
thanks,
greg k-h
next prev parent reply other threads:[~2019-01-25 7:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 2:42 [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings YueHaibing
2019-01-25 2:42 ` YueHaibing
2019-01-25 7:11 ` Greg Kroah-Hartman
2019-01-25 7:11 ` Greg Kroah-Hartman
2019-01-25 7:43 ` YueHaibing
2019-01-25 7:43 ` YueHaibing
2019-01-25 7:54 ` Greg Kroah-Hartman [this message]
2019-01-25 7:54 ` Greg Kroah-Hartman
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=20190125075441.GA14522@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jhogan@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=yuehaibing@huawei.com \
/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.