All of lore.kernel.org
 help / color / mirror / Atom feed
From: stefano babic <sbabic-ynQEQJNshbs@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Race condition in mpc52xx_psc_spi
Date: Mon, 08 Dec 2008 12:57:55 +0100	[thread overview]
Message-ID: <493D0BC3.4060003@denx.de> (raw)

Hi,

I have found a race condition in the PSC driver for the MPC5200.
The effect is that the processor let the RXFIFO interrupt pending and
the interrupt handler is called as soon as the IRQ is enabled again, not
after receiving the number of bytes set with the FIFO Alarm (~400).

In fact:

	   recv_at_once = in_be16(&fifo->rfnum);
                             ^---RFNUM is read only once
		[...]
                if (rx_buf) {
                    for (; recv_at_once; rb++, recv_at_once--)
			[FIFO wird gelesen] <-- now further bytes are coming

Enabling the traces, I can check that the driver writes only 20-30 Bytes
into the FIFO instead of 400 as set by the Alarm.
Because the FIFO does not become empty, according to the MPC5200 manual
the RXRDY/FFULL interrupt is not removed and a new interrupt is
generated at the next iteration.
This causes a lot of interrupts, much more as expected, generating an
higher CPU load as the usage of the RXFIFO really requires.

I will send a patch for review in short time to fix this issue.

Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office-ynQEQJNshbs@public.gmane.org
=====================================================================

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

                 reply	other threads:[~2008-12-08 11:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=493D0BC3.4060003@denx.de \
    --to=sbabic-ynqeqjnshbs@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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.