From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kalle Valo Date: Sat, 06 Oct 2018 12:54:08 +0000 Subject: Re: [PATCH] wil6210: fix debugfs_simple_attr.cocci warnings Message-Id: <87va6fdymn.fsf@kamboji.qca.qualcomm.com> List-Id: References: <1538737646-118337-1-git-send-email-yuehaibing@huawei.com> <877eiw1wol.fsf@codeaurora.org> <87pnwnff65.fsf@kamboji.qca.qualcomm.com> In-Reply-To: (Julia Lawall's message of "Sat, 6 Oct 2018 14:22:58 +0200 (CEST)") MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall Cc: YueHaibing , Maya Erez , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org Julia Lawall writes: > On Sat, 6 Oct 2018, Kalle Valo wrote: > >> Julia Lawall writes: >> >> > 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. >> >> I admit that I didn't have time to investigate this is detail but I'm >> still not understanding where is that "significant overhead" coming from >> and how big of overhead are we talking about? I guess it has something >> to do with full_proxy_open() vs open_proxy_open()? >> >> Not that I'm against this patch, just curious when I see someone >> claiming "significant overhead" which is not obvious for me. > > The message with the semantic patch doesn't really talk about significant > overhead. Maybe YueHaibing can discuss with the person who proposed the > semantic patch what the actual issue is, and when the proposed change is > actually applicable. Actually commit 5103068eaca2 mentions "significant overhead": --- /dev/null +++ b/scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci @@ -0,0 +1,67 @@ +/// Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE +/// for debugfs files. +/// +//# Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() +//# imposes some significant overhead as compared to +//# DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). But I'll anyway apply this patch as I don't see anything wrong with it. I was just trying to learn where this overhead is :) -- Kalle Valo