Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E1B6C65C30 for ; Sat, 6 Oct 2018 12:11:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E50B22064A for ; Sat, 6 Oct 2018 12:11:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="U5Kqy9u8"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="n3ERcl07" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E50B22064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbeJFTOh (ORCPT ); Sat, 6 Oct 2018 15:14:37 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47308 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727808AbeJFTOh (ORCPT ); Sat, 6 Oct 2018 15:14:37 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 62D0060C4E; Sat, 6 Oct 2018 12:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538827895; bh=x7M+4USoosukKJfGGrHNgFh2JTWrTnylI67ZlIWBTUM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=U5Kqy9u8Njn863/fyQrHTkcxSoEHeyIraI4GqGthlud4eQg+F74hZxpI1NlwYiXn8 73cpCj/ZD3tPYPowvMhcJ65fqkUNYLfnNhQF+/Qf9zawgW8vH72gJwQRadgarVk4Xv PVGWfA5KSXYZBgaRVhFqdd6rsZ/Cf8QpJbcZLH9g= Received: from potku.adurom.net (88-114-240-52.elisa-laajakaista.fi [88.114.240.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 74F0C6053C; Sat, 6 Oct 2018 12:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538827894; bh=x7M+4USoosukKJfGGrHNgFh2JTWrTnylI67ZlIWBTUM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=n3ERcl07RdNFkV/l9mxw8uMy7DrsagzGsiTpCvRx3Sh43JewVbh3SI38zjFlHEORI YjlybDCJXJrXb0Rjgf/lV2Ks+z0jRJih66577/6TJWe01ruBDoepreZy9DCDFZjKCm 9Bwju/N8ZlurPXZhjhs9SuY5XZpTssvhi5BjqTT0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 74F0C6053C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo 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 Subject: Re: [PATCH] wil6210: fix debugfs_simple_attr.cocci warnings References: <1538737646-118337-1-git-send-email-yuehaibing@huawei.com> <877eiw1wol.fsf@codeaurora.org> Date: Sat, 06 Oct 2018 15:11:30 +0300 In-Reply-To: (Julia Lawall's message of "Fri, 5 Oct 2018 16:29:54 +0200 (CEST)") Message-ID: <87pnwnff65.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. -- Kalle Valo