Replace 9p debug infrastructure with Qemu Tracing
v2 cover Replace 9p debug infrastructure with Qemu Tracing
This patchset introduces Qemu Tracing to 9p pdu handlers and removes the existing debug infrastructure which became less meaningful after the introduction of coroutines. With the existing debug infra, parallel operations creates a messy output and filtering becomes difficult.
With Qemu tracing in place, we can selectively enable/disable trace-events and the trace log can be further pretty-printed/filtered using an analysis script.
Harsh Prateek Bora (3):
hw/9pfs: Introduce tracing for 9p pdu handlers
hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu
Tracing.
scripts: Simpletrace log analysis script for pretty-printing 9p log.
Makefile.objs | 2 +- hw/9pfs/virtio-9p-debug.c | 646 ------------------------------------- hw/9pfs/virtio-9p-debug.h | 6 - hw/9pfs/virtio-9p.c | 70 ++++- scripts/analyse-9p-simpletrace.py | 142 ++++++++ trace-events | 47 +++ 6 files changed, 252 insertions(+), 661 deletions(-) delete mode 100644 hw/9pfs/virtio-9p-debug.c delete mode 100644 hw/9pfs/virtio-9p-debug.h create mode 100755 scripts/analyse-9p-simpletrace.py
PATCH v2 1/3 hw/9pfs: Introduce tracing for 9p pdu handlers
Plan is to replace the existing debug infrastructure with Qemu tracing infrastructure so that user can dynamically enable/disable trace events and therefore a meaningful trace log can be generated which can be further filtered using an analysis script.
Note: Because of current simpletrace limitations, the trace events are logging at max 6 args, however, once the more args are supported, we can change trace events to log more info as well. Also, This initial patch only provides a replacement for existing debug infra. More trace events to be added later for newly added handlers and sub-routines.
--- hw/9pfs/virtio-9p.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ trace-events | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 0 deletions(-)
hw/9pfs/virtio-9p.c +62 -0
@@ -20,6 +20,7 @@#include "virtio-9p-debug.h" #include "virtio-9p-xattr.h" #include "virtio-9p-coth.h" +#include "trace.h" int debug_9p_pdu;int open_fd_hw;
@@ -977,6 +978,7 @@ static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)if (s->proto_version ==V9FS_PROTO_2000L ) { id =P9_RLERROR ; } +trace_complete_pdu (pdu->tag, pdu->id, err);/* Trace ERROR */ }/* fill out the header */
@@ -1286,6 +1288,7 @@ static void v9fs_version(void *opaque)size_t offset =7 ;pdu_unmarshal (pdu, offset,"ds" , &s->msize, &version); +trace_v9fs_version (pdu->tag, pdu->id, s->msize, version.data);if (!strcmp (version.data,"9P2000.u" )) { s->proto_version =V9FS_PROTO_2000U ;
@@ -1296,6 +1299,8 @@ static void v9fs_version(void *opaque) } offset +=pdu_marshal (pdu, offset,"ds" , s->msize, &version); +trace_v9fs_version_return (pdu->tag, pdu->id, s->msize, version.data); +complete_pdu (s, pdu, offset);v9fs_string_free (&version);
@@ -1314,6 +1319,7 @@ static void v9fs_attach(void *opaque)ssize_t err;pdu_unmarshal (pdu, offset,"ddssd" , &fid, &afid, &uname, &aname, &n_uname); +trace_v9fs_attach (pdu->tag, pdu->id, fid, afid, uname.data, aname.data); fidp =alloc_fid (s, fid);if (fidp ==NULL ) {
@@ -1338,6 +1344,7 @@ static void v9fs_attach(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_attach_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path);complete_pdu (s, pdu, err);v9fs_string_free (&uname);v9fs_string_free (&aname);
@@ -1355,6 +1362,7 @@ static void v9fs_stat(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"d" , &fid); +trace_v9fs_stat (pdu->tag, pdu->id, fid); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -1375,6 +1383,8 @@ static void v9fs_stat(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_stat_return (pdu->tag, pdu->id, v9stat.mode, v9stat.atime, v9stat.mtime, v9stat.length); +complete_pdu (s, pdu, err); }
@@ -1391,6 +1401,7 @@ static void v9fs_getattr(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dq" , &fid, &request_mask); +trace_v9fs_getattr (pdu->tag, pdu->id, fid, request_mask); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -1420,6 +1431,10 @@ static void v9fs_getattr(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_getattr_return (pdu->tag, pdu->id, v9stat_dotl.st_result_mask, + v9stat_dotl.st_mode, v9stat_dotl.st_uid, + v9stat_dotl.st_gid); +complete_pdu (s, pdu, retval); }
@@ -1547,6 +1562,8 @@ static void v9fs_walk(void *opaque) offset +=pdu_unmarshal (pdu, offset,"ddw" , &fid, &newfid, &nwnames); +trace_v9fs_walk (pdu->tag, pdu->id, fid, newfid, nwnames); +if (nwnames && nwnames <=P9_MAXWELEM ) { wnames =g_malloc0 (sizeof (wnames[0 ]) * nwnames); qids =g_malloc0 (sizeof (qids[0 ]) * nwnames);
@@ -1603,6 +1620,7 @@ out:v9fs_path_free (&dpath);v9fs_path_free (&path); out_nofid: +trace_v9fs_walk_return (pdu->tag, pdu->id, nwnames, qids);complete_pdu (s, pdu, err);if (nwnames && nwnames <=P9_MAXWELEM ) {for (name_idx =0 ; name_idx < nwnames; name_idx++) {
@@ -1653,6 +1671,8 @@ static void v9fs_open(void *opaque) }else {pdu_unmarshal (pdu, offset,"db" , &fid, &mode); } +trace_v9fs_open (pdu->tag, pdu->id, fid, mode); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -ENOENT ;
@@ -1699,6 +1719,7 @@ static void v9fs_open(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_open_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit);complete_pdu (s, pdu, err); }
@@ -1717,6 +1738,7 @@ static void v9fs_lcreate(void *opaque)pdu_unmarshal (pdu, offset,"dsddd" , &dfid, &name, &flags, &mode, &gid); +trace_v9fs_lcreate (pdu->tag, pdu->id, dfid, flags, mode, gid); fidp =get_fid (pdu, dfid);if (fidp ==NULL ) {
@@ -1746,6 +1768,7 @@ static void v9fs_lcreate(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_lcreate_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit);complete_pdu (pdu->s, pdu, err);v9fs_string_free (&name); }
@@ -1761,6 +1784,8 @@ static void v9fs_fsync(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dd" , &fid, &datasync); +trace_v9fs_fsync (pdu->tag, pdu->id, fid, datasync); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -ENOENT ;
@@ -1785,6 +1810,7 @@ static void v9fs_clunk(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"d" , &fid); +trace_v9fs_clunk (pdu->tag, pdu->id, fid); fidp =clunk_fid (s, fid);if (fidp ==NULL ) {
@@ -1901,6 +1927,7 @@ static void v9fs_read(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dqd" , &fid, &off, &max_count); +trace_v9fs_read (pdu->tag, pdu->id, fid, off, max_count); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -1959,6 +1986,7 @@ static void v9fs_read(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_read_return (pdu->tag, pdu->id, count, err);complete_pdu (s, pdu, err); }
@@ -2043,6 +2071,8 @@ static void v9fs_readdir(void *opaque)pdu_unmarshal (pdu, offset,"dqd" , &fid, &initial_offset, &max_count); +trace_v9fs_readdir (pdu->tag, pdu->id, fid, initial_offset, max_count); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { retval = -EINVAL ;
@@ -2068,6 +2098,7 @@ static void v9fs_readdir(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_readdir_return (pdu->tag, pdu->id, count, retval);complete_pdu (s, pdu, retval); }
@@ -2132,6 +2163,7 @@ static void v9fs_write(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dqdv" , &fid, &off, &count, sg, &cnt); +trace_v9fs_write (pdu->tag, pdu->id, fid, off, count, cnt); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -2178,6 +2210,7 @@ static void v9fs_write(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_write_return (pdu->tag, pdu->id, total, err);complete_pdu (s, pdu, err); }
@@ -2202,6 +2235,8 @@ static void v9fs_create(void *opaque)pdu_unmarshal (pdu, offset,"dsdbs" , &fid, &name, &perm, &mode, &extension); +trace_v9fs_create (pdu->tag, pdu->id, fid, name.data, perm, mode); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -EINVAL ;
@@ -2335,6 +2370,7 @@ static void v9fs_create(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_create_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit);complete_pdu (pdu->s, pdu, err);v9fs_string_free (&name);v9fs_string_free (&extension);
@@ -2355,6 +2391,7 @@ static void v9fs_symlink(void *opaque)size_t offset =7 ;pdu_unmarshal (pdu, offset,"dssd" , &dfid, &name, &symname, &gid); +trace_v9fs_symlink (pdu->tag, pdu->id, dfid, name.data, symname.data, gid); dfidp =get_fid (pdu, dfid);if (dfidp ==NULL ) {
@@ -2371,6 +2408,7 @@ static void v9fs_symlink(void *opaque) out:put_fid (pdu, dfidp); out_nofid: +trace_v9fs_symlink_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path);complete_pdu (pdu->s, pdu, err);v9fs_string_free (&name);v9fs_string_free (&symname);
@@ -2385,6 +2423,7 @@ static void v9fs_flush(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"w" , &tag); +trace_v9fs_flush (pdu->tag, pdu->id, tag); QLIST_FOREACH(cancel_pdu, &s->active_list, next) {if (cancel_pdu->tag == tag) {
@@ -2415,6 +2454,7 @@ static void v9fs_link(void *opaque)int err =0 ;pdu_unmarshal (pdu, offset,"dds" , &dfid, &oldfid, &name); +trace_v9fs_link (pdu->tag, pdu->id, dfid, oldfid, name.data); dfidp =get_fid (pdu, dfid);if (dfidp ==NULL ) {
@@ -2448,6 +2488,7 @@ static void v9fs_remove(void *opaque)V9fsPDU *pdu = opaque;pdu_unmarshal (pdu, offset,"d" , &fid); +trace_v9fs_remove (pdu->tag, pdu->id, fid); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -2727,6 +2768,7 @@ static void v9fs_wstat(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dwS" , &fid, &unused, &v9stat); +trace_v9fs_wstat (pdu->tag, pdu->id, fid, v9stat.mode, v9stat.atime, v9stat.mtime); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -2895,6 +2937,7 @@ static void v9fs_mknod(void *opaque)pdu_unmarshal (pdu, offset,"dsdddd" , &fid, &name, &mode, &major, &minor, &gid); +trace_v9fs_mknod (pdu->tag, pdu->id, fid, mode, major, minor); fidp =get_fid (pdu, fid);if (fidp ==NULL ) {
@@ -2912,6 +2955,7 @@ static void v9fs_mknod(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_mknod_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path);complete_pdu (s, pdu, err);v9fs_string_free (&name); }
@@ -2939,6 +2983,9 @@ static void v9fs_lock(void *opaque)pdu_unmarshal (pdu, offset,"dbdqqds" , &fid, &flock->type, &flock->flags, &flock->start, &flock->length, &flock->proc_id, &flock->client_id); + +trace_v9fs_lock (pdu->tag, pdu->id, fid, flock->type, flock->start, flock->length); + status =P9_LOCK_ERROR ;/* We support only block flag now (that too ignored currently) */
@@ -2961,6 +3008,7 @@ out: out_nofid: err = offset; err +=pdu_marshal (pdu, offset,"b" , status); +trace_v9fs_lock_return (pdu->tag, pdu->id, status);complete_pdu (s, pdu, err);v9fs_string_free (&flock->client_id);g_free (flock);
@@ -2985,6 +3033,8 @@ static void v9fs_getlock(void *opaque) &glock->start, &glock->length, &glock->proc_id, &glock->client_id); +trace_v9fs_getlock (pdu->tag, pdu->id, fid, glock->type, glock->start, glock->length); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -ENOENT ;
@@ -3002,6 +3052,9 @@ static void v9fs_getlock(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_getlock_return (pdu->tag, pdu->id, glock->type, glock->start, + glock->length, glock->proc_id); +complete_pdu (s, pdu, err);v9fs_string_free (&glock->client_id);g_free (glock);
@@ -3022,6 +3075,8 @@ static void v9fs_mkdir(void *opaque)pdu_unmarshal (pdu, offset,"dsdd" , &fid, &name, &mode, &gid); +trace_v9fs_mkdir (pdu->tag, pdu->id, fid, name.data, mode, gid); + fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -ENOENT ;
@@ -3037,6 +3092,7 @@ static void v9fs_mkdir(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_mkdir_return (pdu->tag, pdu->id, qid.type, qid.version, qid.path, err);complete_pdu (pdu->s, pdu, err);v9fs_string_free (&name); }
@@ -3054,6 +3110,8 @@ static void v9fs_xattrwalk(void *opaque)V9fsState *s = pdu->s;pdu_unmarshal (pdu, offset,"dds" , &fid, &newfid, &name); +trace_v9fs_xattrwalk (pdu->tag, pdu->id, fid, newfid, name.data); + file_fidp =get_fid (pdu, fid);if (file_fidp ==NULL ) { err = -ENOENT ;
@@ -3130,6 +3188,7 @@ out:put_fid (pdu, xattr_fidp); } out_nofid: +trace_v9fs_xattrwalk_return (pdu->tag, pdu->id, size);complete_pdu (s, pdu, err);v9fs_string_free (&name); }
@@ -3149,6 +3208,7 @@ static void v9fs_xattrcreate(void *opaque)pdu_unmarshal (pdu, offset,"dsqd" , &fid, &name, &size, &flags); +trace_v9fs_xattrcreate (pdu->tag, pdu->id, fid, name.data, size, flags); file_fidp =get_fid (pdu, fid);if (file_fidp ==NULL ) {
@@ -3185,6 +3245,7 @@ static void v9fs_readlink(void *opaque)V9fsFidState *fidp;pdu_unmarshal (pdu, offset,"d" , &fid); +trace_v9fs_readlink (pdu->tag, pdu->id, fid); fidp =get_fid (pdu, fid);if (fidp ==NULL ) { err = -ENOENT ;
@@ -3202,6 +3263,7 @@ static void v9fs_readlink(void *opaque) out:put_fid (pdu, fidp); out_nofid: +trace_v9fs_readlink_return (pdu->tag, pdu->id, target.data);complete_pdu (pdu->s, pdu, err); }
trace-events +47 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.1.1
PATCH v2 2/3 hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu Tracing.
In reply to Harsh Prateek BoraRemoving the existing debug infrastrucure as proposed to be replaced by Qemu Tracing infrastructure.
--- Makefile.objs | 2 +- hw/9pfs/virtio-9p-debug.c | 646 --------------------------------------------- hw/9pfs/virtio-9p-debug.h | 6 - hw/9pfs/virtio-9p.c | 8 - 4 files changed, 1 insertions(+), 661 deletions(-) delete mode 100644 hw/9pfs/virtio-9p-debug.c delete mode 100644 hw/9pfs/virtio-9p-debug.h
Makefile.objs +1 -1
@@ -304,7 +304,7 @@ sound-obj-$(CONFIG_HDA) += intel-hda.o hda-audio.o adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0 hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) -9pfs-nested-$(CONFIG_VIRTFS) = virtio-9p.o virtio-9p-debug.o +9pfs-nested-$(CONFIG_VIRTFS) = virtio-9p.o 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-local.o virtio-9p-xattr.o 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-xattr-user.o virtio-9p-posix-acl.o 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-coth.o cofs.o codir.o cofile.o
hw/9pfs/virtio-9p-debug.c deleted +0 -646
646 lines not on this page · raw message
hw/9pfs/virtio-9p-debug.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef _QEMU_VIRTIO_9P_DEBUG_H -#define _QEMU_VIRTIO_9P_DEBUG_H - -void pprint_pdu (V9fsPDU *pdu); - -#endif
hw/9pfs/virtio-9p.c +0 -8
@@ -17,12 +17,10 @@#include "hw/virtio-pci.h" #include "virtio-9p.h" #include "fsdev/qemu-fsdev.h" -#include "virtio-9p-debug.h" #include "virtio-9p-xattr.h" #include "virtio-9p-coth.h" #include "trace.h" -int debug_9p_pdu;int open_fd_hw;int total_open_fd;static int open_fd_rc;
@@ -690,9 +688,6 @@ static V9fsPDU *alloc_pdu(V9fsState *s)static void free_pdu (V9fsState *s,V9fsPDU *pdu) {if (pdu) { -if (debug_9p_pdu) { -pprint_pdu (pdu); - }/* * Cancelled pdu are added back to the freelist * by flush request .
@@ -3315,9 +3310,6 @@ static void submit_pdu(V9fsState *s, V9fsPDU *pdu)Coroutine *co;CoroutineEntry *handler; -if (debug_9p_pdu) { -pprint_pdu (pdu); - }if (pdu->id >=ARRAY_SIZE (pdu_co_handlers) || (pdu_co_handlers[pdu->id] ==NULL )) { handler = v9fs_op_not_supp;
Signature · 1 line
1.7.1.1
PATCH v2 3/3 scripts: Simpletrace log analysis script for pretty-printing 9p log.
In reply to Harsh Prateek BoraThis python script allows to pretty print 9p simpletrace logs and can be further enhanced to filter 9p logs based on command line arguments.
--- scripts/analyse-9p-simpletrace.py | 142 +++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 deletions(-) create mode 100755 scripts/analyse-9p-simpletrace.py
scripts/analyse-9p-simpletrace.py new file +142 -0
@@ -0,0 +1,142 @@ +#!/usr/bin/env python +# Pretty print 9p simpletrace log +# Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid> +# +# Author: Harsh Prateek Bora + +import simpletrace + +class VirtFSRequestTracker(simpletrace.Analyzer): + def begin(self): + print "Pretty printing 9p simpletrace log ..." + + def complete_pdu(self, tag, id, err): + print "ERROR (tag =", tag, ", id =", id, ",err =", err, ")" + + def v9fs_version(self, tag, id, msize, version): + print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + + def v9fs_version_return(self, tag, id, msize, version): + print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + + def v9fs_attach(self, tag, id, fid, afid, uname, aname): + print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")" + + def v9fs_attach_return(self, tag, id, type, verison, path): + print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + + def v9fs_stat(self, tag, id, fid): + print "TSTAT (tag =", tag, ", fid =", fid, ")" + + def v9fs_stat_return(self, tag, id, mode, atime, mtime, length): + print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")" + + def v9fs_getattr(self, tag, id, fid, request_mask): + print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")" + + def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid): + print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")" + + def v9fs_walk(self, tag, id, fid, newfid, nwnames): + print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")" + + def v9fs_walk_return(self, tag, id, nwnames, qids): + print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")" + + def v9fs_open(self, tag, id, fid, mode): + print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")" + + def v9fs_open_return(self, tag, id, type, version, path, iounit): + print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid): + print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")" + + def v9fs_lcreate_return(self, id, type, version, path, iounit): + print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_fsync(self, tag, id, fid, datasync): + print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")" + + def v9fs_clunk(self, tag, id, fid): + print "TCLUNK (tag =", tag, ", fid =", fid, ")" + + def v9fs_read(self, tag, id, fid, off, max_count): + print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")" + + def v9fs_read_return(self, tag, id, count, err): + print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")" + + def v9fs_readdir(self, tag, id, fid, offset, max_count): + print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")" + + def v9fs_readdir_return(self, tag, id, count, retval): + print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")" + + def v9fs_write(self, tag, id, fid, off, count, cnt): + print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")" + + def v9fs_write_return(self, tag, id, total, err): + print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")" + + def v9fs_create(self, tag, id, fid, perm, name, mode): + print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")" + + def v9fs_create_return(self, tag, id, type, verison, path, iounit): + print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_symlink(self, tag, id, fid, name, symname, gid): + print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")" + + def v9fs_symlink_return(self, tag, id, type, version, path): + print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + + def v9fs_flush(self, tag, id, flush_tag): + print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")" + + def v9fs_link(self, tag, id, dfid, oldfid, name): + print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")" + + def v9fs_remove(self, tag, id, fid): + print "TREMOVE (tag =", tag, ", fid =", fid, ")" + + def v9fs_wstat(self, tag, id, fid, mode, atime, mtime): + print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")" + + def v9fs_mknod(self, tag, id, fid, mode, major, minor): + print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")" + + def v9fs_lock(self, tag, id, fid, type, start, length): + print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + + def v9fs_lock_return(self, tag, id, status): + print "RLOCK (tag =", tag, ", status =", status, ")" + + def v9fs_getlock(self, tag, id, fid, type, start, length): + print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + + def v9fs_getlock_return(self, tag, id, type, start, length, proc_id): + print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")" + + def v9fs_mkdir(self, tag, id, fid, name, mode, gid): + print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")" + + def v9fs_mkdir_return(self, tag, id, type, version, path, err): + print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")" + + def v9fs_xattrwalk(self, tag, id, fid, newfid, name): + print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")" + + def v9fs_xattrwalk_return(self, tag, id, size): + print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")" + + def v9fs_xattrcreate(self, tag, id, fid, name, size, flags): + print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")" + + def v9fs_readlink(self, tag, id, fid): + print "TREADLINK (tag =", tag, ", fid =", fid, ")" + + def v9fs_readlink_return(self, tag, id, target): + print "RREADLINK (tag =", tag, ", target =", target, ")" + +simpletrace.run(VirtFSRequestTracker())
Signature · 1 line
1.7.1.1
Re: [Qemu-devel] [PATCH v2 3/3] scripts: Simpletrace log analysis script for pretty-printing 9p log.
Quoted 2 lines · Harsh Prateek Bora
This python script allows to pretty print 9p simpletrace logs and can be further enhanced to filter 9p logs based on command line arguments.
Sample ouput of this analysis script (will be added in commit log):
Pretty printing 9p simpletrace log ...
TGETATTR (tag = 1 , fid = 0 , request_mask = 0x7ff ) RGETATTR (tag = 1 , result_mask = 0x7ff , mode = 040777 , uid = 500
, gid = 500 )
TXATTRWALK (tag = 1 , fid = 0 , newfid = 1 , xattr name = 36832096 )
RXATTRWALK (tag = 1 , xattrsize = 18446744073709551555 )
TXATTRWALK (tag = 1 , fid = 0 , newfid = 1 , xattr name = 36744768 )
RXATTRWALK (tag = 1 , xattrsize = 18446744073709551555 )
TGETATTR (tag = 1 , fid = 1 , request_mask = 0x3fff )
RGETATTR (tag = 1 , result_mask = 0x17ff , mode = 040777 , uid = 500 , gid = 500 )
TWALK (tag = 1 , fid = 1 , newfid = 2 , nwnames = 1 ) RWALK (tag = 1 , nwnames = 1 , qids = 0x230aea0 )
Quoted 155 lines
Signed-off-by Harsh Prateek Bora<[email protected]>--- scripts/analyse-9p-simpletrace.py | 142 +++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 deletions(-)create mode 100755
scripts/analyse-9p-simpletrace.pyscripts/analyse-9p-simpletrace.py new file +142
-0@@ -0,0 +1,142 @@ +#!/usr/bin/env python +# Pretty print 9p simpletrace log +# Usage: ./analyse-9p-simpletrace<trace-events> <trace-pid> +# +# Author: Harsh Prateek Bora + +import simpletrace + +class VirtFSRequestTracker(simpletrace.Analyzer): + def begin(self): + print "Pretty printing 9p simpletrace log ..." + + def complete_pdu(self, tag, id, err): + print "ERROR (tag =", tag, ", id =", id, ",err =", err, ")" + + def v9fs_version(self, tag, id, msize, version): + print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + + def v9fs_version_return(self, tag, id, msize, version): + print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + + def v9fs_attach(self, tag, id, fid, afid, uname, aname): + print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")" + + def v9fs_attach_return(self, tag, id, type, verison, path): + print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + + def v9fs_stat(self, tag, id, fid): + print "TSTAT (tag =", tag, ", fid =", fid, ")" + + def v9fs_stat_return(self, tag, id, mode, atime, mtime, length): + print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")" + + def v9fs_getattr(self, tag, id, fid, request_mask): + print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")" + + def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid): + print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")" + + def v9fs_walk(self, tag, id, fid, newfid, nwnames): + print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")" + + def v9fs_walk_return(self, tag, id, nwnames, qids): + print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")" + + def v9fs_open(self, tag, id, fid, mode): + print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")" + + def v9fs_open_return(self, tag, id, type, version, path, iounit): + print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid): + print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")" + + def v9fs_lcreate_return(self, id, type, version, path, iounit): + print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_fsync(self, tag, id, fid, datasync): + print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")" + + def v9fs_clunk(self, tag, id, fid): + print "TCLUNK (tag =", tag, ", fid =", fid, ")" + + def v9fs_read(self, tag, id, fid, off, max_count): + print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")" + + def v9fs_read_return(self, tag, id, count, err): + print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")" + + def v9fs_readdir(self, tag, id, fid, offset, max_count): + print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")" + + def v9fs_readdir_return(self, tag, id, count, retval): + print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")" + + def v9fs_write(self, tag, id, fid, off, count, cnt): + print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")" + + def v9fs_write_return(self, tag, id, total, err): + print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")" + + def v9fs_create(self, tag, id, fid, perm, name, mode): + print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")" + + def v9fs_create_return(self, tag, id, type, verison, path, iounit): + print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + + def v9fs_symlink(self, tag, id, fid, name, symname, gid): + print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")" + + def v9fs_symlink_return(self, tag, id, type, version, path): + print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + + def v9fs_flush(self, tag, id, flush_tag): + print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")" + + def v9fs_link(self, tag, id, dfid, oldfid, name): + print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")" + + def v9fs_remove(self, tag, id, fid): + print "TREMOVE (tag =", tag, ", fid =", fid, ")" + + def v9fs_wstat(self, tag, id, fid, mode, atime, mtime): + print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")" + + def v9fs_mknod(self, tag, id, fid, mode, major, minor): + print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")" + + def v9fs_lock(self, tag, id, fid, type, start, length): + print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + + def v9fs_lock_return(self, tag, id, status): + print "RLOCK (tag =", tag, ", status =", status, ")" + + def v9fs_getlock(self, tag, id, fid, type, start, length): + print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + + def v9fs_getlock_return(self, tag, id, type, start, length, proc_id): + print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")" + + def v9fs_mkdir(self, tag, id, fid, name, mode, gid): + print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")" + + def v9fs_mkdir_return(self, tag, id, type, version, path, err): + print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")" + + def v9fs_xattrwalk(self, tag, id, fid, newfid, name): + print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")" + + def v9fs_xattrwalk_return(self, tag, id, size): + print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")" + + def v9fs_xattrcreate(self, tag, id, fid, name, size, flags): + print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")" + + def v9fs_readlink(self, tag, id, fid): + print "TREADLINK (tag =", tag, ", fid =", fid, ")" + + def v9fs_readlink_return(self, tag, id, target): + print "RREADLINK (tag =", tag, ", target =", target, ")" + +simpletrace.run(VirtFSRequestTracker())
Aneesh Kumar K.V
AppliedQuoted 9 lines · Harsh Prateek Bora
This patchset introduces Qemu Tracing to 9p pdu handlers and removes the existing debug infrastructure which became less meaningful after the introduction of coroutines. With the existing debug infra, parallel operations creates a messy output and filtering becomes difficult.
With Qemu tracing in place, we can selectively enable/disable trace-events and the trace log can be further pretty-printed/filtered using an analysis script.
Quoted 6 lines
Harsh Prateek Bora (3):
hw/9pfs: Introduce tracing for 9p pdu handlers
hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu
Tracing.
scripts: Simpletrace log analysis script for pretty-printing 9p log.
applied to v9fs tree with sample output added to patch 3
thanks
-aneesh