From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 C08EEC55179 for ; Fri, 30 Oct 2020 08:02:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 509932220B for ; Fri, 30 Oct 2020 08:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604044974; bh=sjpPspkLsWiWbFSLHAjaeQlueI6WT5/q7Z9EziIU0wQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=vYClwf3j/Sc+N1iR0qNqxk/IPEUydbCeZ7S2DyaozqqqAwLnvxbVc//qCHDZm3Mpe ff3HyA5p4UilRNWosqu99hOTxMUoSFgKQq91CoVVzNCTGcR5E0bxmVer0+Bq7IRSW/ 5NNPhZXlkQcO6g/MfiEh2f4jy5klswpJvsETM+rg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726003AbgJ3ICx (ORCPT ); Fri, 30 Oct 2020 04:02:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:33702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgJ3ICw (ORCPT ); Fri, 30 Oct 2020 04:02:52 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B7F6F206DD; Fri, 30 Oct 2020 08:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604044948; bh=sjpPspkLsWiWbFSLHAjaeQlueI6WT5/q7Z9EziIU0wQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VbONgRrLC42ZQFZhvxtyCZWX4k4LA6yxZEzKU7qVlAJvFRe1crGjYUjeJGfeEVdOf lVayfrDrNhKZq358K3LswRdStjL7Gwo1L8DNtWjDUn2MPqzmRuEjmiM2BBUb/dBOHH Orh7h2x797L4hI4r7sZjjgnytACUICBpQ7aGblkk= Date: Fri, 30 Oct 2020 09:03:16 +0100 From: Greg KH To: Deepak R Varma Cc: outreachy-kernel@googlegroups.com, Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, melissa.srw@gmail.com, daniel.vetter@ffwll.ch Subject: Re: [Outreachy kernel] [PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe() Message-ID: <20201030080316.GA1612206@kroah.com> References: <20201030032245.GA274478@my--box> <20201030071120.GA1493629@kroah.com> <20201030075716.GA6976@my--box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201030075716.GA6976@my--box> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 30, 2020 at 01:27:16PM +0530, Deepak R Varma wrote: > On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote: > > On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote: > > > Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe() > > > function in place of the debugfs_create_file() function will make the > > > file operation struct "reset" aware of the file's lifetime. Additional > > > details here: https://lists.archive.carbon60.com/linux/kernel/2369498 > > > > > > Issue reported by Coccinelle script: > > > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci > > > > > > Signed-off-by: Deepak R Varma > > > --- > > > Please Note: This is a Outreachy project task patch. > > > > > > drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 ++++++++++---------- > > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c > > > index 2d125b8b15ee..f076b1ba7319 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c > > > @@ -1551,29 +1551,29 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val) > > > return 0; > > > } > > > > > > -DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL, > > > - amdgpu_debugfs_ib_preempt, "%llu\n"); > > > +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL, > > > + amdgpu_debugfs_ib_preempt, "%llu\n"); > > > > Are you sure this is ok? Do these devices need this additional > > "protection"? Do they have the problem that these macros were written > > for? > > > > Same for the other patches you just submitted here, I think you need to > > somehow "prove" that these changes are necessary, checkpatch isn't able > > to determine this all the time. > > Hi Greg, > Based on my understanding, the current function debugfs_create_file() > adds an overhead of lifetime managing proxy for such fop structs. This > should be applicable to these set of drivers as well. Hence I think this > change will be useful. Why do these drivers need these changes? Are these files dynamically removed from the system at random times? There is a reason we didn't just do a global search/replace for this in the kernel when the new functions were added, so I don't know why checkpatch is now saying it must be done. thanks, greg k-h