[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT PATCH v2 5/9] lib/uk9p: Add uk_traces
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx> On 5/9/20 7:44 PM, Cristian Banu wrote: > This patch enables nanosecond-resolution tracing of 9pfs performance. > > Excerpt from the output traces for a read(): > 2167560470 uk_9p_trace_request_create > 2167564237 uk_9p_trace_request_allocated > 2167564277 uk_9p_trace_ready tag 0 > 2167567134 uk_9p_trace_sent tag 0 > 2167625854 uk_9p_trace_received tag 0 > > Signed-off-by: Cristian Banu <cristb@xxxxxxxxx> > --- > lib/uk9p/9p.c | 57 +++++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 42 insertions(+), 15 deletions(-) > > diff --git a/lib/uk9p/9p.c b/lib/uk9p/9p.c > index f17a938..14ba299 100644 > --- a/lib/uk9p/9p.c > +++ b/lib/uk9p/9p.c > @@ -39,6 +39,13 @@ > #include <uk/9pdev.h> > #include <uk/9preq.h> > #include <uk/9pfid.h> > +#include <uk/trace.h> > + > +UK_TRACEPOINT(uk_9p_trace_request_create, ""); > +UK_TRACEPOINT(uk_9p_trace_request_allocated, ""); > +UK_TRACEPOINT(uk_9p_trace_ready, "tag %u", uint16_t); > +UK_TRACEPOINT(uk_9p_trace_sent, "tag %u", uint16_t); > +UK_TRACEPOINT(uk_9p_trace_received, "tag %u", uint16_t); > > static inline int send_and_wait_zc(struct uk_9pdev *dev, struct uk_9preq > *req, > enum uk_9preq_zcdir zc_dir, void *zc_buf, uint32_t zc_size, > @@ -46,10 +53,17 @@ static inline int send_and_wait_zc(struct uk_9pdev *dev, > struct uk_9preq *req, > { > int rc; > > - if ((rc = uk_9preq_ready(req, zc_dir, zc_buf, zc_size, zc_offset)) || > - (rc = uk_9pdev_request(dev, req)) || > - (rc = uk_9preq_waitreply(req))) > + if ((rc = uk_9preq_ready(req, zc_dir, zc_buf, zc_size, zc_offset))) > + return rc; > + uk_9p_trace_ready(req->tag); > + > + if ((rc = uk_9pdev_request(dev, req))) > return rc; > + uk_9p_trace_sent(req->tag); > + > + if ((rc = uk_9preq_waitreply(req))) > + return rc; > + uk_9p_trace_received(req->tag); > > return 0; > } > @@ -60,6 +74,19 @@ static inline int send_and_wait_no_zc(struct uk_9pdev *dev, > return send_and_wait_zc(dev, req, UK_9PREQ_ZCDIR_NONE, NULL, 0, 0); > } > > +static struct uk_9preq *request_create(struct uk_9pdev *dev, > + uint8_t type, uint32_t size) > +{ > + struct uk_9preq *req; > + > + uk_9p_trace_request_create(); > + req = uk_9pdev_req_create(dev, type, size); > + if (!PTRISERR(req)) > + uk_9p_trace_request_allocated(); > + > + return req; > +} > + > struct uk_9preq *uk_9p_version(struct uk_9pdev *dev, > const char *requested, struct uk_9p_str *received) > { > @@ -70,7 +97,7 @@ struct uk_9preq *uk_9p_version(struct uk_9pdev *dev, > > uk_9p_str_init(&requested_str, requested); > > - req = uk_9pdev_req_create(dev, UK_9P_TVERSION, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TVERSION, __PAGE_SIZE); > if (PTRISERR(req)) > return req; > > @@ -119,7 +146,7 @@ struct uk_9pfid *uk_9p_attach(struct uk_9pdev *dev, > uint32_t afid, > if (PTRISERR(fid)) > return fid; > > - req = uk_9pdev_req_create(dev, UK_9P_TATTACH, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TATTACH, __PAGE_SIZE); > if (PTRISERR(req)) { > uk_9pdev_fid_release(fid); > return (void *)req; > @@ -156,7 +183,7 @@ int uk_9p_flush(struct uk_9pdev *dev, uint16_t oldtag) > struct uk_9preq *req; > int rc = 0; > > - req = uk_9pdev_req_create(dev, UK_9P_TFLUSH, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TFLUSH, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -189,7 +216,7 @@ struct uk_9pfid *uk_9p_walk(struct uk_9pdev *dev, struct > uk_9pfid *fid, > > nwname = name ? 1 : 0; > > - req = uk_9pdev_req_create(dev, UK_9P_TWALK, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TWALK, __PAGE_SIZE); > if (PTRISERR(req)) { > rc = PTR2ERR(req); > goto out; > @@ -245,7 +272,7 @@ int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid > *fid, uint8_t mode) > struct uk_9preq *req; > int rc = 0; > > - req = uk_9pdev_req_create(dev, UK_9P_TOPEN, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TOPEN, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -279,7 +306,7 @@ int uk_9p_create(struct uk_9pdev *dev, struct uk_9pfid > *fid, > uk_9p_str_init(&name_str, name); > uk_9p_str_init(&extension_str, extension); > > - req = uk_9pdev_req_create(dev, UK_9P_TCREATE, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TCREATE, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -312,7 +339,7 @@ int uk_9p_remove(struct uk_9pdev *dev, struct uk_9pfid > *fid) > /* The fid is considered invalid even if the remove fails. */ > fid->was_removed = 1; > > - req = uk_9pdev_req_create(dev, UK_9P_TREMOVE, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TREMOVE, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -335,7 +362,7 @@ int uk_9p_clunk(struct uk_9pdev *dev, struct uk_9pfid > *fid) > if (fid->was_removed) > return 0; > > - req = uk_9pdev_req_create(dev, UK_9P_TCLUNK, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TCLUNK, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -363,7 +390,7 @@ int64_t uk_9p_read(struct uk_9pdev *dev, struct uk_9pfid > *fid, > uk_pr_debug("TREAD fid %u offset %lu count %u\n", fid->fid, > offset, count); > > - req = uk_9pdev_req_create(dev, UK_9P_TREAD, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TREAD, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -395,7 +422,7 @@ int64_t uk_9p_write(struct uk_9pdev *dev, struct uk_9pfid > *fid, > > uk_pr_debug("TWRITE fid %u offset %lu count %u\n", fid->fid, > offset, count); > - req = uk_9pdev_req_create(dev, UK_9P_TWRITE, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TWRITE, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > > @@ -423,7 +450,7 @@ struct uk_9preq *uk_9p_stat(struct uk_9pdev *dev, struct > uk_9pfid *fid, > int rc = 0; > uint16_t dummy; > > - req = uk_9pdev_req_create(dev, UK_9P_TSTAT, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TSTAT, __PAGE_SIZE); > if (PTRISERR(req)) > return req; > > @@ -451,7 +478,7 @@ int uk_9p_wstat(struct uk_9pdev *dev, struct uk_9pfid > *fid, > int rc = 0; > uint16_t *dummy; > > - req = uk_9pdev_req_create(dev, UK_9P_TWSTAT, __PAGE_SIZE); > + req = request_create(dev, UK_9P_TWSTAT, __PAGE_SIZE); > if (PTRISERR(req)) > return PTR2ERR(req); > >
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |