<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 30 Oct, 2020, 1:32 PM Greg KH, <<a href="mailto:gregkh@linuxfoundation.org">gregkh@linuxfoundation.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Oct 30, 2020 at 01:27:16PM +0530, Deepak R Varma wrote:<br>
> On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote:<br>
> > On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote:<br>
> > > Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()<br>
> > > function in place of the debugfs_create_file() function will make the<br>
> > > file operation struct "reset" aware of the file's lifetime. Additional<br>
> > > details here: <a href="https://lists.archive.carbon60.com/linux/kernel/2369498" rel="noreferrer noreferrer" target="_blank">https://lists.archive.carbon60.com/linux/kernel/2369498</a><br>
> > > <br>
> > > Issue reported by Coccinelle script:<br>
> > > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci<br>
> > > <br>
> > > Signed-off-by: Deepak R Varma <<a href="mailto:mh12gx2825@gmail.com" target="_blank" rel="noreferrer">mh12gx2825@gmail.com</a>><br>
> > > ---<br>
> > > Please Note: This is a Outreachy project task patch.<br>
> > > <br>
> > > drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 ++++++++++----------<br>
> > > 1 file changed, 10 insertions(+), 10 deletions(-)<br>
> > > <br>
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
> > > index 2d125b8b15ee..f076b1ba7319 100644<br>
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
> > > @@ -1551,29 +1551,29 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)<br>
> > > return 0;<br>
> > > }<br>
> > > <br>
> > > -DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,<br>
> > > - amdgpu_debugfs_ib_preempt, "%llu\n");<br>
> > > +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,<br>
> > > + amdgpu_debugfs_ib_preempt, "%llu\n");<br>
> > <br>
> > Are you sure this is ok? Do these devices need this additional<br>
> > "protection"? Do they have the problem that these macros were written<br>
> > for?<br>
> > <br>
> > Same for the other patches you just submitted here, I think you need to<br>
> > somehow "prove" that these changes are necessary, checkpatch isn't able<br>
> > to determine this all the time.<br>
> <br>
> Hi Greg,<br>
> Based on my understanding, the current function debugfs_create_file()<br>
> adds an overhead of lifetime managing proxy for such fop structs. This<br>
> should be applicable to these set of drivers as well. Hence I think this<br>
> change will be useful.<br>
<br>
Why do these drivers need these changes? Are these files dynamically<br>
removed from the system at random times?<br>
<br>
There is a reason we didn't just do a global search/replace for this in<br>
the kernel when the new functions were added, so I don't know why<br>
checkpatch is now saying it must be done.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Hi, </div><div dir="auto"><br></div><div dir="auto">Sorry to jump in on the thread this way, but what exactly does a 'lifetime managing proxy' for file operations mean? I am trying to understand how DEFINE_DEBUGFS_ATTRIBUTE changes things wrt debug_ fs file operations but can't find many resources. :(</div><div dir="auto"><br></div><div dir="auto">Please let me know if I should be asking this in a different mailing list/irc instead. </div><div dir="auto"><br></div><div dir="auto">The change seems to be suggested by a coccinelle script. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sumera</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks,<br>
<br>
greg k-h<br>
<br>
-- <br>
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:outreachy-kernel%2Bunsubscribe@googlegroups.com" target="_blank" rel="noreferrer">outreachy-kernel+unsubscribe@googlegroups.com</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/outreachy-kernel/20201030080316.GA1612206%40kroah.com" rel="noreferrer noreferrer" target="_blank">https://groups.google.com/d/msgid/outreachy-kernel/20201030080316.GA1612206%40kroah.com</a>.<br>
</blockquote></div></div></div>