From: David Vrabel <david.vrabel@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
qemu-devel@nongnu.org
Cc: xen-devel@lists.xensource.com, liuling-it@360.cn
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] xenfb.c: avoid expensive loops when prod <= out_cons
Date: Wed, 6 Jan 2016 12:22:50 +0000 [thread overview]
Message-ID: <568D071A.7050009@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1601061201020.31111@kaball.uk.xensource.com>
On 06/01/16 12:08, Stefano Stabellini wrote:
> If the frontend sets out_cons to a value higher than out_prod, it will
> cause xenfb_handle_events to loop about 2^32 times. Avoid that by using
> better checks at the beginning of the function.
You can't use less than to compare prod and cons because they wrap.
You need to compare (prod - cons) against ring size (or similar) to
check for overflow. See RING_REQUEST_PROD_OVERFLOW() etc.
David
WARNING: multiple messages have this Message-ID (diff)
From: David Vrabel <david.vrabel@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
qemu-devel@nongnu.org
Cc: xen-devel@lists.xensource.com, liuling-it@360.cn
Subject: Re: [Xen-devel] [PATCH] xenfb.c: avoid expensive loops when prod <= out_cons
Date: Wed, 6 Jan 2016 12:22:50 +0000 [thread overview]
Message-ID: <568D071A.7050009@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1601061201020.31111@kaball.uk.xensource.com>
On 06/01/16 12:08, Stefano Stabellini wrote:
> If the frontend sets out_cons to a value higher than out_prod, it will
> cause xenfb_handle_events to loop about 2^32 times. Avoid that by using
> better checks at the beginning of the function.
You can't use less than to compare prod and cons because they wrap.
You need to compare (prod - cons) against ring size (or similar) to
check for overflow. See RING_REQUEST_PROD_OVERFLOW() etc.
David
next prev parent reply other threads:[~2016-01-06 12:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 12:08 [Qemu-devel] [PATCH] xenfb.c: avoid expensive loops when prod <= out_cons Stefano Stabellini
2016-01-06 12:08 ` Stefano Stabellini
2016-01-06 12:22 ` David Vrabel [this message]
2016-01-06 12:22 ` [Xen-devel] " David Vrabel
2016-01-06 14:14 ` [Qemu-devel] " Stefano Stabellini
2016-01-06 14:14 ` Stefano Stabellini
2016-01-06 12:27 ` [Qemu-devel] " Paul Durrant
2016-01-06 12:27 ` Paul Durrant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568D071A.7050009@citrix.com \
--to=david.vrabel@citrix.com \
--cc=liuling-it@360.cn \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.