Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1694618 > unrolled thread
| Started by | Suzuki K Poulose <suzuki.poulose@arm.com> |
|---|---|
| First post | 2017-07-24 12:40 +0200 |
| Last post | 2017-07-25 11:50 +0200 |
| Articles | 8 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/6] perf: Support for ARM DynamIQ Shared Unit PMU Suzuki K Poulose <suzuki.poulose@arm.com> - 2017-07-24 12:40 +0200
[PATCH v2 1/6] perf: Export perf_event_update_userpage Suzuki K Poulose <suzuki.poulose@arm.com> - 2017-07-24 12:40 +0200
[PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Suzuki K Poulose <suzuki.poulose@arm.com> - 2017-07-24 12:40 +0200
Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Marc Zyngier <marc.zyngier@arm.com> - 2017-07-24 15:20 +0200
Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-07-24 17:20 +0200
Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Sudeep Holla <sudeep.holla@arm.com> - 2017-07-24 18:50 +0200
Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-07-25 11:30 +0200
Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number Sudeep Holla <sudeep.holla@arm.com> - 2017-07-25 11:50 +0200
| From | Suzuki K Poulose <suzuki.poulose@arm.com> |
|---|---|
| Date | 2017-07-24 12:40 +0200 |
| Subject | [PATCH v2 0/6] perf: Support for ARM DynamIQ Shared Unit PMU |
| Message-ID | <u6IWm-3vE-7@gated-at.bofh.it> |
This series adds support for the PMU in ARM DynamIQ Shared Unit (DSU). The DSU integrates one or more cores with an L3 memory system, control logic, and external interfaces to form a multicore cluster. The PMU allows counting the various events related to L3, SCU etc, using 32bit independent counters along with providing a 64bit cycle counter. The PMU can only be accessed via CPU system registers, which are common to the cores connected to the same DSU. The PMU registers follow the semantics of the ARMv8 PMU, mostly, with the exception that the counters record the cluster wide events. Tested on a Fast model with DSU. The driver only supports ARM64 at the moment. It can be extended to support ARM32 by providing register accessors like we do in arch/arm64/include/arm_dsu_pmu.h. The firmware should setup appropriate bits in the ACTLR_EL3/EL2 to allow EL1 access to the PMU registers. Series applies on v4.13-rc2 and is also available at: git://linux-arm.org/linux-skp.git 4.13/dsu-v2 Changes since V1: - Use the new of_device_node_get_cpu() helper for Coresight - Rebased to 4.13-rc2 Suzuki K Poulose (6): perf: Export perf_event_update_userpage of: Add helper for mapping device node to logical CPU number coresight: of: Use of_device_node_get_cpu helper irqchip: gic-v3: Use of_device_node_get_cpu helper dt-bindings: Document devicetree binding for ARM DSU PMU perf: ARM DynamIQ Shared Unit PMU support .../devicetree/bindings/arm/arm-dsu-pmu.txt | 28 + arch/arm64/include/asm/arm_dsu_pmu.h | 124 +++ drivers/hwtracing/coresight/of_coresight.c | 20 +- drivers/irqchip/irq-gic-v3.c | 30 +- drivers/of/base.c | 26 + drivers/perf/Kconfig | 9 + drivers/perf/Makefile | 1 + drivers/perf/arm_dsu_pmu.c | 877 +++++++++++++++++++++ include/linux/of_device.h | 7 + kernel/events/core.c | 1 + 10 files changed, 1082 insertions(+), 41 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/arm-dsu-pmu.txt create mode 100644 arch/arm64/include/asm/arm_dsu_pmu.h create mode 100644 drivers/perf/arm_dsu_pmu.c -- 2.7.5
[toc] | [next] | [standalone]
| From | Suzuki K Poulose <suzuki.poulose@arm.com> |
|---|---|
| Date | 2017-07-24 12:40 +0200 |
| Subject | [PATCH v2 1/6] perf: Export perf_event_update_userpage |
| Message-ID | <u6IWn-3vE-31@gated-at.bofh.it> |
| In reply to | #1694618 |
Export perf_event_update_userpage() so that PMU driver using them,
can be built as modules.
Cc: Peter Zilstra <peterz@infradead.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
kernel/events/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 426c2ff..21aad7a 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4946,6 +4946,7 @@ void perf_event_update_userpage(struct perf_event *event)
unlock:
rcu_read_unlock();
}
+EXPORT_SYMBOL_GPL(perf_event_update_userpage);
static int perf_mmap_fault(struct vm_fault *vmf)
{
--
2.7.5
[toc] | [prev] | [next] | [standalone]
| From | Suzuki K Poulose <suzuki.poulose@arm.com> |
|---|---|
| Date | 2017-07-24 12:40 +0200 |
| Subject | [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u6IWn-3vE-35@gated-at.bofh.it> |
| In reply to | #1694618 |
Add a helper to map a device node to a logical CPU number to avoid
duplication. Currently this is open coded in different places (e.g
gic-v3, coresight). The helper tries to map device node to a "possible"
logical CPU id, which may not be online yet. It is the responsibility
of the user to make sure that the CPU is online. The helper uses
of_get_cpu_node() which uses arch specific backends to match the phyiscal
ids.
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/of/base.c | 26 ++++++++++++++++++++++++++
include/linux/of_device.h | 7 +++++++
2 files changed, 33 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 686628d..639af23 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -420,6 +420,32 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
EXPORT_SYMBOL(of_get_cpu_node);
/**
+ * of_device_node_get_cpu: Get the logical CPU number for a given device_node
+ *
+ * @cpu_node: Pointer to the device_node for CPU.
+ *
+ * Returns the logical CPU number of the given CPU device_node.
+ * Returns >= nr_cpu_ids if CPU is not found.
+ */
+int of_device_node_get_cpu(struct device_node *cpu_node)
+{
+ int cpu, thread;
+ bool found = false;
+ struct device_node *np;
+
+ for_each_possible_cpu(cpu) {
+ np = of_get_cpu_node(cpu, &thread);
+ found = (cpu_node == np);
+ of_node_put(np);
+ if (found)
+ break;
+ }
+
+ return cpu;
+}
+EXPORT_SYMBOL(of_device_node_get_cpu);
+
+/**
* __of_device_is_compatible() - Check if the node matches given constraints
* @device: pointer to node
* @compat: required compatible string, NULL or "" for any match
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index b4ad8b4..00a4ba9 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -40,6 +40,8 @@ extern int of_device_request_module(struct device *dev);
extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
+extern int of_device_node_get_cpu(struct device_node *np);
+
static inline void of_device_node_put(struct device *dev)
{
of_node_put(dev->of_node);
@@ -110,6 +112,11 @@ static inline int of_dma_configure(struct device *dev, struct device_node *np)
}
static inline void of_dma_deconfigure(struct device *dev)
{}
+
+static inline int of_device_node_get_cpu(struct device_node *np)
+{
+ return nr_cpu_ids;
+}
#endif /* CONFIG_OF */
#endif /* _LINUX_OF_DEVICE_H */
--
2.7.5
[toc] | [prev] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2017-07-24 15:20 +0200 |
| Subject | Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u6Lrc-5li-9@gated-at.bofh.it> |
| In reply to | #1694622 |
On 24/07/17 11:29, Suzuki K Poulose wrote:
> Add a helper to map a device node to a logical CPU number to avoid
> duplication. Currently this is open coded in different places (e.g
> gic-v3, coresight). The helper tries to map device node to a "possible"
> logical CPU id, which may not be online yet. It is the responsibility
> of the user to make sure that the CPU is online. The helper uses
> of_get_cpu_node() which uses arch specific backends to match the phyiscal
> ids.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> drivers/of/base.c | 26 ++++++++++++++++++++++++++
> include/linux/of_device.h | 7 +++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 686628d..639af23 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -420,6 +420,32 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
> EXPORT_SYMBOL(of_get_cpu_node);
>
> /**
> + * of_device_node_get_cpu: Get the logical CPU number for a given device_node
> + *
> + * @cpu_node: Pointer to the device_node for CPU.
> + *
> + * Returns the logical CPU number of the given CPU device_node.
> + * Returns >= nr_cpu_ids if CPU is not found.
> + */
> +int of_device_node_get_cpu(struct device_node *cpu_node)
> +{
> + int cpu, thread;
> + bool found = false;
> + struct device_node *np;
> +
> + for_each_possible_cpu(cpu) {
> + np = of_get_cpu_node(cpu, &thread);
nit: Since you don't need the thread here, you can pass NULL instead.
> + found = (cpu_node == np);
> + of_node_put(np);
> + if (found)
> + break;
> + }
> +
> + return cpu;
> +}
> +EXPORT_SYMBOL(of_device_node_get_cpu);
> +
> +/**
> * __of_device_is_compatible() - Check if the node matches given constraints
> * @device: pointer to node
> * @compat: required compatible string, NULL or "" for any match
> diff --git a/include/linux/of_device.h b/include/linux/of_device.h
> index b4ad8b4..00a4ba9 100644
> --- a/include/linux/of_device.h
> +++ b/include/linux/of_device.h
> @@ -40,6 +40,8 @@ extern int of_device_request_module(struct device *dev);
> extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
> extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
>
> +extern int of_device_node_get_cpu(struct device_node *np);
> +
> static inline void of_device_node_put(struct device *dev)
> {
> of_node_put(dev->of_node);
> @@ -110,6 +112,11 @@ static inline int of_dma_configure(struct device *dev, struct device_node *np)
> }
> static inline void of_dma_deconfigure(struct device *dev)
> {}
> +
> +static inline int of_device_node_get_cpu(struct device_node *np)
> +{
> + return nr_cpu_ids;
> +}
> #endif /* CONFIG_OF */
>
> #endif /* _LINUX_OF_DEVICE_H */
>
FWIW:
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
M.
--
Jazz is not dead. It just smells funny...
[toc] | [prev] | [next] | [standalone]
| From | Suzuki K Poulose <Suzuki.Poulose@arm.com> |
|---|---|
| Date | 2017-07-24 17:20 +0200 |
| Subject | Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u6Njj-6DL-13@gated-at.bofh.it> |
| In reply to | #1694702 |
Hi Marc,
On 24/07/17 14:14, Marc Zyngier wrote:
> On 24/07/17 11:29, Suzuki K Poulose wrote:
>> Add a helper to map a device node to a logical CPU number to avoid
>> duplication. Currently this is open coded in different places (e.g
>> gic-v3, coresight). The helper tries to map device node to a "possible"
>> logical CPU id, which may not be online yet. It is the responsibility
>> of the user to make sure that the CPU is online. The helper uses
>> of_get_cpu_node() which uses arch specific backends to match the phyiscal
>> ids.
>>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>> drivers/of/base.c | 26 ++++++++++++++++++++++++++
>> include/linux/of_device.h | 7 +++++++
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index 686628d..639af23 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> +int of_device_node_get_cpu(struct device_node *cpu_node)
>> +{
>> + int cpu, thread;
>> + bool found = false;
>> + struct device_node *np;
>> +
>> + for_each_possible_cpu(cpu) {
>> + np = of_get_cpu_node(cpu, &thread);
>
> nit: Since you don't need the thread here, you can pass NULL instead.
>
Sure, will do that in the next version.
>
> FWIW:
>
> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
>
Thanks for taking a look.
Suzuki
[toc] | [prev] | [next] | [standalone]
| From | Sudeep Holla <sudeep.holla@arm.com> |
|---|---|
| Date | 2017-07-24 18:50 +0200 |
| Subject | Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u6OIp-7tA-3@gated-at.bofh.it> |
| In reply to | #1694622 |
On 24/07/17 11:29, Suzuki K Poulose wrote:
> Add a helper to map a device node to a logical CPU number to avoid
> duplication. Currently this is open coded in different places (e.g
> gic-v3, coresight). The helper tries to map device node to a "possible"
> logical CPU id, which may not be online yet. It is the responsibility
> of the user to make sure that the CPU is online. The helper uses
> of_get_cpu_node() which uses arch specific backends to match the phyiscal
> ids.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> drivers/of/base.c | 26 ++++++++++++++++++++++++++
> include/linux/of_device.h | 7 +++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 686628d..639af23 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -420,6 +420,32 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
> EXPORT_SYMBOL(of_get_cpu_node);
>
> /**
> + * of_device_node_get_cpu: Get the logical CPU number for a given device_node
> + *
> + * @cpu_node: Pointer to the device_node for CPU.
> + *
> + * Returns the logical CPU number of the given CPU device_node.
> + * Returns >= nr_cpu_ids if CPU is not found.
> + */
> +int of_device_node_get_cpu(struct device_node *cpu_node)
> +{
> + int cpu, thread;
> + bool found = false;
> + struct device_node *np;
> +
> + for_each_possible_cpu(cpu) {
> + np = of_get_cpu_node(cpu, &thread);
Ideally, we should be able to use of_cpu_device_node_get instead of
of_get_cpu_node which parses the device tree. Not sure if that's the
case here too.
Sorry for following up on this so late. I had a patch in my tree
for-a-while to address that. Just posted it[1] now seeing this patch now.
You can move to of_cpu_device_node_get if all users of this function are
called after CPU's are registered. Otherwise, you can keep it as is for
now and it can be changed once [1] lands.
--
Regards,
Sudeep
[1] https://marc.info/?l=devicetree&m=150090452130567&w=2
[toc] | [prev] | [next] | [standalone]
| From | Suzuki K Poulose <Suzuki.Poulose@arm.com> |
|---|---|
| Date | 2017-07-25 11:30 +0200 |
| Subject | Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u74ka-YU-13@gated-at.bofh.it> |
| In reply to | #1694886 |
On 24/07/17 17:42, Sudeep Holla wrote:
>
>
> On 24/07/17 11:29, Suzuki K Poulose wrote:
>> Add a helper to map a device node to a logical CPU number to avoid
>> duplication. Currently this is open coded in different places (e.g
>> gic-v3, coresight). The helper tries to map device node to a "possible"
>> logical CPU id, which may not be online yet. It is the responsibility
>> of the user to make sure that the CPU is online. The helper uses
>> of_get_cpu_node() which uses arch specific backends to match the phyiscal
>> ids.
>>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>> drivers/of/base.c | 26 ++++++++++++++++++++++++++
>> include/linux/of_device.h | 7 +++++++
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index 686628d..639af23 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -420,6 +420,32 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
>> EXPORT_SYMBOL(of_get_cpu_node);
>>
>> /**
>> + * of_device_node_get_cpu: Get the logical CPU number for a given device_node
>> + *
>> + * @cpu_node: Pointer to the device_node for CPU.
>> + *
>> + * Returns the logical CPU number of the given CPU device_node.
>> + * Returns >= nr_cpu_ids if CPU is not found.
>> + */
>> +int of_device_node_get_cpu(struct device_node *cpu_node)
>> +{
>> + int cpu, thread;
>> + bool found = false;
>> + struct device_node *np;
>> +
>> + for_each_possible_cpu(cpu) {
>> + np = of_get_cpu_node(cpu, &thread);
>
> Ideally, we should be able to use of_cpu_device_node_get instead of
> of_get_cpu_node which parses the device tree. Not sure if that's the
> case here too.
>
> Sorry for following up on this so late. I had a patch in my tree
> for-a-while to address that. Just posted it[1] now seeing this patch now.
>
> You can move to of_cpu_device_node_get if all users of this function are
> called after CPU's are registered. Otherwise, you can keep it as is for
> now and it can be changed once [1] lands.
As you mentioned offline, since GIC uses this, we need to stick to of_get_cpu_node.
In fact, I started off with the of_cpu_device_node_get() and switched to the former.
It would be really nice to have your patch, which streamlines the interface and we
could switch to that.
Cheers
Suzuki
>
[toc] | [prev] | [next] | [standalone]
| From | Sudeep Holla <sudeep.holla@arm.com> |
|---|---|
| Date | 2017-07-25 11:50 +0200 |
| Subject | Re: [PATCH v2 2/6] of: Add helper for mapping device node to logical CPU number |
| Message-ID | <u74Dw-170-3@gated-at.bofh.it> |
| In reply to | #1695541 |
On 25/07/17 10:27, Suzuki K Poulose wrote:
> On 24/07/17 17:42, Sudeep Holla wrote:
>>
>>
>> On 24/07/17 11:29, Suzuki K Poulose wrote:
>>> Add a helper to map a device node to a logical CPU number to avoid
>>> duplication. Currently this is open coded in different places (e.g
>>> gic-v3, coresight). The helper tries to map device node to a "possible"
>>> logical CPU id, which may not be online yet. It is the responsibility
>>> of the user to make sure that the CPU is online. The helper uses
>>> of_get_cpu_node() which uses arch specific backends to match the
>>> phyiscal
>>> ids.
>>>
>>> Cc: Rob Herring <robh+dt@kernel.org>
>>> Cc: Mark Rutland <mark.rutland@arm.com>
>>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>>> ---
>>> drivers/of/base.c | 26 ++++++++++++++++++++++++++
>>> include/linux/of_device.h | 7 +++++++
>>> 2 files changed, 33 insertions(+)
>>>
>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>> index 686628d..639af23 100644
>>> --- a/drivers/of/base.c
>>> +++ b/drivers/of/base.c
>>> @@ -420,6 +420,32 @@ struct device_node *of_get_cpu_node(int cpu,
>>> unsigned int *thread)
>>> EXPORT_SYMBOL(of_get_cpu_node);
>>>
>>> /**
>>> + * of_device_node_get_cpu: Get the logical CPU number for a given
>>> device_node
>>> + *
>>> + * @cpu_node: Pointer to the device_node for CPU.
>>> + *
>>> + * Returns the logical CPU number of the given CPU device_node.
>>> + * Returns >= nr_cpu_ids if CPU is not found.
>>> + */
>>> +int of_device_node_get_cpu(struct device_node *cpu_node)
>>> +{
>>> + int cpu, thread;
>>> + bool found = false;
>>> + struct device_node *np;
>>> +
>>> + for_each_possible_cpu(cpu) {
>>> + np = of_get_cpu_node(cpu, &thread);
>>
>> Ideally, we should be able to use of_cpu_device_node_get instead of
>> of_get_cpu_node which parses the device tree. Not sure if that's the
>> case here too.
>>
>> Sorry for following up on this so late. I had a patch in my tree
>> for-a-while to address that. Just posted it[1] now seeing this patch now.
>>
>> You can move to of_cpu_device_node_get if all users of this function are
>> called after CPU's are registered. Otherwise, you can keep it as is for
>> now and it can be changed once [1] lands.
>
> As you mentioned offline, since GIC uses this, we need to stick to
> of_get_cpu_node.
Agreed.
> In fact, I started off with the of_cpu_device_node_get() and switched
> to the former.
>
Ah OK.
> It would be really nice to have your patch, which streamlines the
> interface and we could switch to that.
>
Yes, I will wait for that patch to land in the mainline, I can follow up
and remove the use of of_get_cpu_node wherever required.
--
Regards,
Sudeep
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web