Re: [tip:tracing/hw-branch-tracing] x86, bts: detect size of DSfields

From: Jaswinder Singh Rajput
Date: Sat Apr 11 2009 - 02:17:28 EST


Hello Markus,

Here are few sparse warnings due to this patch.
If possible, please run sparse before sending the patch.

On Fri, 2009-03-13 at 11:00 +0000, Markus Metzger wrote:
> Commit-ID: bc44fb5f7d3e764ed7698c835a1a0f35aba2eb3d
> Gitweb: http://git.kernel.org/tip/bc44fb5f7d3e764ed7698c835a1a0f35aba2eb3d
> Author: Markus Metzger <markus.t.metzger@xxxxxxxxx>
> AuthorDate: Fri, 13 Mar 2009 10:42:18 +0100
> Commit: Ingo Molnar <mingo@xxxxxxx>
> CommitDate: Fri, 13 Mar 2009 11:57:19 +0100
>
> x86, bts: detect size of DS fields
>
> Impact: more robust DS feature enumeration
>
> Detect the size of the pointer-type fields in the DS area
> configuration via the DTES64 features rather than based on
> the cpuid.
>
> Rename a variable to denote that size to reflect that it only
> covers the pointer-type fields.
>
> Add more boot-time diagnostics giving the detected size and
> the sizes of BTS and PEBS records.
>
> Use the size of the BTS/PEBS record to indicate that the
> respective feature is not available (if the record size is zero).
>
> Signed-off-by: Markus Metzger <markus.t.metzger@xxxxxxxxx>
> LKML-Reference: <20090313104218.A30096@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
>
>
> ---
> arch/x86/kernel/ds.c | 84 ++++++++++++++++++++++++++------------------------
> 1 files changed, 44 insertions(+), 40 deletions(-)
>
> diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
> index 87b67e3..6e5ec67 100644
> --- a/arch/x86/kernel/ds.c
> +++ b/arch/x86/kernel/ds.c
> @@ -441,13 +441,13 @@ enum bts_field {
>
> static inline unsigned long bts_get(const char *base, enum bts_field field)
> {
> - base += (ds_cfg.sizeof_field * field);
> + base += (ds_cfg.sizeof_ptr_field * field);

arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment
arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment
arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment
arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment
arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment
arch/x86/kernel/ds.c:514:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:514:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:514:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:514:7: error: invalid assignment

> return *(unsigned long *)base;
> }
>
> static inline void bts_set(char *base, enum bts_field field, unsigned long val)
> {
> - base += (ds_cfg.sizeof_field * field);;
> + base += (ds_cfg.sizeof_ptr_field * field);;

arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment
arch/x86/kernel/ds.c:520:35: error: incompatible types for operation (*)
arch/x86/kernel/ds.c:520:35: left side has type unsigned char static [unsigned] [toplevel] sizeof_ptr_field
arch/x86/kernel/ds.c:520:35: right side has type bad type enum bts_field field
arch/x86/kernel/ds.c:520:7: error: invalid assignment

This warning is due to some old patch:

c2724775 (Markus Metzger 2008-12-11 13:49:59 +0100 548) memset(out, 0, sizeof(*out));
c2724775 (Markus Metzger 2008-12-11 13:49:59 +0100 549) if ((bts_get(at, bts_qual) & ~bts_qual_mask) == bts_escape) {

arch/x86/kernel/ds.c:549:19: warning: incorrect type in argument 2 (invalid types)
arch/x86/kernel/ds.c:549:19: expected bad type enum bts_field field
arch/x86/kernel/ds.c:549:19: got int

Thanks,
--
JSR

--
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/