tracing: Allocate the ftrace event profile buffer dynamically
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · tip-bot for Frederic Weisbecker
(quoted diff) +6
-0+/* + * We can't use a size but a type in alloc_percpu() + * So let's create a dummy type that matches the desired size + */ +typedef struct {char buf[FTRACE_MAX_PROFILE_SIZE];} profile_buf_t; + static int ftrace_profile_enable_event(struct ftrace_event_call *event) {
Review
Quoted 10 lines
(quoted diff) +6
-1+ char *buf; + int ret; + if (atomic_inc_return(&event->profile_count)) return 0; - return event->profile_enable(); + buf = (char *)alloc_percpu(profile_buf_t); + if (!buf) + return -ENOMEM;
Ingo,
Did you pull in the version that allocates a buffer for each event? I thought Frederic made just a global per cpu buffer that all events can use. The buffer is just a temporary storage that will be too big to put on the stack.
-- Steve
Quoted 22 lines
(quoted diff) +20
-0+ + rcu_assign_pointer(event->profile_buf, buf); + + buf = (char *)alloc_percpu(profile_buf_t); + if (!buf) { + ret = -ENOMEM; + goto fail_nmi; + } + + rcu_assign_pointer(event->profile_buf_nmi, buf); + + ret = event->profile_enable(); + if (!ret) + return 0; + + kfree(event->profile_buf_nmi); +fail_nmi: + kfree(event->profile_buf); + + return ret; }
Quoted 24 lines · Steven Rostedt
Quoted 8 lines · tip-bot for Frederic Weisbecker
(quoted diff) +6
-0+/* + * We can't use a size but a type in alloc_percpu() + * So let's create a dummy type that matches the desired size + */ +typedef struct {char buf[FTRACE_MAX_PROFILE_SIZE];} profile_buf_t; + static int ftrace_profile_enable_event(struct ftrace_event_call *event) {Review
Quoted 10 lines
(quoted diff) +6
-1+ char *buf; + int ret; + if (atomic_inc_return(&event->profile_count)) return 0; - return event->profile_enable(); + buf = (char *)alloc_percpu(profile_buf_t); + if (!buf) + return -ENOMEM;Ingo,
Quoted 4 lines
Did you pull in the version that allocates a buffer for each event? I thought Frederic made just a global per cpu buffer that all events can use. The buffer is just a temporary storage that will be too big to put on the stack.
Yeah - i had v1 briefly - then pulled in the later (v3) one.
Ingo