Skip to content

Commit 7515bf5

Browse files
hbruecknerfweisbec
authored andcommitted
tracing: Add syscall tracepoints - s390 arch update
This patch includes s390 arch updates to synchronize with latest core changes in the syscalls tracing area. - tracing: Map syscall name to number (syscall_name_to_nr()) - tracing: Call arch_init_ftrace_syscalls at boot - tracing: add support tracepoint ids (set_syscall_{enter,exit}_id()) Signed-off-by: Hendrik Brueckner <[email protected]> Cc: Jason Baron <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Lai Jiangshan <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Jiaying Zhang <[email protected]> Cc: Martin Bligh <[email protected]> Cc: Li Zefan <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Paul Mundt <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 35dce1a commit 7515bf5

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

arch/s390/kernel/ftrace.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,29 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)
220220
return syscalls_metadata[nr];
221221
}
222222

223+
int syscall_name_to_nr(char *name)
224+
{
225+
int i;
226+
227+
if (!syscalls_metadata)
228+
return -1;
229+
for (i = 0; i < NR_syscalls; i++)
230+
if (syscalls_metadata[i])
231+
if (!strcmp(syscalls_metadata[i]->name, name))
232+
return i;
233+
return -1;
234+
}
235+
236+
void set_syscall_enter_id(int num, int id)
237+
{
238+
syscalls_metadata[num]->enter_id = id;
239+
}
240+
241+
void set_syscall_exit_id(int num, int id)
242+
{
243+
syscalls_metadata[num]->exit_id = id;
244+
}
245+
223246
static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
224247
{
225248
struct syscall_metadata *start;
@@ -237,24 +260,19 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
237260
return NULL;
238261
}
239262

240-
void arch_init_ftrace_syscalls(void)
263+
static int __init arch_init_ftrace_syscalls(void)
241264
{
242265
struct syscall_metadata *meta;
243266
int i;
244-
static atomic_t refs;
245-
246-
if (atomic_inc_return(&refs) != 1)
247-
goto out;
248267
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls,
249268
GFP_KERNEL);
250269
if (!syscalls_metadata)
251-
goto out;
270+
return -ENOMEM;
252271
for (i = 0; i < NR_syscalls; i++) {
253272
meta = find_syscall_meta((unsigned long)sys_call_table[i]);
254273
syscalls_metadata[i] = meta;
255274
}
256-
return;
257-
out:
258-
atomic_dec(&refs);
275+
return 0;
259276
}
277+
arch_initcall(arch_init_ftrace_syscalls);
260278
#endif

0 commit comments

Comments
 (0)