From mboxrd@z Thu Jan 1 00:00:00 1970 From: YueHaibing Date: Fri, 05 Oct 2018 11:51:18 +0000 Subject: Re: [PATCH] wil6210: fix debugfs_simple_attr.cocci warnings Message-Id: <08e22040-6e8d-75d1-c0ec-37818435eeba@huawei.com> List-Id: References: <1538737646-118337-1-git-send-email-yuehaibing@huawei.com> <877eiw1wol.fsf@codeaurora.org> In-Reply-To: <877eiw1wol.fsf@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kalle Valo Cc: Maya Erez , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org On 2018/10/5 19:04, 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? commit 5103068eaca2 ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage") said this: 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. >