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.8 required=3.0 tests=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 BE8E7C00449 for ; Fri, 5 Oct 2018 14:30:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EBA22084D for ; Fri, 5 Oct 2018 14:30:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EBA22084D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lip6.fr 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 S1728934AbeJEV2z (ORCPT ); Fri, 5 Oct 2018 17:28:55 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:62701 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728278AbeJEV2z (ORCPT ); Fri, 5 Oct 2018 17:28:55 -0400 X-IronPort-AV: E=Sophos;i="5.54,344,1534802400"; d="scan'208";a="349756357" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2018 16:29:55 +0200 Date: Fri, 5 Oct 2018 16:29:54 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Kalle Valo 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 In-Reply-To: <877eiw1wol.fsf@codeaurora.org> Message-ID: References: <1538737646-118337-1-git-send-email-yuehaibing@huawei.com> <877eiw1wol.fsf@codeaurora.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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 >