All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@arm.com>
To: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <Will.Deacon@arm.com>,
	<mark.rutland@arm.com>, <jnair@caviumnetworks.com>,
	<Robert.Richter@cavium.com>, <Vadim.Lomovtsev@cavium.com>,
	<Jan.Glauber@cavium.com>, <gklkml16@gmail.com>
Subject: Re: [PATCH v4 2/2] ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver
Date: Thu, 26 Apr 2018 17:06:24 -0500	[thread overview]
Message-ID: <20180426170624.bfcba885431d57d0de2a3ddd@arm.com> (raw)
In-Reply-To: <20180425090047.6485-3-ganapatrao.kulkarni@cavium.com>

On Wed, 25 Apr 2018 14:30:47 +0530
Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com> wrote:

> +static int thunderx2_uncore_event_init(struct perf_event *event)
...
> +	/*
> +	 * SOC PMU counters are shared across all cores.
> +	 * Therefore, it does not support per-process mode.
> +	 * Also, it does not support event sampling mode.
> +	 */
> +	if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
> +		return -EINVAL;
> +
> +	/* SOC counters do not have usr/os/guest/host bits */
> +	if (event->attr.exclude_user || event->attr.exclude_kernel ||
> +	    event->attr.exclude_host || event->attr.exclude_guest)
> +		return -EINVAL;
> +
> +	if (event->cpu < 0)
> +		return -EINVAL;
> +
> +	pmu_uncore = pmu_to_thunderx2_pmu_uncore(event->pmu);
> +
> +	if (!pmu_uncore)
> +		return -ENODEV;
> +
> +	/* Pick first online cpu from the node */
> +	event->cpu = cpumask_first(
> +			cpumask_of_node(pmu_uncore->uncore_dev->node));
> +
> +	if (event->cpu >= nr_cpu_ids)
> +		return -EINVAL;
> +
> +	if (event->attr.config >= pmu_uncore->uncore_dev->max_events)
> +		return -EINVAL;
> +
> +	/* store event id */
> +	hwc->config = event->attr.config;
> +
> +	/* Validate the group */
> +	if (!thunderx2_uncore_validate_event_group(event))
> +		return -EINVAL;

This PMU driver can be made more user-friendly by not just silently
returning an error code such as -EINVAL, but by emitting a useful
message describing the specific error via dmesg.

Thanks,

Kim

WARNING: multiple messages have this Message-ID (diff)
From: Kim Phillips <kim.phillips@arm.com>
To: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <Will.Deacon@arm.com>,
	<mark.rutland@arm.com>, <jnair@caviumnetworks.com>,
	<Robert.Richter@cavium.com>, <Vadim.Lomovtsev@cavium.com>,
	<Jan.Glauber@cavium.com>, <gklkml16@gmail.com>
Subject: Re: [PATCH v4 2/2] ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver
Date: Thu, 26 Apr 2018 17:06:24 -0500	[thread overview]
Message-ID: <20180426170624.bfcba885431d57d0de2a3ddd@arm.com> (raw)
In-Reply-To: <20180425090047.6485-3-ganapatrao.kulkarni@cavium.com>

On Wed, 25 Apr 2018 14:30:47 +0530
Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com> wrote:

> +static int thunderx2_uncore_event_init(struct perf_event *event)
...
> +	/*
> +	 * SOC PMU counters are shared across all cores.
> +	 * Therefore, it does not support per-process mode.
> +	 * Also, it does not support event sampling mode.
> +	 */
> +	if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
> +		return -EINVAL;
> +
> +	/* SOC counters do not have usr/os/guest/host bits */
> +	if (event->attr.exclude_user || event->attr.exclude_kernel ||
> +	    event->attr.exclude_host || event->attr.exclude_guest)
> +		return -EINVAL;
> +
> +	if (event->cpu < 0)
> +		return -EINVAL;
> +
> +	pmu_uncore = pmu_to_thunderx2_pmu_uncore(event->pmu);
> +
> +	if (!pmu_uncore)
> +		return -ENODEV;
> +
> +	/* Pick first online cpu from the node */
> +	event->cpu = cpumask_first(
> +			cpumask_of_node(pmu_uncore->uncore_dev->node));
> +
> +	if (event->cpu >= nr_cpu_ids)
> +		return -EINVAL;
> +
> +	if (event->attr.config >= pmu_uncore->uncore_dev->max_events)
> +		return -EINVAL;
> +
> +	/* store event id */
> +	hwc->config = event->attr.config;
> +
> +	/* Validate the group */
> +	if (!thunderx2_uncore_validate_event_group(event))
> +		return -EINVAL;

This PMU driver can be made more user-friendly by not just silently
returning an error code such as -EINVAL, but by emitting a useful
message describing the specific error via dmesg.

Thanks,

Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: kim.phillips@arm.com (Kim Phillips)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/2] ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver
Date: Thu, 26 Apr 2018 17:06:24 -0500	[thread overview]
Message-ID: <20180426170624.bfcba885431d57d0de2a3ddd@arm.com> (raw)
In-Reply-To: <20180425090047.6485-3-ganapatrao.kulkarni@cavium.com>

On Wed, 25 Apr 2018 14:30:47 +0530
Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com> wrote:

> +static int thunderx2_uncore_event_init(struct perf_event *event)
...
> +	/*
> +	 * SOC PMU counters are shared across all cores.
> +	 * Therefore, it does not support per-process mode.
> +	 * Also, it does not support event sampling mode.
> +	 */
> +	if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
> +		return -EINVAL;
> +
> +	/* SOC counters do not have usr/os/guest/host bits */
> +	if (event->attr.exclude_user || event->attr.exclude_kernel ||
> +	    event->attr.exclude_host || event->attr.exclude_guest)
> +		return -EINVAL;
> +
> +	if (event->cpu < 0)
> +		return -EINVAL;
> +
> +	pmu_uncore = pmu_to_thunderx2_pmu_uncore(event->pmu);
> +
> +	if (!pmu_uncore)
> +		return -ENODEV;
> +
> +	/* Pick first online cpu from the node */
> +	event->cpu = cpumask_first(
> +			cpumask_of_node(pmu_uncore->uncore_dev->node));
> +
> +	if (event->cpu >= nr_cpu_ids)
> +		return -EINVAL;
> +
> +	if (event->attr.config >= pmu_uncore->uncore_dev->max_events)
> +		return -EINVAL;
> +
> +	/* store event id */
> +	hwc->config = event->attr.config;
> +
> +	/* Validate the group */
> +	if (!thunderx2_uncore_validate_event_group(event))
> +		return -EINVAL;

This PMU driver can be made more user-friendly by not just silently
returning an error code such as -EINVAL, but by emitting a useful
message describing the specific error via dmesg.

Thanks,

Kim

  parent reply	other threads:[~2018-04-26 22:06 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25  9:00 [PATCH v4 0/2] Add ThunderX2 SoC Performance Monitoring Unit driver Ganapatrao Kulkarni
2018-04-25  9:00 ` Ganapatrao Kulkarni
2018-04-25  9:00 ` Ganapatrao Kulkarni
2018-04-25  9:00 ` [PATCH v4 1/2] perf: uncore: Adding documentation for ThunderX2 pmu uncore driver Ganapatrao Kulkarni
2018-04-25  9:00   ` Ganapatrao Kulkarni
2018-04-25  9:00   ` Ganapatrao Kulkarni
2018-04-26 20:55   ` Randy Dunlap
2018-04-26 20:55     ` Randy Dunlap
2018-04-26 20:55     ` Randy Dunlap
2018-04-27  4:49     ` Ganapatrao Kulkarni
2018-04-27  4:49       ` Ganapatrao Kulkarni
2018-04-27  4:49       ` Ganapatrao Kulkarni
2018-04-25  9:00 ` [PATCH v4 2/2] ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver Ganapatrao Kulkarni
2018-04-25  9:00   ` Ganapatrao Kulkarni
2018-04-25  9:00   ` Ganapatrao Kulkarni
2018-04-26 10:59   ` Mark Rutland
2018-04-26 10:59     ` Mark Rutland
2018-04-26 10:59     ` Mark Rutland
2018-05-04 18:46     ` Ganapatrao Kulkarni
2018-05-04 18:46       ` Ganapatrao Kulkarni
2018-05-04 18:46       ` Ganapatrao Kulkarni
2018-05-15 10:33       ` Ganapatrao Kulkarni
2018-05-15 10:33         ` Ganapatrao Kulkarni
2018-05-15 10:33         ` Ganapatrao Kulkarni
2018-05-21 10:37         ` Mark Rutland
2018-05-21 10:37           ` Mark Rutland
2018-05-21 10:37           ` Mark Rutland
2018-05-21 10:40           ` Mark Rutland
2018-05-21 10:40             ` Mark Rutland
2018-05-21 10:40             ` Mark Rutland
2018-05-21 12:42             ` Ganapatrao Kulkarni
2018-05-21 12:42               ` Ganapatrao Kulkarni
2018-05-21 12:42               ` Ganapatrao Kulkarni
2018-05-21 10:55       ` Mark Rutland
2018-05-21 10:55         ` Mark Rutland
2018-05-21 10:55         ` Mark Rutland
2018-05-21 12:34         ` Ganapatrao Kulkarni
2018-05-21 12:34           ` Ganapatrao Kulkarni
2018-05-21 12:34           ` Ganapatrao Kulkarni
2018-04-26 22:06   ` Kim Phillips [this message]
2018-04-26 22:06     ` Kim Phillips
2018-04-26 22:06     ` Kim Phillips
2018-04-27  9:30     ` Mark Rutland
2018-04-27  9:30       ` Mark Rutland
2018-04-27  9:30       ` Mark Rutland
2018-04-27 13:15       ` Kim Phillips
2018-04-27 13:15         ` Kim Phillips
2018-04-27 13:15         ` Kim Phillips
2018-04-27 14:37         ` Will Deacon
2018-04-27 14:37           ` Will Deacon
2018-04-27 14:37           ` Will Deacon
2018-04-27 15:46           ` Kim Phillips
2018-04-27 15:46             ` Kim Phillips
2018-04-27 15:46             ` Kim Phillips
2018-04-27 16:09             ` Will Deacon
2018-04-27 16:09               ` Will Deacon
2018-04-27 16:09               ` Will Deacon
2018-04-27 16:56               ` Kim Phillips
2018-04-27 16:56                 ` Kim Phillips
2018-04-27 16:56                 ` Kim Phillips
2018-05-01 11:54                 ` Will Deacon
2018-05-01 11:54                   ` Will Deacon
2018-05-01 11:54                   ` Will Deacon
2018-05-04  0:30                   ` Kim Phillips
2018-05-04  0:30                     ` Kim Phillips
2018-05-04  0:30                     ` Kim Phillips
2018-05-04 17:10                     ` Robin Murphy
2018-05-04 17:10                       ` Robin Murphy
2018-05-04 17:10                       ` Robin Murphy
2018-05-10  1:09                       ` Kim Phillips
2018-05-10  1:09                         ` Kim Phillips
2018-05-10  1:09                         ` Kim Phillips

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=20180426170624.bfcba885431d57d0de2a3ddd@arm.com \
    --to=kim.phillips@arm.com \
    --cc=Jan.Glauber@cavium.com \
    --cc=Robert.Richter@cavium.com \
    --cc=Vadim.Lomovtsev@cavium.com \
    --cc=Will.Deacon@arm.com \
    --cc=ganapatrao.kulkarni@cavium.com \
    --cc=gklkml16@gmail.com \
    --cc=jnair@caviumnetworks.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    /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.