[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1252941416.2964.143.camel@localhost.localdomain>
Date: Mon, 14 Sep 2009 11:16:56 -0400
From: Steven Rostedt <srostedt@...hat.com>
To: Jaswinder Singh Rajput <jaswinder@...nel.org>
Cc: Ingo Molnar <mingo@...e.hu>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-sparse@...r.kernel.org, Christopher Li <sparse@...isli.org>,
Josh Triplett <josh@...edesktop.org>
Subject: Re: Warning from ring buffer code (Was: Re: linux-next: tip tree
build warning)
On Sat, 2009-09-12 at 16:42 +0530, Jaswinder Singh Rajput wrote:
>
> Here are some more trace related warnings in current linus (as well as
> -tip) tree :
>
> CHECK arch/x86/kernel/ptrace.c
> include/trace/events/syscalls.h:18:1: warning: symbol 'ftrace_raw_output_sys_enter' was not declared. Should it be static?
> include/trace/events/syscalls.h:42:1: warning: symbol 'ftrace_raw_output_sys_exit' was not declared. Should it be static?
> include/trace/events/syscalls.h:18:1: warning: symbol 'ftrace_define_fields_sys_enter' was not declared. Should it be static?
> include/trace/events/syscalls.h:42:1: warning: symbol 'ftrace_define_fields_sys_exit' was not declared. Should it be static?
I just wrote a patch to fix the above.
> include/trace/events/syscalls.h:18:1: error: bad constant expression
> include/trace/events/syscalls.h:42:1: error: bad constant expression
Not sure why sparse is failing on this. Looking at the sched.c code, I
ran "make kernel/sched.i" and then removed the CPP expressions and then
expanded the macros and here's where it is failing:
static void ftrace_profile_sched_kthread_stop(struct task_struct *t)
{
struct ftrace_data_offsets_sched_kthread_stop __attribute__((unused)) __data_offsets;
struct ftrace_event_call *event_call = &event_sched_kthread_stop;
extern void perf_tpcounter_event(int, u64, u64, void *, int);
struct ftrace_raw_sched_kthread_stop *entry;
u64 __addr = 0, __count = 1;
unsigned long irq_flags;
int __entry_size;
int __data_size;
int pc;
do { ({ unsigned long __dummy;
typeof(irq_flags) __dummy2;
(void)(&__dummy == &__dummy2);
1;
});
do { (irq_flags) = __raw_local_save_flags();
} while (0);
} while (0);
pc = (current_thread_info()->preempt_count);
__data_size = ftrace_get_offsets_sched_kthread_stop(&__data_offsets, t);
__entry_size = (((__data_size + sizeof(*entry) + sizeof(u32))+((typeof(__data_size + sizeof(*entry) + sizeof(u32)))(sizeof(u64))-1))&~((typeof(__data_size + sizeof(*entry) + sizeof(u32)))(sizeof(u64))-1));
__entry_size -= sizeof(u32);
do {
char raw_data[__entry_size]; <<<<----------- FAILURE HERE
struct trace_entry *ent;
*(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
entry = (struct ftrace_raw_sched_kthread_stop *)raw_data;
ent = &entry->ent;
tracing_generic_entry_update(ent, irq_flags, pc);
ent->type = event_call->id;
{ memcpy(entry->comm, t->comm, 16);
entry->pid = t->pid;
;
} perf_tpcounter_event(event_call->id, __addr, __count, entry, __entry_size);
} while (0);
};
Sure enough, sparse does not like the __entry_size. I replaced it with
"10" and sparse was happy with it. That is a perfectly legal entry, so
this looks more like a bug with sparse.
I just tested this too:
static void func(int size_me) {
char array[size_me];
memcpy(array, "hello", size);
};
and sparse failed on it as well. Note, you need to have something call
func, or sparse will ignore it.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists