Re: [PATCH v3] dynamic_debug: allow to work if debugfs is disabled

From: Saravana Kannan
Date: Mon Jan 27 2020 - 17:20:16 EST


On Sat, Jan 25, 2020 at 9:11 AM Jonathan Corbet <corbet@xxxxxxx> wrote:
>
> On Fri, 24 Jan 2020 20:42:31 -0500
> "Theodore Y. Ts'o" <tytso@xxxxxxx> wrote:
>
> > On Fri, Jan 24, 2020 at 08:29:40AM +0100, Greg Kroah-Hartman wrote:
> > > > It's likely that people who normally use
> > > > distribution kernels where debugfs is disabled will have scripts which
> > > > are hard-coded to look in /proc, and then when they build a kernel
> > > > with debugfs enabled, the /proc entry will go **poof**, and their
> > > > script will break.
> > >
> > > **poof** they didn't test it :)
> > >
> > > Seriously, I am doing this change to make it _easier_ for those people
> > > who want debugfs disabled, yet want this type of debugging. This is
> > > much better than having no debugging at all.
> > >
> > > Don't put extra complexity in the kernel for when it can be trivially
> > > handled in userspace, you know this :)
> >
> > It's also trivial to handle this in the kernel by potentially having
> > the control file appear in two places. Consider what it would be like
> > to explain this in the Linux documentation --- "the control file could
> > be here, or it could be there", depending on how the kernel is
> > configured. The complexity of documenting this, and the complexity in
> > userspace; and we have to have the code in the source code for the
> > file to be in the appear in both places *anyway*.
>
> FWIW, avoiding the need to document something like this has been a
> motivating factor behind a number of my patches over the years.
>
> Moving a control knob based on kernel configuration is a user-hostile
> feature. Scripts can be made to cope with this kind of behavior in one
> place; if you let such things accumulate in a system, though, it gets to
> the point where it's really hard for anybody to keep track of all the
> pieces and be sure that their code will work.
>
> If dynamic debug is meant to be a feature supported on all kernels, it
> should, IMO, be lifted out of debugfs and made into a proper feature - with
> a compatibility link left behind in debugfs for as long as it's needed, of
> course.
>
> </sermon> :)

My 2 cents -- agree with what Ted and Jon have said.

-Saravana