Skip to contentSkip to conversation

xenbus: Don't wait if the response ring is full

XTF Applied Julien Grall 3 participants 3 messages Jul 9, 2020 – Jul 10, 2020

lore
Share & tools
lore
#0 lore raw

From: Julien Grall <[email protected]>

XenStore response can be bigger than the response ring. In this case, it is possible to have the ring full (e.g cons = 19 and prod = 1043).

However, XTF will consider that there is no data and therefore wait for more input. This will result to block indefinitely as the ring is full.

This can be solved by avoiding to mask the difference between prod and cons.

---
 common/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/xenbus.c +1 -1
index 24fff4872372..f3bb30ac693f 100644
@@ -75,7 +75,7 @@ static void xenbus_read(void *data, size_t len)
         uint32_t prod = ACCESS_ONCE(xb_ring->rsp_prod);
         uint32_t cons = ACCESS_ONCE(xb_ring->rsp_cons);
 
-        part = mask_xenbus_idx(prod - cons);
+        part = prod - cons;
 
         /* No data?  Kick xenstored and wait for it to produce some data. */
         if ( !part )
Signature · 1 line
2.17.1
#1 lore raw
Quoted 34 lines · Julien Grall

From: Julien Grall <[email protected]>

XenStore response can be bigger than the response ring. In this case, it is possible to have the ring full (e.g cons = 19 and prod = 1043).

However, XTF will consider that there is no data and therefore wait for more input. This will result to block indefinitely as the ring is full.

This can be solved by avoiding to mask the difference between prod and cons.

---
common/xenbus.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
common/xenbus.c +1 -1
index 24fff4872372..f3bb30ac693f 100644
@@ -75,7 +75,7 @@ static void xenbus_read(void *data, size_t len)
        uint32_t prod = ACCESS_ONCE(xb_ring->rsp_prod);
        uint32_t cons = ACCESS_ONCE(xb_ring->rsp_cons);
 
-        part = mask_xenbus_idx(prod - cons);
+        part = prod - cons;
 
        /* No data?  Kick xenstored and wait for it to produce some data. */
        if ( !part )
Quoted 3 lines

—
2.17.1

Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879

#2 lore raw
Quoted 5 lines · Pawel
Quoted 5 lines · Julien Grall

XenStore response can be bigger than the response ring. In this case, it is possible to have the ring full (e.g cons = 19 and prod = 1043).

Quoted 8 lines
Quoted 7 lines

However, XTF will consider that there is no data and therefore wait for more input. This will result to block indefinitely as the ring is full.

This can be solved by avoiding to mask the difference between prod and cons.

Applied, thanks.

~Andrew