xenfb bug fix and clean up
cover xenfb bug fix and clean up
Wei Liu (2):
xenfb: use the correct condition to avoid excessive looping
xenfb: remove out_cons in xenfb_handle_events
hw/display/xenfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 xenfb: use the correct condition to avoid excessive looping
In commit ac0487e1 ("xenfb.c: avoid expensive loops when prod <= out_cons"), ">=" was used. In fact, a full ring is a legit state. Correct the test to use ">".
---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Backport candidate to our own tree.
--- hw/display/xenfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/xenfb.c +1 -1
@@ -775,7 +775,7 @@ static void xenfb_handle_events(struct XenFB *xenfb) prod = page->out_prod; out_cons = page->out_cons; -if (prod - out_cons >=XENFB_OUT_RING_LEN ) { +if (prod - out_cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/2 xenfb: use the correct condition to avoid excessive looping
In reply to Wei LiuIn commit ac0487e1 ("xenfb.c: avoid expensive loops when prod <= out_cons"), ">=" was used. In fact, a full ring is a legit state. Correct the test to use ">".
---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Backport candidate to our own tree.
--- hw/display/xenfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/xenfb.c +1 -1
@@ -775,7 +775,7 @@ static void xenfb_handle_events(struct XenFB *xenfb) prod = page->out_prod; out_cons = page->out_cons; -if (prod - out_cons >=XENFB_OUT_RING_LEN ) { +if (prod - out_cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */
Signature · 1 line
2.1.4
Re: [PATCH 1/2] xenfb: use the correct condition to avoid excessive looping
Quoted 7 lines · Wei Liu
In commit
ac0487e1("xenfb.c: avoid expensive loops when prod <=out_cons"), ">=" was used. In fact, a full ring is a legit state. Correct the test to use ">".Reported-by "Hao, Xudong" <[email protected]>Signed-off-by Wei Liu <[email protected]>Tested-by "Hao, Xudong" <[email protected]>
Quoted 25 lines
---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>Backport candidate to our own tree.
--- hw/display/xenfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/display/xenfb.c +1
-1@@ -775,7 +775,7 @@ static void xenfb_handle_events(struct XenFB *xenfb) prod = page->out_prod; out_cons = page->out_cons; -if (prod - out_cons >=XENFB_OUT_RING_LEN ) { +if (prod - out_cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ Signature · 1 line
2.1.4
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH 1/2] xenfb: use the correct condition to avoid excessive looping
In reply to Wei LiuQuoted 7 lines · Wei Liu
In commit
ac0487e1("xenfb.c: avoid expensive loops when prod <=out_cons"), ">=" was used. In fact, a full ring is a legit state. Correct the test to use ">".Reported-by "Hao, Xudong" <[email protected]>Signed-off-by Wei Liu <[email protected]>Tested-by "Hao, Xudong" <[email protected]>
Quoted 25 lines
---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>Backport candidate to our own tree.
--- hw/display/xenfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/display/xenfb.c +1
-1@@ -775,7 +775,7 @@ static void xenfb_handle_events(struct XenFB *xenfb) prod = page->out_prod; out_cons = page->out_cons; -if (prod - out_cons >=XENFB_OUT_RING_LEN ) { +if (prod - out_cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ Signature · 1 line
2.1.4
Signature · 1 line
Anthony PERARD
PATCH 2/2 xenfb: remove out_cons in xenfb_handle_events
In reply to Wei LiuThe variable out_cons was only used to temporarily hold the consumer index. Use cons directly to simplify code a bit.
No functional change introduced.
---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
--- hw/display/xenfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/display/xenfb.c +4 -4
@@ -770,16 +770,16 @@ static void xenfb_invalidate(void *opaque)static void xenfb_handle_events (struct XenFB *xenfb) { -uint32_t prod, cons, out_cons; +uint32_t prod, cons;struct xenfb_page *page = xenfb->c.page; prod = page->out_prod; - out_cons = page->out_cons; -if (prod - out_cons >XENFB_OUT_RING_LEN ) { + cons = page->out_cons; +if (prod - cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ -for (cons = out_cons; cons != prod; cons++) { +for ( ; cons != prod; cons++) {union xenfb_out_event *event = &XENFB_OUT_RING_REF (page, cons);uint8_t type = event->type;int x, y, w, h;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [Xen-devel] [PATCH 2/2] xenfb: remove out_cons in xenfb_handle_events
Quoted 19 lines · Wei Liu
The variable
out_conswas only used to temporarily hold the consumer index. Use cons directly to simplify code a bit.No functional change introduced.
Signed-off-by Wei Liu <[email protected]>---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>--- hw/display/xenfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/display/xenfb.c +0
-0@@ -770,16 +770,16 @@ static void xenfb_invalidate(void *opaque)
hw/display/xenfb.c static void xenfb_invalidate(void *opaque) · line 777
Quoted 10 lines
hw/display/xenfb.c +2
-3static void xenfb_handle_events (struct XenFB *xenfb) { -uint32_t prod, cons, out_cons; +uint32_t prod, cons;struct xenfb_page *page = xenfb->c.page; prod = page->out_prod; - out_cons = page->out_cons; -if (prod - out_cons >XENFB_OUT_RING_LEN ) { + cons = page->out_cons;
You need the xen_rmb() before the first use of prod or cons.
~Andrew
hw/display/xenfb.c static void xenfb_invalidate(void *opaque) · line 785
Quoted 9 lines
hw/display/xenfb.c +2
-1+if (prod - cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ -for (cons = out_cons; cons != prod; cons++) { +for ( ; cons != prod; cons++) {union xenfb_out_event *event = &XENFB_OUT_RING_REF (page, cons);uint8_t type = event->type;int x, y, w, h;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/2] xenfb: remove out_cons in xenfb_handle_events
Quoted 26 lines · Andrew Cooper
Quoted 25 lines · Wei Liu
The variable
out_conswas only used to temporarily hold the consumer index. Use cons directly to simplify code a bit.No functional change introduced.
Signed-off-by Wei Liu <[email protected]>---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>--- hw/display/xenfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/display/xenfb.c +1
-1@@ -770,16 +770,16 @@ static void xenfb_invalidate(void *opaque)static void xenfb_handle_events (struct XenFB *xenfb) { -uint32_t prod, cons, out_cons; +uint32_t prod, cons;struct xenfb_page *page = xenfb->c.page;
Quoted 7 lines
hw/display/xenfb.c static void xenfb_invalidate(void *opaque) · line 777
Quoted 4 lines
hw/display/xenfb.c +1
-2prod = page->out_prod; - out_cons = page->out_cons; -if (prod - out_cons >XENFB_OUT_RING_LEN ) { + cons = page->out_cons;You need the
xen_rmb()before the first use of prod or cons.
Good point. I overlooked that.
The change should belong to either previous patch or a new patch though.
Wei.
Quoted 12 lines
~Andrew
Quoted 9 lines
hw/display/xenfb.c +2
-1+if (prod - cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ -for (cons = out_cons; cons != prod; cons++) { +for ( ; cons != prod; cons++) {union xenfb_out_event *event = &XENFB_OUT_RING_REF (page, cons);uint8_t type = event->type;int x, y, w, h;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [Xen-devel] [PATCH 2/2] xenfb: remove out_cons in xenfb_handle_events
In reply to Andrew CooperQuoted 26 lines · Andrew Cooper
Quoted 25 lines · Wei Liu
The variable
out_conswas only used to temporarily hold the consumer index. Use cons directly to simplify code a bit.No functional change introduced.
Signed-off-by Wei Liu <[email protected]>---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>--- hw/display/xenfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/display/xenfb.c +1
-1@@ -770,16 +770,16 @@ static void xenfb_invalidate(void *opaque)static void xenfb_handle_events (struct XenFB *xenfb) { -uint32_t prod, cons, out_cons; +uint32_t prod, cons;struct xenfb_page *page = xenfb->c.page;
Quoted 7 lines
hw/display/xenfb.c static void xenfb_invalidate(void *opaque) · line 777
Quoted 4 lines
hw/display/xenfb.c +1
-2prod = page->out_prod; - out_cons = page->out_cons; -if (prod - out_cons >XENFB_OUT_RING_LEN ) { + cons = page->out_cons;You need the
xen_rmb()before the first use of prod or cons.
Good point. I overlooked that.
The change should belong to either previous patch or a new patch though.
Wei.
Quoted 12 lines
~Andrew
Quoted 9 lines
hw/display/xenfb.c +2
-1+if (prod - cons >XENFB_OUT_RING_LEN ) {return ; }xen_rmb ();/* ensure we see ring contents up to prod */ -for (cons = out_cons; cons != prod; cons++) { +for ( ; cons != prod; cons++) {union xenfb_out_event *event = &XENFB_OUT_RING_REF (page, cons);uint8_t type = event->type;int x, y, w, h;