Messages in this thread | | | Date | Thu, 28 Jan 2010 15:51:11 +0900 | From | Hitoshi Mitake <> | Subject | Re: [PATCH 11/12] perf lock: New subcommand "perf lock", for analyzing lock statistics |
| |
On 2010年01月22日 22:39, Hitoshi Mitake wrote:
Hi Ingo, I have a trivial but difficult problem on this 11th patch.
> +static void > +process_lock_acquire_event(void *data, > + struct event *event __used, > + int cpu __used, > + u64 timestamp __used, > + struct thread *thread __used) > +{ > + struct trace_acquire_event acquire_event; > + u64 tmp; /* this is required for casting... */ > + > + tmp = raw_field_value(event, "lockdep_addr", data); > + acquire_event.addr = (void *)tmp; # <- type of addr is void *
In the above function, the statement: raw_field_value(event, "lockdep_addr", data); reads member of event which is type of void *.
But, direct assigning like acquire_event.addr = (void *)raw_field_value(event, "lockdep_addr", data); produces warning and it is treated as error on build environment of perf. GCC says "cast from function call of type ‘long long unsigned int’ to non-matching type ‘void *’". # Why is tmp to acquire_event.addr allowed? It's mysterious...
So I declared "u64 tmp" as temporary place for casting. But next, this tmp causes compile error on x86_32. Because it is u64. tmp should be u32 on x86_32.
I have to switch type of tmp u64 or u32 based on environment. Don't you know some good preprocessor flag or some other avoiding methods? I seeked but not found...
Thanks, Hitoshi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |