Vince, On Tue, Mar 31, 2009 at 1:06 AM, Vince Weaver <vi...@csl.cornell.edu> wrote: > >> How can pfm_create_context (the syscall) return 0 if you are telling >> me stdin is still open? I think you need to start from that. It should >> not return 0 in that case. Maybe there is a problem with the return >> of the syscall on mips, or more likely there is a mismatch between >> the syscall number for pfm_create_context and the kernel, i.e., you >> are calling a different syscall. > > > What happens is pfm_create_context() is called before > pfm_init_version_sysfs() is called. > > Because of this, the perfmon library values are major 0 minor 0. > > So this first time pfm_create_context() is called, the perfmon 2.2 > compatability routines are called, so even though the syscall properly > returns fd 3, the compat libs convert this to a zero. > > This causes the failure I see. > > The pfm_create_context() having the problem is being called from > main/pfmon_initialize/pfmon_arch_initialize/pfmon_detect_unavail_regs/ > pfmon_get_unavail_regs > > I guess we need to make sure a call to pfm_init_version_sysfs() happens > before this. > Ah yes. I forgot about this. You need to initialize libpfm before anything else, even if you are not using it, i.e., not using the library core but just the syscall stubs. I think there maybe a way to get libpfm initialized before you reach main. I don't recall the details. I think it has to do with constructors.
------------------------------------------------------------------------------ _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel