All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 07/11] drivers: perf: hisi: Add support for Hisilicon SoC event counters
Date: Fri, 31 Mar 2017 15:23:52 +0100	[thread overview]
Message-ID: <20170331142351.GC6488@leverpostej> (raw)
In-Reply-To: <58DE6400.8030900@gmail.com>

On Fri, Mar 31, 2017 at 07:43:20PM +0530, Anurup M wrote:
> On Thursday 30 March 2017 04:16 PM, Mark Rutland wrote:
> >>>>>+	/*
> >>>>>> >>>+	 * We must NOT create groups containing mixed PMUs, although
> >>>>>> >>>+	 * software events are acceptable
> >>>>>> >>>+	 */
> >>>>>> >>>+	if (event->group_leader->pmu != event->pmu &&
> >>>>>> >>>+	    !is_software_event(event->group_leader))
> >>>>>> >>>+		return -EINVAL;
> >>>>>> >>>+
> >>>>>> >>>+	list_for_each_entry(sibling, &event->group_leader->sibling_list,
> >>>>>> >>>+			    group_entry)
> >>>>>> >>>+		if (sibling->pmu != event->pmu && !is_software_event(sibling))
> >>>>>> >>>+			return -EINVAL;
> >>>> >Please also check the number of counters.
> >>>
> >>>Sorry, I could not follow this comment correctly. Could you please explain ?
> >>>I check the available counters and update used mask in pmu_add -->
> >>>get_event_index
> >What I meant was that here we should ensure that a group does not
> >contain more events than can fit into counters.
> >
> >For example, if the HW had two counters, we should reject any group with
> >more than two events. Such groups can never be scheduled, and make no
> >sense.
> 
> I have referred drivers/bus/arm-cci.c and could find validate_group
> and validate_event functions,
> which create a fake_pmu to check the available counters for the
> events in the group.
> Is that the same way which is expected here? Please comment.

Something like that.

I think it's simplest to have a validate_group() function, which counts
the number of counters used. See my suggestion in [1].

Thanks,
Mark.

[1] https://lkml.kernel.org/r/20170331135955.GB6488 at leverpostej

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Anurup M <anurupvasu@gmail.com>
Cc: will.deacon@arm.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, anurup.m@huawei.com,
	zhangshaokun@hisilicon.com, tanxiaojun@huawei.com,
	xuwei5@hisilicon.com, sanil.kumar@hisilicon.com,
	john.garry@huawei.com, gabriele.paoloni@huawei.com,
	shiju.jose@huawei.com, huangdaode@hisilicon.com,
	linuxarm@huawei.com, dikshit.n@huawei.com, shyju.pv@huawei.com
Subject: Re: [PATCH v6 07/11] drivers: perf: hisi: Add support for Hisilicon SoC event counters
Date: Fri, 31 Mar 2017 15:23:52 +0100	[thread overview]
Message-ID: <20170331142351.GC6488@leverpostej> (raw)
In-Reply-To: <58DE6400.8030900@gmail.com>

On Fri, Mar 31, 2017 at 07:43:20PM +0530, Anurup M wrote:
> On Thursday 30 March 2017 04:16 PM, Mark Rutland wrote:
> >>>>>+	/*
> >>>>>> >>>+	 * We must NOT create groups containing mixed PMUs, although
> >>>>>> >>>+	 * software events are acceptable
> >>>>>> >>>+	 */
> >>>>>> >>>+	if (event->group_leader->pmu != event->pmu &&
> >>>>>> >>>+	    !is_software_event(event->group_leader))
> >>>>>> >>>+		return -EINVAL;
> >>>>>> >>>+
> >>>>>> >>>+	list_for_each_entry(sibling, &event->group_leader->sibling_list,
> >>>>>> >>>+			    group_entry)
> >>>>>> >>>+		if (sibling->pmu != event->pmu && !is_software_event(sibling))
> >>>>>> >>>+			return -EINVAL;
> >>>> >Please also check the number of counters.
> >>>
> >>>Sorry, I could not follow this comment correctly. Could you please explain ?
> >>>I check the available counters and update used mask in pmu_add -->
> >>>get_event_index
> >What I meant was that here we should ensure that a group does not
> >contain more events than can fit into counters.
> >
> >For example, if the HW had two counters, we should reject any group with
> >more than two events. Such groups can never be scheduled, and make no
> >sense.
> 
> I have referred drivers/bus/arm-cci.c and could find validate_group
> and validate_event functions,
> which create a fake_pmu to check the available counters for the
> events in the group.
> Is that the same way which is expected here? Please comment.

Something like that.

I think it's simplest to have a validate_group() function, which counts
the number of counters used. See my suggestion in [1].

Thanks,
Mark.

[1] https://lkml.kernel.org/r/20170331135955.GB6488@leverpostej

  reply	other threads:[~2017-03-31 14:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10  6:28 [PATCH v6 07/11] drivers: perf: hisi: Add support for Hisilicon SoC event counters Anurup M
2017-03-10  6:28 ` Anurup M
2017-03-21 16:52 ` Mark Rutland
2017-03-21 16:52   ` Mark Rutland
2017-03-24 10:18   ` Anurup M
2017-03-24 10:18     ` Anurup M
2017-03-24 11:57     ` Mark Rutland
2017-03-24 11:57       ` Mark Rutland
2017-03-27  6:34       ` Anurup M
2017-03-27  6:34         ` Anurup M
2017-03-30  9:48   ` Anurup M
2017-03-30  9:48     ` Anurup M
2017-03-30 10:46     ` Mark Rutland
2017-03-30 10:46       ` Mark Rutland
2017-03-31 14:13       ` Anurup M
2017-03-31 14:13         ` Anurup M
2017-03-31 14:23         ` Mark Rutland [this message]
2017-03-31 14:23           ` Mark Rutland
2017-03-31 15:04           ` Anurup M
2017-03-31 15:04             ` Anurup M

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=20170331142351.GC6488@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.