linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/6] arm64/perf: Filter common events based on PMCEIDn_EL0
Date: Thu, 24 Mar 2016 16:14:43 +0000	[thread overview]
Message-ID: <20160324161442.GA14953@leverpostej> (raw)
In-Reply-To: <1458823960-32760-4-git-send-email-ashoks@broadcom.com>

HI,

On Thu, Mar 24, 2016 at 05:52:37AM -0700, Ashok Kumar wrote:
> The complete common architectural and micro-architectural
> event number structure is filtered based on PMCEIDn_EL0 and
> copied to a new structure which is exposed to /sys
>
> The function which derives event bitmap from PMCEIDn_EL0 is
> executed in the cpus, which has the pmu being initialized,
> for heterogeneous pmu support.

I would prefer it we could instead filter the list at run time by
implementing attribute_group::is_visible() for the events attribute
group, and share a common set of attributes and attr groups. That would
avoid the filtering, copying, and assocaited memory allocation.

e.g. have an array of:

struct event_attribute {
	struct attribute attr;
	int pmceid_idx;
};

Then cache the pmceid value at probe time, and have and something like:

umode_t event_attr_is_visible(struct kobject *kobj, struct attribute *attr, int)
{
	struct arm_pmu *arm_pmu;
	struct event_attribute *e_attr;

	arm_pmu = pmu_kobj_to_armpmu(kobj);
	e_attr = container_of(attr, struct event_attr, attr);
	
	if (test_bit(e_attr->pmceid_idx, &arm_pmu->cached_pmceid))
		return 0444;

	return 0;
}

Thanks,
Mark.

  parent reply	other threads:[~2016-03-24 16:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 12:52 [PATCH v2 0/6] arm64: perf: Broadcom Vulcan PMU support Ashok Kumar
2016-03-24 12:52 ` [PATCH v2 1/6] arm64/perf: Changed events naming as per ARM ARM Ashok Kumar
2016-03-24 12:52 ` [PATCH v2 2/6] arm64/perf: Define complete ARMv8 recommended implementation defined events Ashok Kumar
2016-03-24 12:52 ` [PATCH v2 3/6] arm64/perf: Filter common events based on PMCEIDn_EL0 Ashok Kumar
2016-03-24 15:28   ` Suzuki K. Poulose
2016-03-28 12:31     ` Ashok Sekar
2016-03-24 16:14   ` Mark Rutland [this message]
2016-03-28 12:25     ` Ashok Sekar
2016-03-24 12:52 ` [PATCH v2 4/6] arm64/perf: Add Broadcom Vulcan PMU support Ashok Kumar
2016-03-24 12:52 ` [PATCH v2 5/6] arm64: dts: Add Broadcom Vulcan PMU in dts Ashok Kumar
2016-03-24 12:52 ` [PATCH v2 6/6] Documentation: arm64: pmu: Add Broadcom Vulcan PMU binding Ashok Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160324161442.GA14953@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).