Skip to content

Commit af86da5

Browse files
Cyrill GorcunovIngo Molnar
authored andcommitted
perf, x86: P4 PMU - describe config format
Add description of .config in a sake of RAW events. At least this should bring some light to those who will be reading this code. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Reviewed-by: Stephane Eranian <eranian@google.com> Cc: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 004417a commit af86da5

1 file changed

Lines changed: 55 additions & 8 deletions

File tree

‎arch/x86/include/asm/perf_event_p4.h‎

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -744,14 +744,6 @@ enum P4_ESCR_EMASKS {
744744
};
745745

746746
/*
747-
* P4 PEBS specifics (Replay Event only)
748-
*
749-
* Format (bits):
750-
* 0-6: metric from P4_PEBS_METRIC enum
751-
* 7 : reserved
752-
* 8 : reserved
753-
* 9-11 : reserved
754-
*
755747
* Note we have UOP and PEBS bits reserved for now
756748
* just in case if we will need them once
757749
*/
@@ -788,5 +780,60 @@ enum P4_PEBS_METRIC {
788780
P4_PEBS_METRIC__max
789781
};
790782

783+
/*
784+
* Notes on internal configuration of ESCR+CCCR tuples
785+
*
786+
* Since P4 has quite the different architecture of
787+
* performance registers in compare with "architectural"
788+
* once and we have on 64 bits to keep configuration
789+
* of performance event, the following trick is used.
790+
*
791+
* 1) Since both ESCR and CCCR registers have only low
792+
* 32 bits valuable, we pack them into a single 64 bit
793+
* configuration. Low 32 bits of such config correspond
794+
* to low 32 bits of CCCR register and high 32 bits
795+
* correspond to low 32 bits of ESCR register.
796+
*
797+
* 2) The meaning of every bit of such config field can
798+
* be found in Intel SDM but it should be noted that
799+
* we "borrow" some reserved bits for own usage and
800+
* clean them or set to a proper value when we do
801+
* a real write to hardware registers.
802+
*
803+
* 3) The format of bits of config is the following
804+
* and should be either 0 or set to some predefined
805+
* values:
806+
*
807+
* Low 32 bits
808+
* -----------
809+
* 0-6: P4_PEBS_METRIC enum
810+
* 7-11: reserved
811+
* 12: reserved (Enable)
812+
* 13-15: reserved (ESCR select)
813+
* 16-17: Active Thread
814+
* 18: Compare
815+
* 19: Complement
816+
* 20-23: Threshold
817+
* 24: Edge
818+
* 25: reserved (FORCE_OVF)
819+
* 26: reserved (OVF_PMI_T0)
820+
* 27: reserved (OVF_PMI_T1)
821+
* 28-29: reserved
822+
* 30: reserved (Cascade)
823+
* 31: reserved (OVF)
824+
*
825+
* High 32 bits
826+
* ------------
827+
* 0: reserved (T1_USR)
828+
* 1: reserved (T1_OS)
829+
* 2: reserved (T0_USR)
830+
* 3: reserved (T0_OS)
831+
* 4: Tag Enable
832+
* 5-8: Tag Value
833+
* 9-24: Event Mask (may use P4_ESCR_EMASK_BIT helper)
834+
* 25-30: enum P4_EVENTS
835+
* 31: reserved (HT thread)
836+
*/
837+
791838
#endif /* PERF_EVENT_P4_H */
792839

0 commit comments

Comments
 (0)