2013-06-04 09:46:27

by Mischa Jonker

[permalink] [raw]
Subject: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

This allows us to use pdev->name for registering a PMU device.
IMO the name is not supposed to be changed anyway.

Signed-off-by: Mischa Jonker <[email protected]>
---
arch/metag/kernel/perf/perf_event.c | 2 +-
include/linux/perf_event.h | 4 ++--
kernel/events/core.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index 3665694..5b18888 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -882,7 +882,7 @@ static int __init init_hw_perf_events(void)
}

register_cpu_notifier(&metag_pmu_notifier);
- ret = perf_pmu_register(&pmu, (char *)metag_pmu->name, PERF_TYPE_RAW);
+ ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
out:
return ret;
}
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f463a46..65a462c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -188,7 +188,7 @@ struct pmu {

struct device *dev;
const struct attribute_group **attr_groups;
- char *name;
+ const char *name;
int type;

int * __percpu pmu_disable_count;
@@ -518,7 +518,7 @@ struct perf_output_handle {

#ifdef CONFIG_PERF_EVENTS

-extern int perf_pmu_register(struct pmu *pmu, char *name, int type);
+extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
extern void perf_pmu_unregister(struct pmu *pmu);

extern int perf_num_counters(void);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 9dc297f..7003d6f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5952,7 +5952,7 @@ free_dev:
static struct lock_class_key cpuctx_mutex;
static struct lock_class_key cpuctx_lock;

-int perf_pmu_register(struct pmu *pmu, char *name, int type)
+int perf_pmu_register(struct pmu *pmu, const char *name, int type)
{
int cpu, ret;

--
1.7.0.4


2013-06-04 09:58:11

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On Tue, Jun 04, 2013 at 11:45:48AM +0200, Mischa Jonker wrote:
> This allows us to use pdev->name for registering a PMU device.
> IMO the name is not supposed to be changed anyway.
>

Indeed, and thanks!

PS. WTH is a metag?

2013-06-04 10:08:04

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On 06/04/2013 03:28 PM, Peter Zijlstra wrote:
> On Tue, Jun 04, 2013 at 11:45:48AM +0200, Mischa Jonker wrote:
>> This allows us to use pdev->name for registering a PMU device.
>> IMO the name is not supposed to be changed anyway.
>>
> Indeed, and thanks!
>
> PS. WTH is a metag?

It's the cpu core from Imagination Tech - their port got merged in 3.9 (along with
ARC from Synopsys).

2013-06-04 11:03:30

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On Tue, Jun 04, 2013 at 03:32:05PM +0530, Vineet Gupta wrote:
> On 06/04/2013 03:28 PM, Peter Zijlstra wrote:
> > On Tue, Jun 04, 2013 at 11:45:48AM +0200, Mischa Jonker wrote:
> >> This allows us to use pdev->name for registering a PMU device.
> >> IMO the name is not supposed to be changed anyway.
> >>
> > Indeed, and thanks!
> >
> > PS. WTH is a metag?
>
> It's the cpu core from Imagination Tech - their port got merged in 3.9 (along with
> ARC from Synopsys).

So its Meta-G, not me-tag :-) Google gave me the below, its not exactly
clear what kind of animal it is or what the G stands for. Too much
marketing speak, too little useful information.

http://www.imgtec.com/meta/meta-technology.asp

Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

2013-06-04 11:10:41

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On 06/04/2013 04:33 PM, Peter Zijlstra wrote:
> Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

You mean lack of prefix in this case (as opposed to MetaG).

Anyhow, this patch served a lot more purpose than Mischa really wanted - formally
introduced you to two new architectures ;-)

-Vineet

2013-06-04 11:18:26

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On Tue, Jun 04, 2013 at 04:39:05PM +0530, Vineet Gupta wrote:
> On 06/04/2013 04:33 PM, Peter Zijlstra wrote:
> > Simlar 'complaint' for the ARC stuff really, only marketing speak :-)
>
> You mean lack of prefix in this case (as opposed to MetaG).

Nah, lack of proper (!markting speak) introduction to the arch ;-)

Is there something like the Intel SDM for these archs, if so, do we want
to make it easier to find them for people?

> Anyhow, this patch served a lot more purpose than Mischa really wanted - formally
> introduced you to two new architectures ;-)

Yah.. it seems archs sneak up on you these days.

2013-06-12 11:49:56

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] perf: add const qualifier to perf_pmu_register's 'name' arg

On 04/06/13 12:18, Peter Zijlstra wrote:
> On Tue, Jun 04, 2013 at 04:39:05PM +0530, Vineet Gupta wrote:
>> On 06/04/2013 04:33 PM, Peter Zijlstra wrote:
>>> Simlar 'complaint' for the ARC stuff really, only marketing speak :-)
>>
>> You mean lack of prefix in this case (as opposed to MetaG).
>
> Nah, lack of proper (!markting speak) introduction to the arch ;-)
>
> Is there something like the Intel SDM for these archs,

For metag, see the patchset intro for a brief (hopefully !marketing)
intro and links to documentation. Meta is the marketing name, metag is
generally used in code which reduces ambiguity with the word meta - tbh
I'm not certain whether metag is short for metagence or means something
else, but it's been that way for years now.

http://lwn.net/Articles/534906/

> if so, do we want
> to make it easier to find them for people?

Where would you suggest?

Some other arches link to the linux-$ARCH project homepages in Kconfig
help text which makes sense as that can then link to various
documentation and be more easily kept up to date. Not all arches have a
big project around them like that though.

Cheers
James

Subject: [tip:perf/core] perf: Add const qualifier to perf_pmu_register's 'name' arg

Commit-ID: 03d8e80beb7db78a13c192431205b9c83f7e0cd1
Gitweb: http://git.kernel.org/tip/03d8e80beb7db78a13c192431205b9c83f7e0cd1
Author: Mischa Jonker <[email protected]>
AuthorDate: Tue, 4 Jun 2013 11:45:48 +0200
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 19 Jun 2013 12:50:23 +0200

perf: Add const qualifier to perf_pmu_register's 'name' arg

This allows us to use pdev->name for registering a PMU device.
IMO the name is not supposed to be changed anyway.

Signed-off-by: Mischa Jonker <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/metag/kernel/perf/perf_event.c | 2 +-
include/linux/perf_event.h | 4 ++--
kernel/events/core.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index 3665694..5b18888 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -882,7 +882,7 @@ static int __init init_hw_perf_events(void)
}

register_cpu_notifier(&metag_pmu_notifier);
- ret = perf_pmu_register(&pmu, (char *)metag_pmu->name, PERF_TYPE_RAW);
+ ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
out:
return ret;
}
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 74a4e14..4bc57d0 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -188,7 +188,7 @@ struct pmu {

struct device *dev;
const struct attribute_group **attr_groups;
- char *name;
+ const char *name;
int type;

int * __percpu pmu_disable_count;
@@ -519,7 +519,7 @@ struct perf_output_handle {

#ifdef CONFIG_PERF_EVENTS

-extern int perf_pmu_register(struct pmu *pmu, char *name, int type);
+extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
extern void perf_pmu_unregister(struct pmu *pmu);

extern int perf_num_counters(void);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index aca95bc..9c89207 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6179,7 +6179,7 @@ free_dev:
static struct lock_class_key cpuctx_mutex;
static struct lock_class_key cpuctx_lock;

-int perf_pmu_register(struct pmu *pmu, char *name, int type)
+int perf_pmu_register(struct pmu *pmu, const char *name, int type)
{
int cpu, ret;