qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Xen-devel] [PATCH 2/2] xenfb: remove out_cons in xenfb


From: Andrew Cooper
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH 2/2] xenfb: remove out_cons in xenfb_handle_events
Date: Tue, 12 Apr 2016 10:59:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0

On 12/04/16 10:57, Wei Liu wrote:
> The variable out_cons was 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 <address@hidden>
> ---
> Cc: Stefano Stabellini <address@hidden>
> Cc: Anthony Perard <address@hidden>
> ---
>  hw/display/xenfb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
> index 9866dfd..78a8dcd 100644
> --- a/hw/display/xenfb.c
> +++ b/hw/display/xenfb.c
> @@ -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;

You need the xen_rmb() before the first use of prod or cons.

~Andrew

> +    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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]