]> xenbits.xensource.com Git - people/pauldu/mini-os.git/commitdiff
xenbus: notify the other end when necessary
authorWei Liu <wei.liu2@citrix.com>
Tue, 27 Oct 2015 15:43:28 +0000 (15:43 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 16 Nov 2015 11:29:23 +0000 (11:29 +0000)
The xenbus thread didn't send notification to other end when it expected
more data or consumed responses, which led to stalling the ring from
time to time.

This is the culprit that guest was less responsive when using stubdom
because the device model was stalled.

Fix this by sending notification to the other end when it consumes a
message. A bunch of memory barriers are also added to ensure
correctness.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
xenbus/xenbus.c

index 4613ed65920c0ae19d05f65a35f5cd3a23b66580..0ab387ae04a003230a151bc57e3b2715727f6e0c 100644 (file)
@@ -237,6 +237,7 @@ static void xenbus_thread_func(void *ign)
                event->path = data;
                event->token = event->path + strlen(event->path) + 1;
 
+                mb();
                 xenstore_buf->rsp_cons += msg.len + sizeof(msg);
 
                 for (watch = watches; watch; watch = watch->next)
@@ -262,9 +263,13 @@ static void xenbus_thread_func(void *ign)
                     req_info[msg.req_id].reply,
                     MASK_XENSTORE_IDX(xenstore_buf->rsp_cons),
                     msg.len + sizeof(msg));
+                mb();
                 xenstore_buf->rsp_cons += msg.len + sizeof(msg);
                 wake_up(&req_info[msg.req_id].waitq);
             }
+
+            wmb();
+            notify_remote_via_evtchn(start_info.store_evtchn);
         }
     }
 }