Commit 5c5cd7b5 authored by Cody P Schafer's avatar Cody P Schafer Committed by Michael Ellerman

powerpc/perf/hv-24x7: parse catalog and populate sysfs with events

Retrieves and parses the 24x7 catalog on POWER systems that supply it
(right now, only POWER 8). Events are exposed via sysfs in the standard
fashion, and are all parameterized.

	$ cd /sys/bus/event_source/devices/hv_24x7/events

	$ cat HPM_CS_FROM_L4_LDATA__PHYS_CORE
	domain=0x2,offset=0xd58,core=?,lpar=0x0

	$ cat HPM_TLBIE__VCPU_HOME_CHIP
	domain=0x4,offset=0x358,vcpu=?,lpar=?

where user is required to specify values for the fields with '?' (like
core, vcpu, lpar above), when specifying the event with the perf tool.

Catalog is (at the moment) only parsed on boot. It needs re-parsing
when a some hypervisor events occur. At that point we'll also need to
prevent old events from continuing to function (counter that is passed
in via spare space in the config values?).
Signed-off-by: default avatarCody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent e08e5282
......@@ -30,4 +30,29 @@ struct hv_24x7_catalog_page_0 {
__u8 reserved6[2];
} __packed;
struct hv_24x7_event_data {
__be16 length; /* in bytes, must be a multiple of 16 */
__u8 reserved1[2];
__u8 domain; /* Chip = 1, Core = 2 */
__u8 reserved2[1];
__be16 event_group_record_offs; /* in bytes, must be 8 byte aligned */
__be16 event_group_record_len; /* in bytes */
/* in bytes, offset from event_group_record */
__be16 event_counter_offs;
/* verified_state, unverified_state, caveat_state, broken_state, ... */
__be32 flags;
__be16 primary_group_ix;
__be16 group_count;
__be16 event_name_len;
__u8 remainder[];
/* __u8 event_name[event_name_len - 2]; */
/* __be16 event_description_len; */
/* __u8 event_desc[event_description_len - 2]; */
/* __be16 detailed_desc_len; */
/* __u8 detailed_desc[detailed_desc_len - 2]; */
} __packed;
#endif
/*
* DOMAIN(name, num, index_kind, is_physical)
*
* @name: An all caps token, suitable for use in generating an enum
* member and appending to an event name in sysfs.
*
* @num: The number corresponding to the domain as given in
* documentation. We assume the catalog domain and the hcall
* domain have the same numbering (so far they do), but this
* may need to be changed in the future.
*
* @index_kind: A stringifiable token describing the meaning of the index
* within the given domain. Must fit the parsing rules of the
* perf sysfs api.
*
* @is_physical: True if the domain is physical, false otherwise (if virtual).
*
* Note: The terms PHYS_CHIP, PHYS_CORE, VCPU correspond to physical chip,
* physical core and virtual processor in 24x7 Counters specifications.
*/
DOMAIN(PHYS_CHIP, 0x01, chip, true)
DOMAIN(PHYS_CORE, 0x02, core, true)
DOMAIN(VCPU_HOME_CORE, 0x03, vcpu, false)
DOMAIN(VCPU_HOME_CHIP, 0x04, vcpu, false)
DOMAIN(VCPU_HOME_NODE, 0x05, vcpu, false)
DOMAIN(VCPU_REMOTE_NODE, 0x06, vcpu, false)
This diff is collapsed.
......@@ -3,14 +3,14 @@
#include <linux/types.h>
enum hv_perf_domains {
#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
#include "hv-24x7-domains.h"
#undef DOMAIN
};
struct hv_24x7_request {
/* PHYSICAL domains require enabling via phyp/hmc. */
#define HV_24X7_PERF_DOMAIN_PHYSICAL_CHIP 0x01
#define HV_24X7_PERF_DOMAIN_PHYSICAL_CORE 0x02
#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_CORE 0x03
#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_CHIP 0x04
#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_NODE 0x05
#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_REMOTE_NODE 0x06
__u8 performance_domain;
__u8 reserved[0x1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment