diff mbox series

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

Message ID 20200709184647.5159-1-julien@xen.org (mailing list archive)
State New, archived
Headers show
Series [XTF] xenbus: Don't wait if the response ring is full | expand

Commit Message

Julien Grall July 9, 2020, 6:46 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

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.

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 common/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wieczorkiewicz, Pawel July 10, 2020, 7:53 a.m. UTC | #1
> On 9. Jul 2020, at 20:46, Julien Grall <julien@xen.org> wrote:
> 
> 
> From: Julien Grall <jgrall@amazon.com>
> 
> 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.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>
> ---
> common/xenbus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/xenbus.c b/common/xenbus.c
> index 24fff4872372..f3bb30ac693f 100644
> --- a/common/xenbus.c
> +++ b/common/xenbus.c
> @@ -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 )
> —
> 2.17.1
> 

Reviewed-by: Pawel Wieczorkiewicz <wipawel@amazon.de>



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
Andrew Cooper July 10, 2020, 11:01 a.m. UTC | #2
On 10/07/2020 08:53, Wieczorkiewicz, Pawel wrote:
>> On 9. Jul 2020, at 20:46, Julien Grall <julien@xen.org> wrote:
>>
>> 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.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
> Reviewed-by: Pawel Wieczorkiewicz <wipawel@amazon.de>

Applied, thanks.

~Andrew
diff mbox series

Patch

diff --git a/common/xenbus.c b/common/xenbus.c
index 24fff4872372..f3bb30ac693f 100644
--- a/common/xenbus.c
+++ b/common/xenbus.c
@@ -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 )