Thread: [perfmon2] arch/x86/perfmon/perfmon.c arch specific code
Status: Beta
Brought to you by:
seranian
From: William C. <wc...@re...> - 2007-11-20 13:57:27
|
I was looking through arch/x86/perfmon/perfmon.c and noticed that it seems to have lot of code that is very architecture specific. I would have thought that code would have been located in the various architecture specific files such as perfmon_p4.c and perfmon_intel_core.c. Things like: __pfm_write_reg_p4() __pfm_read_reg_p4() pfm_stop_save_intel_core() Currently, the function pointer pfm_has_ovfl and pfm_stop_save are declared static. It would seem to be minor restructuring to make it so this information is provided by the various arch specific files to make arch/x86/perfmon/perfmon.c a bit cleaner and localize code for specific architectures to the appropriate arch specific files. Also allow patches for the various x86 platforms to be broken out. -Will |
From: Stephane E. <er...@hp...> - 2007-11-28 09:58:51
|
Will, Don't think I have replied to this post. On Tue, Nov 20, 2007 at 08:57:28AM -0500, William Cohen wrote: > I was looking through arch/x86/perfmon/perfmon.c and noticed that it seems to > have lot of code that is very architecture specific. I would have thought that > code would have been located in the various architecture specific files such as > perfmon_p4.c and perfmon_intel_core.c. Things like: > > __pfm_write_reg_p4() > __pfm_read_reg_p4() > pfm_stop_save_intel_core() > > Currently, the function pointer pfm_has_ovfl and pfm_stop_save are declared > static. It would seem to be minor restructuring to make it so this information > is provided by the various arch specific files to make > arch/x86/perfmon/perfmon.c a bit cleaner and localize code for specific > architectures to the appropriate arch specific files. Also allow patches for the > various x86 platforms to be broken out. > Yes, I think this would be a good thing to do. IBM used the same approach in the POWERPC code (look at arch/powerpc/perfmon/perfmon.c). Theoretically, rh arch/*/perfmon.c should only contain code that is common to all processors of an architecture, the rest should be implemented by the PMU model-specific module. For this to really work well, there needs to be a good PMU architecture in place. This is true for most recent processors, but we have to deal with older intel IA-32 processors. I will look into this because, as you said, I think it will also help modularize the code more and make it easier to feed smaller pieces to LKML. Thanks. -- -Stephane |