On Wed, 28 Sep 2022 09:24:14 +0900 Junichi Uekawa (上川純一) <uekawa@xxxxxxxxxx> wrote: > + > + > +const char *tep_plugin_kvm_get_func(struct tep_event *event, > + struct tep_record *record, > + unsigned long long *val) > +{ > > I think this could be implemented in a .so plugin that is dlopen()'d which might be more intuitive (along with the others). > I think using dlopen RTLD_GLOBAL will use the symbols instead of the weak symbols (but I need to check if that was the actual behavior). So we should have a dlopen on an .so from this .so that is dlopen()ed? The issue here is that libtraceevent has several .so plugins loaded with dlopen(). One of them is the plugin_kvm.so, which needs a way to translate the rip that the host receives with the function it maps to in the guest. The issue is that the libtraceevent only handles one set of tracing data, and that's for just the host. Now because plugin_kvm.so is a plugin, it only interacts with libtraceevent. Now we could add a call to libtraceeveent that is "tep_load_guest_mappings()" but then we need to make it so that it can load several guest mappings, and the place in the plugin_kvm.so will need to also know what guest it is for. In which case I feel it is losing the scope of what libtraceevent is for (just parsing of the event's raw data). Which is why I added this hack. Or maybe I misunderstood what you were suggesting. -- Steve > > + struct tep_handle *tep; > + struct kvm_cpu_map *map; > + struct kvm_cpu_map key; > + unsigned long long rip = *val; > + const char *func; > + int pid;