Re: [Cbe-oss-dev] [PATCH] Updated: Reworked Cell OProfile: SPU mutexlock fix

From: Jochen Roth
Date: Thu May 08 2008 - 03:50:46 EST


Carl Love wrote:

> +void oprofile_add_value(unsigned long value, int cpu) {
> + struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[cpu];

Shouldn't it be
struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu);

No, I don't think so. Take a look at the other functions in
drivers/oprofile/cpu_buffer.c. For example oprofile_add_trace(). You
will see that the cpu_buffer is not accessed using the per_cpu
construct. Not sure why the compiler would complain about the
oprofile_add_value() function but not one of the other functions like
oprofile_add_trace().

Well, actually the other functions like oprofile_add_trace are using the &__get_cpu_var(cpu_buffer) construct.

What was the compiler error that you saw?

Here they are:
/home/jroth/kernel/spufs/arch/powerpc/oprofile/../../../drivers/oprofile/cpu_buffer.c: In function ‘oprofile_add_value’:
/home/jroth/kernel/spufs/arch/powerpc/oprofile/../../../drivers/oprofile/cpu_buffer.c:234: error: ‘cpu_buffer’ undeclared (first use in this function)

cpu_buffer is defined by the DEFINE_PER_CPU_SHARED_ALIGNED macro:
DEFINE_PER_CPU_SHARED_ALIGNED(struct oprofile_cpu_buffer, cpu_buffer);

I will try getting Jeremy's kernel and applying the patch there to see
if it works.

You'll find his tree at git://git.kernel.org/pub/scm/linux/kernel/git/jk/spufs.git

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/