On 17/05/2017 16:56, Jan Beulich wrote:
On 17.05.17 at 16:57, <anshul.mak...@citrix.com> wrote:
The condition to check for if there is space in the ring buffer
also becomes true if the buffer is full, thus consumer waits for
the producer to fill the buffer eventhough it is already full.
To resolve the situation, check if the buffer is full and then
break from the loop.
e.g case: prod = 1272, cons = 248.
Signed-off-by: Anshul Makkar <anshul.mak...@citrix.com>
Please avoid indenting the entire commit message.
Oh. sorry about that. I saw this format in few previous commits and
adopted it. Will correct it.
--- a/tools/firmware/hvmloader/xenbus.c
+++ b/tools/firmware/hvmloader/xenbus.c
@@ -141,7 +141,18 @@ static void ring_read(char *data, uint32_t len)
/* Don't overrun the producer pointer */
while ( (part = MASK_XENSTORE_IDX(rings->rsp_prod -
rings->rsp_cons)) == 0 )
+ {
+ /* don't wait for producer to fill the ring if it is already full.
+ * Condition happens when you write string > 1K into the ring.
+ * eg case prod=1272 cons=248.
+ */
Comment style.
+ if ( !(XENSTORE_RING_SIZE - (rings->rsp_prod - rings->rsp_cons)) )
Is this any different from
if ( rings->rsp_prod - rings->rsp_cons == XENSTORE_RING_SIZE )
No, its same. Ok, will use the suggested approach.
?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel