On 03/02/2012 06:31 AM, Robert Richter wrote: > On 23.02.12 17:25:11, Robert Richter wrote: >> On 23.02.12 10:12:35, Will Deacon wrote: >>> On Thu, Feb 23, 2012 at 04:08:23AM +0000, William Cohen wrote: >>>> I was looking to see why the arm kernel builds for fedora 17 were failing with: >>>> >>>> arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:28:28: error: variably modified 'perf_events' at file scope >>>> >>>> The error points to the following line in oprofile_perf.c: >>>> >>>> static struct perf_event **perf_events[nr_cpumask_bits]; >> >>> That or use NR_CPUS instead (which will be the same as nr_cpu_ids on ARM). >> >> William, >> >> the patch below uses per-cpu macros and should probably fix the >> above. But it's *compile tested only*. > > William, > > could you give this patch a try? I would like to remove the cpu array > implementation and change the code to use the cpu framework. > > Please, send me also your config for further testing. > > Many thanks, > > -Robert Hi Robert, After getting the perf support working on the trimslice machine with the 3.3.0-rc5+ kernel I tried the patch today with the attached fixup for kzalloc on an arm machine. Also made sure that the following options were set: CONFIG_CPUMASK_OFFSTACK=y CONFIG_DEBUG_PER_CPU_MAPS=y Your patch compiles and seems to work. I exercised oprofile a bit on the arm machine with the simple exercise.sh script. I didn't see complaints on the /var/log/messages. -Will
>From d57b6756b89682b692c34f10a144ac204308b6f5 Mon Sep 17 00:00:00 2001 From: William Cohen <wcohen@xxxxxxxxxx> Date: Sun, 4 Mar 2012 20:02:55 -0500 Subject: [PATCH] Correct arguments for kzalloc for oprofile_perf.c patch Signed-off-by: William Cohen <wcohen@xxxxxxxxxx> --- drivers/oprofile/oprofile_perf.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index 54192f3..4edbf58 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c @@ -284,7 +284,7 @@ int __init oprofile_perf_init(struct oprofile_operations *ops) goto out; } - counter_config = kzalloc(num_counters, + counter_config = kzalloc(num_counters * sizeof(struct op_counter_config), GFP_KERNEL); if (!counter_config) { @@ -296,7 +296,7 @@ int __init oprofile_perf_init(struct oprofile_operations *ops) } for_each_possible_cpu(cpu) { - per_cpu(perf_events, cpu) = kzalloc(num_counters, + per_cpu(perf_events, cpu) = kzalloc(num_counters * sizeof(struct perf_event *), GFP_KERNEL); if (!per_cpu(perf_events, cpu)) { pr_info("oprofile: failed to allocate %d perf events " -- 1.7.5.2
Attachment:
exercise.sh
Description: Bourne shell script
_______________________________________________ arm mailing list arm@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/arm