提交 6f21037b 编写于 作者: J Jan Kiszka 提交者: Jiri Olsa

tools lib traceevent: Factor out print_exit_reason in kvm plugin

We will reuse it for nested vmexit tracepoints.

Link: http://lkml.kernel.org/r/619c418c8af87f03027b8c8013b0443996605700.1388855989.git.jan.kiszka@web.deAcked-by: NNamhyung Kim <namhyung@kernel.org>
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NJiri Olsa <jolsa@kernel.org>
上级 20d3cbd7
...@@ -244,15 +244,14 @@ static const char *find_exit_reason(unsigned isa, int val) ...@@ -244,15 +244,14 @@ static const char *find_exit_reason(unsigned isa, int val)
return strings[i].str; return strings[i].str;
} }
static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, static int print_exit_reason(struct trace_seq *s, struct pevent_record *record,
struct event_format *event, void *context) struct event_format *event, const char *field)
{ {
unsigned long long isa; unsigned long long isa;
unsigned long long val; unsigned long long val;
unsigned long long info1 = 0, info2 = 0;
const char *reason; const char *reason;
if (pevent_get_field_val(s, event, "exit_reason", record, &val, 1) < 0) if (pevent_get_field_val(s, event, field, record, &val, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0)
...@@ -263,6 +262,16 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, ...@@ -263,6 +262,16 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
trace_seq_printf(s, "reason %s", reason); trace_seq_printf(s, "reason %s", reason);
else else
trace_seq_printf(s, "reason UNKNOWN (%llu)", val); trace_seq_printf(s, "reason UNKNOWN (%llu)", val);
return 0;
}
static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
struct event_format *event, void *context)
{
unsigned long long info1 = 0, info2 = 0;
if (print_exit_reason(s, record, event, "exit_reason") < 0)
return -1;
pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册