Re: [PATCH v1 10/12] dyndbg: add processing of T(race) flag argument

From: Łukasz Bartosik
Date: Sun Nov 12 2023 - 11:29:55 EST


pt., 10 lis 2023 o 20:51 <jim.cromie@xxxxxxxxx> napisał(a):
>
> On Fri, Nov 10, 2023 at 7:52 AM Łukasz Bartosik <lb@xxxxxxxxxxxx> wrote:
> >
> > sob., 4 lis 2023 o 04:06 <jim.cromie@xxxxxxxxx> napisał(a):
> > >
> > > On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <lb@xxxxxxxxxxxx> wrote:
> > > >
> > > > Add processing of argument provided to T(race) flag.
> > > > The argument value determines destination of debug logs:
> > > >
> > > > 0 - debug logs will be written to prdbg and devdbg trace events
> > > > [1..255] - debug logs will be written to trace instance
> > > >
> > > > A user can provide trace destination by folowing T flag with
> > > > ":" and trace destination value in range [0..255], for example:
> > > >
> > > > echo "module thunderbolt =pT:7" > /sys/kernel/debug/dynamic_debug/control
> > > > echo "module thunderbolt =lT:7,p" > /sys/kernel/debug/dynamic_debug/control
> > > >
> > > > When T flag with argument is followed by other flags then the next flag has
> > > > to be preceded with ",".
> > > >
> > >
> > > the trailing , seems punctuation heavy.
> > > Could we just stipulate that any :string (leading : trailing anything)
> > > be the last flag in the spec ?
> > > bare T flags are not constrained otherwise.
> > > seems fine as API-spec-by-error-codes.
> > >
> >
> > I followed Jason's suggestion to use "," when T flag is not the last
> > flag and destination is explicitly provided for the T flag, like in
> > the example above
> > "echo "module thunderbolt =lT:7,p" > /sys/kernel/debug/dynamic_debug/control".
> >
> > With "," we can have the following cases:
> > - when T is the last flag then it doesn't need to be followed by ","
> > even if destination is explicitly provided, for example "lpT:7",
> > - when T is not the last flag and destination is explicitly provided
> > then "," has to be used before next flag, for example "lT:7,p",
> > - when T is not the last flag and destination is not explicitly
> > provided then "," is not required, for example "lTp",
> >
> > Jim, Jason, would you please come to terms if we want to use "," or
> > just assume that T has to be the last flag in the spec ?
> >
>
> Im fine either way - eliminating punctuation has a cost too,
> it adds some order dependency which isnt there now.
> If that complicates the code, no-good.
>

Ok, I will keep the option to use "," to separate T with explicitly
provided destination from a next flag.

>
> > >
> > >
> > >
> > > > When no value is provided trace destination defaults to 0, for example:
>
> That seems wrong now - it should default to whatever it was previously set to,
>

It was in my original proposal before you suggested to create
open/close commands.


> this allows setting a non-default dest while disabling the site:
> echo class DRM_UT_CORE -T:core-log > /proc/dynamic_debug/control
>
> then just enabling it later, to use the preset dest
> echo class DRM_UT_CORE +T > /proc/dynamic_debug/control
> or more likely:
> echo 0x01 > /sys/module/drm/parameters/debug_trace
>
> this way, debug_trace is just like debug, but still can write to the
> separate trace-instances
>

Ack, I also clarified my suggestion related to this topic in patch 11.



> > > >
> > > > echo "module thunderbolt =T" > /sys/kernel/debug/dynamic_debug/control
> > > > echo "module thunderbolt =lTp" > /sys/kernel/debug/dynamic_debug/control
> > >
> > > no colon after T means p is a flag, not a destination name
> >
> > Yes, in this case p is a flag because when T is not followed
> > explicitly by destination then next character would be treated as
> > another flag.