From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Subject: Re: [PATCH] wil6210: fix debugfs_simple_attr.cocci warnings Date: Fri, 5 Oct 2018 16:29:54 +0200 (CEST) Message-ID: References: <1538737646-118337-1-git-send-email-yuehaibing@huawei.com> <877eiw1wol.fsf@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: YueHaibing , Maya Erez , linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, wil6210-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Kalle Valo Return-path: In-Reply-To: <877eiw1wol.fsf-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> Sender: linux-wireless-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org On Fri, 5 Oct 2018, Kalle Valo wrote: > YueHaibing writes: > > > 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(). > > > > Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci > > Just out of curiosity, what kind of overhead are we talking about here? The log message on the commit introducing the semantic patch says the following: 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. julia > > -- > Kalle Valo >