Re: [PATCH v1 11/12] dyndbg: write debug logs to trace instance

From: Łukasz Bartosik
Date: Sun Nov 12 2023 - 11:32:13 EST


pt., 10 lis 2023 o 21:03 <jim.cromie@xxxxxxxxx> napisał(a):
>
> On Fri, Nov 10, 2023 at 7:53 AM Łukasz Bartosik <lb@xxxxxxxxxxxx> wrote:
> >
> > sob., 4 lis 2023 o 22:49 <jim.cromie@xxxxxxxxx> napisał(a):
> > >
> > > On Fri, Nov 3, 2023 at 7:10 AM Łukasz Bartosik <lb@xxxxxxxxxxxx> wrote:
> > > >
> > > > When trace is enabled (T flag is set) and trace_dst field is set
> > > > to value greater than 0 (0 is reserved for trace events) then
> > > > debug logs will be written to trace instance pointed by trace_dst
> > > > value, for example when trace_dst value is 2 then debug logs will
> > > > be written to <debugfs>/tracing/instances/dyndbg_inst_2 instance.
> > > > Given trace instance will not be initialized until debug logs are
> > > > requested to be written to it and afer init will persist until
> > > > reboot.
> > > >
> > >
> > > restating 00 comments -
> > >
> > > you can get rid of integer destination ids by adding a new command: open/close
> > >
> > > $> echo \
> > > open kms-instance \;\
> > > class DRM_UT_KMS -T:kms-instance # preset-dests-disable-sites \;\
> > > > /proc/dynamic_debug/control
> > >
> >
> > Instead of using above command to preset destination we could preset
> > destination with open command. I mean last successful
> > open would preset destination ? What do you think ?
> >
>
> I dont think it works - if open maps to a dest-number, (or implicit as
> TOP-of-stack)
> then you just have +T<dest-number> (or +T <implicit tos>)
> rather than +T:dest-name
> and you still have to keep track of what dest-numbers were already used.
> (or every new dest needs an explicit OPEN before it)
>
> and how do you then get back to default instance ?
> open 0 ?
> close <previous-handle> ?
>
>
> by using names, all opens can be at the top,
> (and thus document in 1 block all the named-instances)
> and any named dest that hasnt been opened is an error
> (not just reusing previous OPEN)
>

Sorry, I should have been more specific with my proposal. Let me use
an example to clarify it:
open usb -> create trace instance "usb" and make it default
echo module usbcore +T > /proc/dynamic_debug/control --> write usbcore
debug logs to trace instance named usb
open tbt --> create trace instance "tbt" and make it default
echo module aaa +T:usb > /proc/dynamic_debug/control --> write aaa
debug logs to trace instance named usb, instance usb has to be used
explicitly

because now tbt is default trace instance
echo module bbb +T > /proc/dynamic_debug/control --> write bbb debug
logs to trace instance named tbt
close tbt --> close tbt trace instance, I omit this step but in order
for an instance to be successful closed it must not be used by any
callsite, after
closing tbt instance the usb becomes default instance

I agree that your method of setting default trace instance is more flexible:
class DRM_UT_KMS -T:kms-instance # preset-dests-disable-sites

Maybe we can combine both to set default trace destination ?

Also I think we need a reserved keyword for writing debug logs to
trace events - maybe "event" keyword ?


>
> > >
> > > and +T w/o dest means use existing setting, not just 0 (unless thats
> > > the existing setting)
> > >
> >
> > Sounds good.
> >
>
> :-)