From sacadmin Mon May 19 16:22:56 2008
Received: from sac.sfbay.sun.com (localhost [127.0.0.1])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m4JNMu7T000826;
	Mon, 19 May 2008 16:22:56 -0700 (PDT)
Received: (from barts@localhost)
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit) id m4JNMuq0000822;
	Mon, 19 May 2008 16:22:56 -0700 (PDT)
Date: Mon, 19 May 2008 16:22:56 -0700 (PDT)
From: Bart Smaalders <barts@sac.sfbay.sun.com>
Message-Id: <200805192322.m4JNMuq0000822@sac.sfbay.sun.com>
To: PSARC-record@sac.sfbay.sun.com
Subject: CPU Performance Counter Generic Event Names [PSARC/2008/334 FastTrack timeout 05/28/2008]
Status: RO
Content-Length: 578


Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 CPU Performance Counter Generic Event Names
    1.2. Name of Document Author/Supplier:
	 Author:  Jonathan Haslam
    1.3  Date of This Document:
	19 May, 2008
4. Technical Description
    See the case directory for more detail

6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


From bart.smaalders@sun.com Mon May 19 17:00:57 2008
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m4K00vHw001640
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 19 May 2008 17:00:57 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m4K00tbm027325;
	Mon, 19 May 2008 18:00:55 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K150040741HM800@nwk-avmta-2.sfbay.sun.com>; Mon,
 19 May 2008 17:00:53 -0700 (PDT)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.63])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K150042N41GL900@nwk-avmta-2.sfbay.sun.com>; Mon,
 19 May 2008 17:00:52 -0700 (PDT)
Received: from [129.146.228.109] (cyber.SFBay.Sun.COM [129.146.228.109])
	by jurassic-x4600.sfbay.sun.com (8.14.2+Sun/8.14.2)
 with ESMTP id m4K00qLp555221; Mon, 19 May 2008 17:00:52 -0700 (PDT)
Date: Mon, 19 May 2008 17:00:52 -0700
From: Bart Smaalders <bart.smaalders@sun.com>
Subject: PSARC 2008/334 CPU Performance Counter Generic Event Names
To: PSARC-EXT@sun.com
Cc: Jonathan Haslam <jonathan.haslam@sun.com>
Message-id: <483214B4.3020001@Sun.COM>
Organization: Sun Microsystems
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
User-Agent: Thunderbird 2.0.0.12 (X11/20080310)
Status: RO
Content-Length: 6894

I'm sponsoring the attached case for Jon Haslam.  The requested release 
binding is
minor.  The case times out on 5/28/2008.  The referenced man pages are 
in the case
directory.

- Bart


1. Introduction
     1.1. Project/Component Working Name:
       CPU Performance Counter Generic Event Names
     1.2. Name of Document Author/Supplier:
       Author:  Jonathan Haslam
     1.3  Date of This Document:
       13th May, 2008
4. Technical Description

4.1. Summary

The Solaris CPU Performance Counter (CPC) subsystem (PSARC 2002/180)
provides access to the hardware performance counters of a microprocessor.
The events available on each platform are often numerous and named according
to conventions given by the processor manufacturer. For example, a common
event type, such as a Data TLB miss, is referred to across different 
platforms
by a variety of names and, optionally, additional attributes:

Processor		Event Name			Attribute
Opteron (fam 0xf)	DC_dtlb_L1_miss_L2_miss		
Opteron (fam 0x10)	DC_dtlb_L1_miss_L2_miss		umask=0x7
SPARC64 (VI/VII)	trap_DMMU_miss
US (III/IV/IV+)		DTLB_miss
Pentium IV		page_walk_type			emask=0x1
Niagara (I/II)		DTLB_miss

Figuring out which platform event and attributes are needed to measure a
particular event can be challenging for the CPC user. Writing cross platform
scripts to measure common events of interest is extremely tedious and time
consuming.

This case seeks to add a set of pre-defined, platform independent events to
the CPC subsystem. These events are being referred to as "Generic Events".
A Generic Event is simply a well known name for a common CPU event (e.g.
L2 Data Cache Miss, Data TLB miss or Instructions Executed). Such events are
mapped to the underlying platform event and any optional attribute(s) by the
platform specific performance counter back-end (PCBE).

Rather than inventing yet another event namespace it is proposed that the
naming scheme of the PAPI (Performance Application Programming Interface)
project from the University of Tennessee be adopted. The PAPI project is a
well established community project with a large user base. It currently
defines around 110 generic events (known as "Preset Events" in PAPI 
terminology)
whose definitions are found at:

http://icl.cs.utk.edu/projects/papi/files/html_man3/papi_presets.html

The event namespace is well thought out and covers all the areas of common
interest for the CPC user. The PAPI project team are very receptive to
Solaris adopting this naming scheme. PAPI is licensed under a BSD based
license which provides no licensing issues for inclusion in Solaris. An
inbound OSR has been filed.

The output of the '-h' option to cputrack(1)/cpustat(1) has been modified
to display the generic events available to the user. An example from
a Niagara 2 processor:

# cpustat -h
Usage:
        cpustat [-c events] [-p period] [-nstD] [interval [count]]

[ ...snip...]

        CPU performance counter interface: UltraSPARC T2+

        event specification syntax:
 
[picn=]<eventn>[,attr[n][=<val>]][,[picn=]<eventn>[,attr[n][=<val>]],...]

        Generic Events:

        event[0-1]: PAPI_tot_ins PAPI_l1_dcm PAPI_l1_icm PAPI_l2_icm
                 PAPI_l2_ldm PAPI_tlb_dm PAPI_tlb_im PAPI_tlb_tm
                 PAPI_br_tkn PAPI_br_ins PAPI_ld_ins PAPI_sr_ins

        See generic_events(3CPC) for descriptions of these events.

        Platform Specific Events:

        event[0-1]: Idle_strands Br_completed Br_taken Instr_FGU_arithmetic
                 Instr_ld Instr_st Instr_sw Instr_other Atomics Instr_cnt
                 IC_miss DC_miss L2_imiss L2_dmiss_ld ITLB_HWTW_ref_L2
                 DTLB_HWTW_ref_L2 ITLB_HWTW_miss_L2 DTLB_HWTW_miss_L2
                 Stream_ld_to_PCX Stream_st_to_PCX CPU_ld_to_PCX
                 CPU_ifetch_to_PCX CPU_st_to_PCX MMU_ld_to_PCX DES_3DES_op
                 AES_op RC4_op MD5_SHA-1_SHA-256_op MA_op CRC_TCPIP_cksum
                 DES_3DES_busy_cycle AES_busy_cycle RC4_busy_cycle
                 MD5_SHA-1_SHA-256_busy_cycle MA_busy_cycle CRC_MPA_cksum
                 ITLB_miss DTLB_miss TLB_miss
[ ...snip... ]

Each platform only implements a subset of all possible generic events (those
specified in the new generic_events(3CPC) man page (see "Doc Impact" 
section).

4.2. Interfaces

Two new interfaces have been added to libcpc.so.1:

void cpc_walk_generic_events_all(cpc_t *cpc, void *arg,
	void (*action)(void *arg, const char *event));

void cpc_walk_generic_events_pic(cpc_t *cpc, uint_t picno, void *arg,
	void (*action)(void *arg, uint_t picno, const char *event));

These interfaces provide the same functionality for generic events as their
equivalent platform event functions, cpc_walk_events_all() and
cpc_walk_events_pic() (PSARC 2002/180).

The cpc_walk_generic_events_all() function calls the action() function 
for each
generic event supported on the platform, regardless of which physical 
counter
can count it. The cpc_walk_generic_events_pic() function calls the action()
function for each generic event supported by a particular physical 
counter. The
stability of these two new interfaces will be that of "Uncommitted" which
matches all other functions provided by libcpc (nee "Evolving").


Interface                     | Stability
------------------------------+-----------------------
cpc_walk_generic_events_all   | Uncommitted
cpc_walk_generic_events_pic   | Uncommitted
PAPI Generic Event Names      | Volatile
------------------------------+-----------------------

4.3 Intended Audience

This work is targeted primarily at developers but also at power 
administrators.
It is hoped that the adoption of the PAPI preset naming scheme will be
attractive to developers coming to Solaris from other Open Source platforms.
The Sun Studio team are also positive about adopting the generic names into
their collector/analyzer technology.

4.5. References

	http://bugs.opensolaris.org/view_bug.do?bug_id=6689461
	http://icl.cs.utk.edu/projects/papi/files/html_man3/papi_presets.html
	PSARC/2002/180 CPU Performance Counters (CPC) Version 2

4.6 Doc Impact

A new man page has been created, generic_events(3CPC), which enumerates all
possible generic events and their associated definitions. 
generic_events(3CPC)
also enumerates, for each supported platform, the generic events 
available and
the platform event and optional attribute(s) that this maps to. 
Modifications
have also been made to cpc_npic(3CPC), libcpc(3LIB), cpc(3CPC). Versions of
all these man pages can be found in the case materials.

6. Resources and Schedule
     6.4. Steering Committee requested information
        6.4.1. Consolidation C-team Name:
         ON
     6.5. ARC review type: FastTrack
     6.6. ARC Exposure: open



-- 
Bart Smaalders			Solaris Kernel Performance
barts@cyber.eng.sun.com		http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."

From bart.smaalders@sun.com Wed May 28 10:09:38 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m4SH9cW5010350
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 28 May 2008 10:09:38 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m4SH9Vp2023510;
	Wed, 28 May 2008 18:09:36 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K1L004078ZZ5A00@nwk-avmta-1.sfbay.Sun.COM>; Wed,
 28 May 2008 10:09:35 -0700 (PDT)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.63])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K1L00KFN8ZYY170@nwk-avmta-1.sfbay.Sun.COM>; Wed,
 28 May 2008 10:09:34 -0700 (PDT)
Received: from [129.146.228.109] (cyber.SFBay.Sun.COM [129.146.228.109])
	by jurassic-x4600.sfbay.sun.com (8.14.3+Sun/8.14.3)
 with ESMTP id m4SH9YtI724149; Wed, 28 May 2008 10:09:34 -0700 (PDT)
Date: Wed, 28 May 2008 10:09:34 -0700
From: Bart Smaalders <bart.smaalders@sun.com>
Subject: Re: PSARC 2008/334 CPU Performance Counter Generic Event Names
In-reply-to: <483214B4.3020001@Sun.COM>
To: PSARC-ext@sun.com
Cc: Jonathan Haslam <jonathan.haslam@sun.com>
Message-id: <483D91CE.2090207@Sun.COM>
Organization: Sun Microsystems
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <483214B4.3020001@Sun.COM>
User-Agent: Thunderbird 2.0.0.12 (X11/20080310)
Status: RO
Content-Length: 219


This case was approved at today's meeting.

- Bart


-- 
Bart Smaalders			Solaris Kernel Performance
barts@cyber.eng.sun.com		http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."

