From: Daniel Axtens <dja@axtens.net>
To: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Stephane Eranian <eranian@google.com>,
Paul Mackerras <paulus@samba.org>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH v1 5/9]powerpc/powernv: nest pmu feature detection support
Date: Wed, 03 Jun 2015 10:21:16 +1000 [thread overview]
Message-ID: <1433290876.438.46.camel@axtens.net> (raw)
In-Reply-To: <1433260778-26497-6-git-send-email-maddy@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2582 bytes --]
On Tue, 2015-06-02 at 21:29 +0530, Madhavan Srinivasan wrote:
> Patch adds a device tree function to detect the nest pmu
> support. Function will look for specific dt property "ibm,ima-chip"
> as a detection mechanism for the nest pmu.
>
> For Nest pmu, device tree will have two set of information.
> 1) Per-chip Homer address region for nest pmu counter collection area.
> 2) Supported Nest PMUs and events
What's HOMER?
>
> +static int nest_ima_detect_parse(void)
> +{
> + const __be32 *gcid;
> + const __be64 *chip_ima_reg;
> + const __be64 *chip_ima_size;
> + struct device_node *dev;
> + int rc = -EINVAL, idx;
> +
> + for_each_node_with_property(dev, "ibm,ima-chip") {
> + gcid = of_get_property(dev, "ibm,chip-id", NULL);
> + chip_ima_reg = of_get_property(dev, "reg", NULL);
> + chip_ima_size = of_get_property(dev, "size", NULL);
> + if ((!gcid) || (!chip_ima_reg) || (!chip_ima_size)) {
> + pr_err("%s: device %s missing property \n",
> + __func__, dev->full_name);
This is not a particularly informative error message. It'd be good if it
mentioned that it was for PMU.
> + return rc;
> + }
> +
> + idx = (uint32_t)be32_to_cpup(gcid);
> + p8_perchip_nest_info[idx].pbase = be64_to_cpup(chip_ima_reg);
> + p8_perchip_nest_info[idx].size = be64_to_cpup(chip_ima_size);
> + p8_perchip_nest_info[idx].vbase = (uint64_t)
> + phys_to_virt(p8_perchip_nest_info[idx].pbase);
> +
> + rc = 0;
> + }
> +
> + return rc;
I'm not sure your rc handling is correct. As I understand it:
- Start with rc = -EINVAL.
- If your first node is missing a property, return -EINVAL.
- Once your first node succeeds, set rc = 0
- If any subsequent node is missing a property, return 0.
- Return 0 if any node is successfully processed, otherwise return
-EINVAL.
If that's what you intended (especially with regards to returning 0 when
a subsequent node is missing a property), a comment explaining it would
be great.
Also, why bail out if a property is missing on any node? Why not try all
of them and see if any succeed?
> +}
> +
> static int __init nest_pmu_init(void)
> {
> int ret = 0;
> @@ -256,6 +287,12 @@ static int __init nest_pmu_init(void)
>
> cpumask_chip();
>
> + /*
> + * Detect the Nest PMU feature
> + */
> + if (nest_ima_detect_parse())
> + return 0;
> +
> return 0;
> }
Zero is returned regardless of the output of nest_ima_detect_parse. Is
that intentional? If so, do you need the 'if'?
> device_initcall(nest_pmu_init);
Regards,
Daniel Axtens
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 860 bytes --]
next prev parent reply other threads:[~2015-06-03 0:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 15:59 [PATCH v1 0/9]powerpc/powernv: Nest Instrumentation support Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 1/9]powerpc/powernv: Data structure and macros definition Madhavan Srinivasan
2015-06-02 23:11 ` Daniel Axtens
2015-06-04 7:48 ` Madhavan Srinivasan
2015-06-04 10:48 ` Mike & Meg
2015-06-02 15:59 ` [PATCH v1 2/9]powerpc/powernv: nest pmu init function with cpumask attr Madhavan Srinivasan
2015-06-02 23:14 ` Daniel Axtens
2015-06-04 8:06 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 3/9]powerpc/powernv: Add cpu hotplug support Madhavan Srinivasan
2015-06-02 23:38 ` Daniel Axtens
2015-06-04 8:30 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 4/9]powerpc/powernv: Add generic nest pmu ops Madhavan Srinivasan
2015-06-03 0:03 ` Daniel Axtens
2015-06-04 9:06 ` Madhavan Srinivasan
2015-06-04 9:27 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 5/9]powerpc/powernv: nest pmu feature detection support Madhavan Srinivasan
2015-06-03 0:21 ` Daniel Axtens [this message]
2015-06-04 9:52 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 6/9]powerpc/powernv: dt parser function for nest pmu and its events Madhavan Srinivasan
2015-06-03 0:46 ` Daniel Axtens
2015-06-04 10:03 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 7/9]powerpc/powernv: Event attr creation and PMU registration Madhavan Srinivasan
2015-06-03 1:06 ` Daniel Axtens
2015-06-09 11:41 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 8/9] powerpc/powernv: Add OPAL support for Nest PMU Madhavan Srinivasan
2015-06-03 0:54 ` Daniel Axtens
2015-06-04 10:26 ` Madhavan Srinivasan
2015-06-02 15:59 ` [PATCH v1 9/9]powerpc/powernv: Makefile changes to include nest pmu Madhavan Srinivasan
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=1433290876.438.46.camel@axtens.net \
--to=dja@axtens.net \
--cc=eranian@google.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=sukadev@linux.vnet.ibm.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.