Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3388134ybb; Tue, 31 Mar 2020 04:20:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vskpUjqNr9OXzEaRmIoapBUfxB+IMf1T7eCBAs3qUm6WFxxHg1v13tS7ZXm0IwnUifk/Sa9 X-Received: by 2002:a05:6830:1e79:: with SMTP id m25mr2678208otr.36.1585653623043; Tue, 31 Mar 2020 04:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585653623; cv=none; d=google.com; s=arc-20160816; b=KBqnH1SL4ggZNSm1pckx+oW9t4b/gWUFbeI3uOrzzTL/7WCSEum2Hcr83QGRhShidx eimrLAjOUADEr5bi3Y6cswrgT7+cbskropCBNp5ARJW5GG/+BPMsK5XrQwK6b95U4PCh iryBo4YpCBj5dLrNtRAxkVzLALMXYZay2zntjCPQGuxhX1QtzWunlrC80G9b7kJzqmEO bKI3CvrF5eUvOzbz9xZidcAjo1jJjZWNomzodkGlj1F4CdMWqIfyl+CfmRtV9/gHEJDN oZN4aKWllrXfDj5BlvoCJhcO/5baK4gGGiEuKRYt9j99zmOOlPKTRnz7v9j6Jfx7W+Th NTGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:subject:cc:to:from:date:message-id:dkim-signature; bh=qBLtW8uvZoq+p9ltVC/Y5j+G4s1oN9kaNzCh4VS1yxI=; b=RRLhHwl488SuGZa3zypjOoDceB7zedMdO11o54YA36hwshigU5olszvb1tZhdqHsbA 3C63S3a1YgyCw2fTbstvwdBViA1xNmDfaUMBvTJ60JFmqyc25tP9WNJw+6WTXlSKFmnl Ger4dJBm70J5LDJM1KJvKTsiqS2qCpAH8rHsZs5vKuKmK8/PWZ5ra6XvSO7roTRkFiJF QIUeBEL/3dGLemJ+tNuPBP/8uhLuARbLL5DtC043JHvXhQyICaPvIe7tzOVLWYk94+Nd u0cuSHcNzBBVJvOYuYvWeWSpxu3cDsVi2eZ4UF6kP9hLZZWfFptBuhje7jzeGH28dgSr F4cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwfLzDpO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 110si8017076otu.45.2020.03.31.04.20.10; Tue, 31 Mar 2020 04:20:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwfLzDpO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730424AbgCaLTy (ORCPT + 99 others); Tue, 31 Mar 2020 07:19:54 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41228 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729925AbgCaLTy (ORCPT ); Tue, 31 Mar 2020 07:19:54 -0400 Received: by mail-pl1-f196.google.com with SMTP id d24so4172915pll.8; Tue, 31 Mar 2020 04:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:to:cc:subject:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=qBLtW8uvZoq+p9ltVC/Y5j+G4s1oN9kaNzCh4VS1yxI=; b=JwfLzDpOVdZFO1406Fk+QlttCn0PO48+P8d4KPaDr9g3QvYmoKiqbbTQYy++UW9oN3 Fl0YkQBcM1bThSLhz0khZz0Vh3QgsA07wlgqlWsBHIHYqd659xlz7y30ci5gbMoX9639 WCQUK9AN09GsTdMrpM2FX3h4tlUXD189yqz9RkalaXrTo2/O/K7HLvpUtTgMkQoZnVYL RMMN6n6NyoLS5WyYXItT7T7tMSGovK3+Q4TAdgyR5ZZFluCjF79R6dlCsmRijDFRzD/g P+Fos/0RpgjJZ7CeemMRbm/ITh78RnJdool7Lh3jKuOQxrPqzqivsLC+HT9Ap7EbhveZ iYpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=qBLtW8uvZoq+p9ltVC/Y5j+G4s1oN9kaNzCh4VS1yxI=; b=rEz6Jk7v/rDAkQgrVkFQ02thGk54wj2b0AqTUDGzFmMMTnX8fQDXf7sThL14CYhU+s 9CTTH8gT5KyPwuUyiDfpVeQYnoyil1y2Z4lHeeRpLCPwp9k86OTXTGbZ/AR/sGTwQ5Qn Ov5Xr8vaTVib67clbNVo1/HeqokRXFBNYgR3G1myGItNun75nuX5NQK8EUe6DhJajHby dRwKazDKxnbu2y+TjRHIa06Go2umpfEMSn0wNzSZiLELzSqM/CJ9/YvoJo90UHQmlk2W CBHPnWwJFJUxSey4e1k016//m+WIW0Zximv76vQPqdZjJMRyAmSHycdXEccfnoqjubJH QPrg== X-Gm-Message-State: AGi0Pub2teRaSIf1wLd19OluGCvR+ssM4lnDDzU7mjnmgEmtZEcWTHiC jOhNsmB6BdEVw50NPPH/PI9Xi9bHzzNNCw== X-Received: by 2002:a17:902:6947:: with SMTP id k7mr4652864plt.222.1585653591863; Tue, 31 Mar 2020 04:19:51 -0700 (PDT) Received: from SARKAR ([122.178.242.244]) by smtp.gmail.com with ESMTPSA id q61sm1691460pja.2.2020.03.31.04.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 04:19:50 -0700 (PDT) Message-ID: <5e832756.1c69fb81.19c58.78e8@mx.google.com> X-Google-Original-Message-ID: <20200331111947.GA7750@rohitsarkar5398@gmail.com> Date: Tue, 31 Mar 2020 16:49:47 +0530 From: Rohit Sarkar To: Lars-Peter Clausen Cc: "Sa, Nuno" , "Ardelean, Alexandru" , "jic23@kernel.org" , "stefan.popa@analog.com" , "zhongjiang@huawei.com" , "linux-iio@vger.kernel.org" , "Bogdan, Dragos" , "pmeerw@pmeerw.net" , "knaack.h@gmx.de" , "Hennerich, Michael" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 0/2] use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE References: <20200328063456.24012-1-rohitsarkar5398@gmail.com> <20200329103818.2fce9529@archlinux> <74033597-c348-03df-d52f-748bf52c1a12@metafoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <74033597-c348-03df-d52f-748bf52c1a12@metafoo.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 01:08:00PM +0200, Lars-Peter Clausen wrote: > On 3/31/20 12:58 PM, Sa, Nuno wrote: > > Hi Rohit, > > > > > From: linux-iio-owner@vger.kernel.org On > > > Behalf Of Ardelean, Alexandru > > > Sent: Montag, 30. M?rz 2020 11:20 > > > To: jic23@kernel.org; rohitsarkar5398@gmail.com > > > Cc: stefan.popa@analog.com; zhongjiang@huawei.com; linux- > > > iio@vger.kernel.org; Bogdan, Dragos ; > > > pmeerw@pmeerw.net; knaack.h@gmx.de; Hennerich, Michael > > > ; linux-kernel@vger.kernel.org; > > > lars@metafoo.de > > > Subject: Re: [PATCH 0/2] use DEFINE_DEBUGFS_ATTRIBUTE instead of > > > DEFINE_SIMPLE_ATTRIBUTE > > > > > > On Sun, 2020-03-29 at 10:38 +0100, Jonathan Cameron wrote: > > > > On Sat, 28 Mar 2020 12:04:53 +0530 > > > > Rohit Sarkar wrote: > > > > > > > > > The debugfs_create_file_unsafe method does not protect the fops given to > > > > > it from file removal. It must be used with DEFINE_DEBUGFS_ATTRIBUTE > > > > > which makes the fops aware of the file lifetime. > > > > > > > > > > Further using DEFINE_DEBUGFS_ATTRIBUTE along with > > > > > debugfs_create_file_unsafe significantly reduces the overhead introduced > > > by > > > > > debugfs_create_file which creates a lifetime managing proxy around each > > > > > fops handed in. Refer [1] for more on this. > > > > > > > > > > Fixes the following warnings reported by coccinelle: > > > > > drivers/iio/imu//adis16460.c:126:0-23: WARNING: > > > adis16460_flash_count_fops > > > > > should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > > drivers/iio/imu//adis16460.c:108:0-23: WARNING: > > > adis16460_product_id_fops > > > > > should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > > drivers/iio/imu//adis16460.c:90:0-23: WARNING: > > > adis16460_serial_number_fops > > > > > should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > > drivers/iio/imu//adis16400.c:278:0-23: WARNING: > > > adis16400_flash_count_fops > > > > > should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > > drivers/iio/imu//adis16400.c:261:0-23: WARNING: > > > adis16400_product_id_fops > > > > > should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > > > > > > > [1]: https://lists.gt.net/linux/kernel/2369498 > > > > > > > > > > Rohit Sarkar (2): > > > > > iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of > > > > > DEFINE_SIMPLE_ATTRIBUTE > > > > > iio: imu: adis16460: use DEFINE_DEBUGFS_ATTRIBUTE instead of > > > > > DEFINE_SIMPLE_ATTRIBUTE > > > > > > > > > > drivers/iio/imu/adis16400.c | 4 ++-- > > > > > drivers/iio/imu/adis16460.c | 6 +++--- > > > > > 2 files changed, 5 insertions(+), 5 deletions(-) > > > > > > > > > Hi Rohit, > > > > > > > > You've opened a can of worms with this one. There as a previous series > > > > posted doing exactly this change back in 2019 by Zhong Jiang (cc'd) > > > > > > > > At the time I did a bit of looking into why this had been universally taken > > > > up cross tree and turned out there are some potential issues. > > > > > > > > Alexandru added it to the list of things to test, but I guess it got > > > > buried under other work and is still outstanding. > > > > > > > yep > > > my bad; > > > will try to make room these days for that old one > > > > > > > > I don't have the exact parts that this patch is touching but I have other parts where this patch > > applies and should be same. So, the idea to test this is to read the files in debugfs? Maybe also > > some unbind + binding? > > > > I will try to test this still today... > > The stress test is to open the debugfs file, then unbind the device and then > read from the still open debugfs file. Yes, also just to be sure, we need to test DEFINE_DEBUGFS_ATTRIBUTE along with debugfs_create_file_unsafe. I will send out another patch that changes debugfs_create_file to debugfs_create_file_unsafe and then that can be tested. > - Lars Thanks, Rohit