[PATCH] mieq: Provide better adaptability and diagnostics during mieq overflow

Keith Packard keithp at keithp.com
Sun Oct 16 08:44:03 PDT 2011


On Sat, 15 Oct 2011 23:09:30 -0700, Jeremy Huddleston <jeremyhu at apple.com> wrote:

> +	if (new_queue == NULL)
> +		FatalError("Unable to allocate memory for the event queue.\n");

This function should be boolean and return whether the queue was
resized, instead of failing when out of memory.

> +	miEventQueue.tail = (miEventQueue.tail - miEventQueue.head) % miEventQueue.q_size;

Shouldn't this just be miEventQueue.q_size? If not, head and tail are
both 'int' type, so the subtraction can be negative, in which case the %
operator is undefined (thanks, dmr!).


> +			ErrorF("[mi] EQ overflowing.  Increasing queue size to %lu to accomidate.\n", miEventQueue.q_size << 1);

accommodate.

> +			if (miEventQueue.dropped == 1) {
> +				ErrorF("[mi] EQ overflowing.  Maximum queue size reached.  Events will be discarded.\n");
> +	           	xorg_backtrace();
> +			} else if (miEventQueue.dropped % DROP_BACKTRACE_FREQUENCY == 0 &&
> +			           miEventQueue.dropped / DROP_BACKTRACE_FREQUENCY <= DROP_BACKTRACE_MAX) {
> +				ErrorF("[mi] EQ overflow continuing.  %lu events have been dropped.\n", miEventQueue.dropped);
> +				if (miEventQueue.dropped / DROP_BACKTRACE_FREQUENCY == DROP_BACKTRACE_MAX) {
> +					ErrorF("[mi] No further overflow reports will be reported until the clog is cleared.\n");
> +				}
> +	           	xorg_backtrace();

I'm not sure we need to be even this verbose; just a single warning when
the queue is blocked and another one when it starts working again should
be sufficient. I fear flooding the disk with errors if this happens
because your cat falls asleep on the keyboard while watching dancing
mice on the screen.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111016/a39ef14f/attachment.pgp>


More information about the xorg-devel mailing list