[ltt-dev] Updated TODO list before releasing LTTng bufferingto LKML

Zhaolei zhaolei at cn.fujitsu.com
Wed Oct 29 01:35:44 EDT 2008


* Mathieu Desnoyers wrote:
>> > - move ltt/ltt-marker-control.c /proc interface to debugfs
>> >  I think we should integrate its directory tree to the new LTTng tracer
>> >  debugfs API like this :
>> > 
>> >  /debugfs/ltt/events/buffer_name/marker_name/
>> >    where we find files like :
>> >    state
>> >      write : 1/0 (on/off)
>> >      read  : 1/0 (on/off)
>> >    format
>> >      read : marker format string
>> Hello, Mathieu,
>> 
>> So we need to create a marker's debugfs-directory when user insmod
>>  a module with markers.
>> But i think we don't have a callback when user insmod, and we
>>  should avoid to patch kernel/module.c for this kind of function.
>> 
>> So, maybe we can only "echo marker_name 0/1" > marker-control.
>> Dou you have suggestion for me?
>> 
> 
> 
> Yes, we do have a callback in insmod.
> 
> See :
> 
> load_module()
> 
> #ifdef CONFIG_MARKERS
>        if (!mod->taints)
>                marker_update_probe_range(mod->markers,
>                        mod->markers + mod->num_markers);
> #endif
> 
> We would probably also have to get a callback in free_module to remove
> the marker directory entry when the last marker reference is gone. The
> same
> 
> #ifdef CONFIG_MARKERS
>        if (!mod->taints)
>                marker_update_probe_range(mod->markers,
>                        mod->markers + mod->num_markers);
> #endif
> 
> Could probably be used in free_module.
> 
Do you means we insert another callback as markers do?
as example in insmod:
#ifdef CONFIG_MARKERS
    if (!mod->taints)
        marker_update_probe_range(mod->markers,
         mod->markers + mod->num_markers);
#endif
#ifdef CONFIG_LTT
    if (!mod->taints)
        lttctl_create_dirs(mod->markers,
        mod->markers + mod->num_markers);
#endif

It it is true, i think because ltt_control will be a kernel module, and we can't
call a module's function in load_module().

So, maybe we can do as following:
1: make module.c support callbackset.
  add following functions to module.c
  module_register_callback(enum MODULE_CALLBACK_TYPE type, callback_func func);
  module_unregister_callback(LOAD_MODULE, callback_func func);

2: make marks and ltt_control use new function
  example if ltt_control's
  init() {module_register_callback(LOAD_MODULE, create_debugfs_dir);}
  exit() {module_unregister_callback(LOAD_MODULE, free_debugfs_dir);}
  void create_debugfs_dir(struct module *mod) {
    for (i = 0; i < mod->num_markers; i++ )
        ...
    }



More information about the lttng-dev mailing list