* kernelshark plugins and ftrace array fields @ 2010-09-02 12:19 Avi Kivity 2010-09-02 14:25 ` Steven Rostedt 0 siblings, 1 reply; 10+ messages in thread From: Avi Kivity @ 2010-09-02 12:19 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, KVM list I'd like to add enhance kvm_emulate_insn display in kernelshark to show the disassembly of the instruction being emulated. However, pevent_get_field_val() doesn't support arrays (the instruction is provided in a 15-byte array). Can you add support for arrays in the kernelshark API? With that, it looks like adding disassembly output to the kvm plugin should be quite simple. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 12:19 kernelshark plugins and ftrace array fields Avi Kivity @ 2010-09-02 14:25 ` Steven Rostedt 2010-09-02 14:34 ` Avi Kivity 0 siblings, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 14:25 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 15:19 +0300, Avi Kivity wrote: > I'd like to add enhance kvm_emulate_insn display in kernelshark to > show the disassembly of the instruction being emulated. However, > pevent_get_field_val() doesn't support arrays (the instruction is > provided in a 15-byte array). > > Can you add support for arrays in the kernelshark API? With that, it > looks like adding disassembly output to the kvm plugin should be quite > simple. > Sure, I could add a pevent_get_field_array() or something. Could you tell me the event and give me an example of what you want to do. Thanks, -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 14:25 ` Steven Rostedt @ 2010-09-02 14:34 ` Avi Kivity 2010-09-02 15:52 ` Steven Rostedt 2010-09-02 18:16 ` Steven Rostedt 0 siblings, 2 replies; 10+ messages in thread From: Avi Kivity @ 2010-09-02 14:34 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, KVM list On 09/02/2010 05:25 PM, Steven Rostedt wrote: > On Thu, 2010-09-02 at 15:19 +0300, Avi Kivity wrote: >> I'd like to add enhance kvm_emulate_insn display in kernelshark to >> show the disassembly of the instruction being emulated. However, >> pevent_get_field_val() doesn't support arrays (the instruction is >> provided in a 15-byte array). >> >> Can you add support for arrays in the kernelshark API? With that, it >> looks like adding disassembly output to the kvm plugin should be quite >> simple. >> > Sure, I could add a pevent_get_field_array() or something. Could you > tell me the event and give me an example of what you want to do. plugin_kvm.c: kvm_emulate_insn_handler() { fetch insn array and len field feed into disassembler trace_seq_printf() the disassembled instruction } -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 14:34 ` Avi Kivity @ 2010-09-02 15:52 ` Steven Rostedt 2010-09-02 16:06 ` Avi Kivity 2010-09-02 18:16 ` Steven Rostedt 1 sibling, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 15:52 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 17:34 +0300, Avi Kivity wrote: > On 09/02/2010 05:25 PM, Steven Rostedt wrote: > > On Thu, 2010-09-02 at 15:19 +0300, Avi Kivity wrote: > >> I'd like to add enhance kvm_emulate_insn display in kernelshark to > >> show the disassembly of the instruction being emulated. However, > >> pevent_get_field_val() doesn't support arrays (the instruction is > >> provided in a 15-byte array). > >> > >> Can you add support for arrays in the kernelshark API? With that, it > >> looks like adding disassembly output to the kvm plugin should be quite > >> simple. > >> > > Sure, I could add a pevent_get_field_array() or something. Could you > > tell me the event and give me an example of what you want to do. > > plugin_kvm.c: > > kvm_emulate_insn_handler() > { > fetch insn array and len field > feed into disassembler > trace_seq_printf() the disassembled instruction > } I don't have that tracepoint in any of my kernels. Is this new? I guess if I see the TRACE_EVENT() I could emulate something and work with it. -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 15:52 ` Steven Rostedt @ 2010-09-02 16:06 ` Avi Kivity 2010-09-02 17:55 ` Steven Rostedt 0 siblings, 1 reply; 10+ messages in thread From: Avi Kivity @ 2010-09-02 16:06 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, KVM list On 09/02/2010 06:52 PM, Steven Rostedt wrote: > >> plugin_kvm.c: >> >> kvm_emulate_insn_handler() >> { >> fetch insn array and len field >> feed into disassembler >> trace_seq_printf() the disassembled instruction >> } > I don't have that tracepoint in any of my kernels. Is this new? I guess > if I see the TRACE_EVENT() I could emulate something and work with it. > e46479f852ada, in 2.6.35-rc1. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 16:06 ` Avi Kivity @ 2010-09-02 17:55 ` Steven Rostedt 0 siblings, 0 replies; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 17:55 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 19:06 +0300, Avi Kivity wrote: > On 09/02/2010 06:52 PM, Steven Rostedt wrote: > > > >> plugin_kvm.c: > >> > >> kvm_emulate_insn_handler() > >> { > >> fetch insn array and len field > >> feed into disassembler > >> trace_seq_printf() the disassembled instruction > >> } > > I don't have that tracepoint in any of my kernels. Is this new? I guess > > if I see the TRACE_EVENT() I could emulate something and work with it. > > > > e46479f852ada, in 2.6.35-rc1. Oops! sorry. All my boxes with KVM enabled were running 2.6.34 and I was looking in the code under include/trace/events/kvm.h, forgetting that these are defined in the arch/x86 tree. Found it, thanks. -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 14:34 ` Avi Kivity 2010-09-02 15:52 ` Steven Rostedt @ 2010-09-02 18:16 ` Steven Rostedt 2010-09-02 18:38 ` Steven Rostedt 1 sibling, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 18:16 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 17:34 +0300, Avi Kivity wrote: > On 09/02/2010 05:25 PM, Steven Rostedt wrote: > > On Thu, 2010-09-02 at 15:19 +0300, Avi Kivity wrote: > >> I'd like to add enhance kvm_emulate_insn display in kernelshark to > >> show the disassembly of the instruction being emulated. However, > >> pevent_get_field_val() doesn't support arrays (the instruction is > >> provided in a 15-byte array). > >> > >> Can you add support for arrays in the kernelshark API? With that, it > >> looks like adding disassembly output to the kvm plugin should be quite > >> simple. > >> > > Sure, I could add a pevent_get_field_array() or something. Could you > > tell me the event and give me an example of what you want to do. > > plugin_kvm.c: > > kvm_emulate_insn_handler() > { > fetch insn array and len field > feed into disassembler > trace_seq_printf() the disassembled instruction > } > OK, with no modification of what I have already, I just created this handler: static int kvm_emulate_insn_handler(struct trace_seq *s, struct record *record, struct event_format *event, void *context) { struct format_field *field; unsigned char *data = record->data; int i; field = pevent_find_field(event, "insn"); if (!field) { trace_seq_puts(s, "Can't find inst field"); return 0; } trace_seq_puts(s, "insn: "); for (i = 0; i < field->size; i++) { trace_seq_printf(s, "%s%02x", i ? "," : "", data[field->offset + i]); } return 0; } I think this is what you would want, right? -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 18:16 ` Steven Rostedt @ 2010-09-02 18:38 ` Steven Rostedt 2010-09-02 19:24 ` Steven Rostedt 0 siblings, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 18:38 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 14:16 -0400, Steven Rostedt wrote: > On Thu, 2010-09-02 at 17:34 +0300, Avi Kivity wrote: > > OK, with no modification of what I have already, I just created this > handler: > > static int > kvm_emulate_insn_handler(struct trace_seq *s, struct record *record, > struct event_format *event, void *context) > { > struct format_field *field; > unsigned char *data = record->data; > int i; > > field = pevent_find_field(event, "insn"); > if (!field) { > trace_seq_puts(s, "Can't find inst field"); > return 0; > } > > trace_seq_puts(s, "insn: "); > for (i = 0; i < field->size; i++) { > trace_seq_printf(s, "%s%02x", > i ? "," : "", > data[field->offset + i]); > } > > return 0; > } > > > I think this is what you would want, right? I think I will add a: void *pevent_get_field_raw(stuct trace_seq *s, struct event_format *event, char *field_name, struct record *record, int **field_len); which will return a pointer into record->data and set the field_len to the actual size. This will be useful for dynamic arrays too, since it is more complex than just using a field->offset. -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 18:38 ` Steven Rostedt @ 2010-09-02 19:24 ` Steven Rostedt 2010-09-05 7:08 ` Avi Kivity 0 siblings, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2010-09-02 19:24 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, KVM list On Thu, 2010-09-02 at 14:38 -0400, Steven Rostedt wrote: > I think I will add a: > > void *pevent_get_field_raw(stuct trace_seq *s, > struct event_format *event, > char *field_name, > struct record *record, > int **field_len); > > which will return a pointer into record->data and set the field_len to > the actual size. > > This will be useful for dynamic arrays too, since it is more complex > than just using a field->offset. I just pushed out the changes and my new example looks like this: static int kvm_emulate_insn_handler(struct trace_seq *s, struct record *record, struct event_format *event, void *context) { unsigned char *data; int len; int i; data = pevent_get_field_raw(s, event, "insn", record, &len, 1); if (!data) return -1; trace_seq_puts(s, "insn: "); for (i = 0; i < len; i++) { trace_seq_printf(s, "%s%02x", i ? "," : "", data[i]); } return 0; } ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kernelshark plugins and ftrace array fields 2010-09-02 19:24 ` Steven Rostedt @ 2010-09-05 7:08 ` Avi Kivity 0 siblings, 0 replies; 10+ messages in thread From: Avi Kivity @ 2010-09-05 7:08 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, KVM list On 09/02/2010 10:24 PM, Steven Rostedt wrote: > > I just pushed out the changes and my new example looks like this: > > static int > kvm_emulate_insn_handler(struct trace_seq *s, struct record *record, > struct event_format *event, void *context) > { > unsigned char *data; > int len; > int i; > > data = pevent_get_field_raw(s, event, "insn", record, > &len, 1); > if (!data) > return -1; > > trace_seq_puts(s, "insn: "); > for (i = 0; i< len; i++) { > trace_seq_printf(s, "%s%02x", > i ? "," : "", > data[i]); > } > > return 0; > } > That looks perfect. But on which branch can I find it? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-09-05 7:08 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-02 12:19 kernelshark plugins and ftrace array fields Avi Kivity 2010-09-02 14:25 ` Steven Rostedt 2010-09-02 14:34 ` Avi Kivity 2010-09-02 15:52 ` Steven Rostedt 2010-09-02 16:06 ` Avi Kivity 2010-09-02 17:55 ` Steven Rostedt 2010-09-02 18:16 ` Steven Rostedt 2010-09-02 18:38 ` Steven Rostedt 2010-09-02 19:24 ` Steven Rostedt 2010-09-05 7:08 ` Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox