]> xenbits.xensource.com Git - osstest/rumprun.git/commitdiff
librumpxen_xendev: Add more debug
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 28 Sep 2016 13:54:39 +0000 (14:54 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 7 Oct 2016 18:02:38 +0000 (19:02 +0100)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
platform/xen/librumpxen_xendev/busdev.c
platform/xen/librumpxen_xendev/busdev_user.c

index b7d74ad93682cea538d3b6c43bb487549c19370a..8068042a13e234f5ddca196f3a4c10797289a968 100644 (file)
@@ -114,7 +114,7 @@ xenbus_dev_write(struct file *fp, off_t *offset, struct uio *uio,
        struct rumpxenbus_data_common *const dc = &d->dc;
        int err;
 
-       DPRINTF(("/dev/xen/xenbus: write...\n"));
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p]: write...\n",dc,d));
 
        if (uio->uio_offset < 0)
                return EINVAL;
@@ -200,7 +200,9 @@ xenbus_dev_read(struct file *fp, off_t *offset, struct uio *uio,
        size_t org_resid = uio->uio_resid;
        int err;
 
-       DPRINTF(("/dev/xen/xenbus: read...\n"));
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p:"
+                " read (nonblock=%d)...\n",
+                dc,d, !(fp->f_flag & FNONBLOCK)));
        mutex_enter(&d->lock);
 
        for (;;) {
@@ -233,7 +235,8 @@ xenbus_dev_read(struct file *fp, off_t *offset, struct uio *uio,
                        d->rmsg = rumpxenbus_next_event_msg(&d->dc,
                                                 !err_if_block,
                                                 &d->rmsg_free);
-
+                       DPRINTF(("/dev/xen/xenbus: read... rmsg=%p (eib=%d)\n",
+                                d->rmsg, err_if_block));
                        if (!d->rmsg) {
                                if (uio->uio_resid != org_resid)
                                        /* Done something, claim success. */
@@ -285,9 +288,9 @@ end:
 
 void rumpxenbus_dev_xb_wakeup(struct rumpxenbus_data_common *dc)
 {
-       DPRINTF(("/dev/xen/xenbus: wakeup\n"));
        struct rumpxenbus_data_dev *d =
                container_of(dc, struct rumpxenbus_data_dev, dc);
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p]: wakeup\n",d,dc));
        selnotify(&d->selinfo, RBITS, NOTE_SUBMIT);
 }
 
@@ -296,7 +299,7 @@ xenbus_dev_restart(file_t *fp)
 {
        struct rumpxenbus_data_dev *d = fp->f_data;
 
-       DPRINTF(("/dev/xen/xenbus: restart!\n"));
+       DPRINTF(("/dev/xen/xenbus[dd=%p]: restart!\n",d));
 
        mutex_enter(&d->lock);
        d->want_restart |= 1;
@@ -311,7 +314,8 @@ xenbus_dev_poll(struct file *fp, int events)
        struct rumpxenbus_data_common *const dc = &d->dc;
        int revents = 0;
 
-       DPRINTF(("/dev/xen/xenbus: poll events=0%o...\n", events));
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p]: poll events=0%o...\n",
+                dc,d,events));
 
        mutex_enter(&d->lock);
 
@@ -343,7 +347,7 @@ xenbus_dev_close(struct file *fp)
 {
        struct rumpxenbus_data_dev *d = fp->f_data;
 
-       DPRINTF(("/dev/xen/xenbus: close...\n"));
+       DPRINTF(("/dev/xen/xenbus[dd=%p]: close...\n",d));
 
        /* Not neeeded against concurrent access (we assume!)
         * but next_event_msg will want to unlock and relock it */
@@ -382,12 +386,16 @@ xenbus_dev_open(struct file *fp, void **fdata_r)
        struct rumpxenbus_data_dev *d;
        int err;
 
+       DPRINTF(("/dev/xen/xenbus: open: entry...\n"));
+
        d = xbd_malloc(sizeof(*d));
        if (!d)
                return ENOMEM;
 
        d->dc.du = 0;
 
+       DPRINTF(("/dev/xen/xenbus[%p,du=%p]: open: alloc...\n",&d->dc,d));
+
        err = rumpxenbus_dev_user_open(&d->dc);
        if (err) {
                xbd_free(d);
@@ -401,6 +409,10 @@ xenbus_dev_open(struct file *fp, void **fdata_r)
        selinit(&d->selinfo);
 
        *fdata_r = d;
+
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p,du=%p]: opened.\n",
+                &d->dc, d, d->dc.du));
+
        return 0;
 }
 
index 8e0f90aeb5b251aca8cd77dd9f2e0609729a2a3f..44253e637b34e3add2ae386c0f7e981ab22c085d 100644 (file)
@@ -213,8 +213,8 @@ rumpxenbus_process_request(struct rumpxenbus_data_common *d)
        const char *wpath, *wtoken;
        int err;
 
-       DPRINTF(("/dev/xen/xenbus: request, type=%d\n",
-                d->wbuf.msg.type));
+       DPRINTF(("/dev/xen/xenbus[%p,du=%p]: request, type=%d\n",
+                d,du, d->wbuf.msg.type));
 
        req = xbd_malloc(sizeof(*req));
        if (!req) {
@@ -327,8 +327,9 @@ process_watch_event(struct rumpxenbus_data_common *d, struct xenbus_event *event
         * one from xenstored (a) isn't visible to us here and (b)
         * anyway has the wrong token in it. */
 
-       DPRINTF(("/dev/xen/xenbus: watch event,"
+       DPRINTF(("/dev/xen/xenbus[%p]: watch event,"
                 " wpath=%s user_token=%s epath=%s xb.token=%s\n",
+                 d,
                 watch->path, watch->user_token,
                 event->path, watch->xb.token));
 
@@ -405,8 +406,9 @@ process_response(struct rumpxenbus_data_common *d, struct xenbus_dev_request *re
        _Bool error = msg->type == XS_ERROR;
        KASSERT(error || msg->type == req->req_type);
 
-       DPRINTF(("/dev/xen/xenbus: response, req_type=%d msg->type=%d\n",
-                req->req_type, msg->type));
+       DPRINTF(("/dev/xen/xenbus[%p,du=%p]:"
+                 " response, req_type=%d msg->type=%d\n",
+                d,du, req->req_type, msg->type));
 
        switch (req->req_type) {
 
@@ -495,7 +497,7 @@ rumpxenbus_next_event_msg(struct rumpxenbus_data_common *dc,
                if (!block)
                        goto fail;
 
-               DPRINTF(("/dev/xen/xenbus: about to block\n"));
+               DPRINTF(("/dev/xen/xenbus[%p,du=%p]: about to block\n",dc,d));
 
                minios_add_waiter(w, d->replies.waitq);
                spin_unlock(&xenbus_req_lock);
@@ -531,6 +533,7 @@ xenbus_dev_xb_wakeup(struct xenbus_event_queue *queue)
        /* called with req_lock held */
        struct rumpxenbus_data_user *d =
                container_of(queue, struct rumpxenbus_data_user, replies);
+       DPRINTF(("/dev/xen/xenbus[queue=%p,du=%p]: wakeup...\n",queue,d));
        minios_wake_up(&d->replies.waitq);
        rumpxenbus_dev_xb_wakeup(d->c);
 }
@@ -549,7 +552,7 @@ rumpxenbus_dev_user_shutdown(struct rumpxenbus_data_common *dc)
 {
        struct rumpxenbus_data_user *d = dc->du;
        for (;;) {
-               DPRINTF(("/dev/xen/xenbus: close loop\n"));
+               DPRINTF(("/dev/xen/xenbus[%p,du=%p]: close loop\n",dc,d));
                /* We need to go round this again and again because
                 * there might be requests in flight.  Eg if the
                 * user has an XS_WATCH in flight we have to wait for it
@@ -614,6 +617,8 @@ rumpxenbus_dev_user_open(struct rumpxenbus_data_common *dc)
        if (!d)
                return ENOMEM;
 
+       DPRINTF(("/dev/xen/xenbus[%p,dd=%p]: open: user...\n",dc,d));
+
        d->c = dc;
        d->outstanding_requests = 0;
        LIST_INIT(&d->transactions);