linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: js@sig21.net (Johannes Stezenbach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] fix DEBUG_LL DCC race condition
Date: Wed, 31 Oct 2012 18:08:54 +0100	[thread overview]
Message-ID: <20121031170853.GA20498@sig21.net> (raw)
In-Reply-To: <20121031163615.GQ21164@n2100.arm.linux.org.uk>

On Wed, Oct 31, 2012 at 04:36:15PM +0000, Russell King - ARM Linux wrote:
> On Mon, Oct 29, 2012 at 04:18:32PM +0100, Johannes Stezenbach wrote:
> > Trying to boot a kernel with I- and D-caches disabled
> > sometimes hangs when DEBUG_LL output to DCC is enabled.
> > Apparently the JTAG debugger sometimes reads the
> > DCC register before busyuart could see the wDTRfull flag,
> > thus busyuart spins in an endless loop.
> 
> This makes no sense.  Why is busyuart spinning if it does _not_ see a
> full flag?  busyuart is supposed to spin _if_ the UART has data to be
> sent.  It's not supposed to spin if the data has been sent.

Maybe my wording didn't make it clear that the current code
spins if the data has been sent (which indeed does not
make sense).  My fix changes it to spin _until_ the data has been send.

> > The reason seems to be a misunderstanding of the purpose
> > of the busyuart macro.  For UART, waituart waits until
> > there is space in the FIFO, and busyuart waits until
> > the FIFO is empty (all data is sent).
> > For DCC, busyuart should be identical to waituart since
> > there is no FIFO.
> 
> Not quite.  waituart is supposed to check that the flow control allows
> the character to be sent _or_ it's supposed to do nothing.  Look at
> the 8250 implementation debug-8250.S - this is the first implementation,
> authored by me, and therefore is the definitive implementation for this
> stuff.

OK, in the case of DCC "flow-control" would mean JTAG has
read the DCC register.  So it seems correct that both
busyuart and waituart do the same:  wait for empty DCC register.
But I agree that the double wait is superflous, waituart
could be changed to do nothing.  This would be in line with
debug-8250.S which doesn't check for space in the FIFO
in waituart.

I'll send an updated patch.

Thanks,
Johannes

  reply	other threads:[~2012-10-31 17:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 15:18 [PATCH] fix DEBUG_LL DCC race condition Johannes Stezenbach
2012-10-31 16:27 ` Tony Lindgren
2012-10-31 16:36 ` Russell King - ARM Linux
2012-10-31 17:08   ` Johannes Stezenbach [this message]
2012-10-31 17:25     ` [PATCH v2] " Johannes Stezenbach

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=20121031170853.GA20498@sig21.net \
    --to=js@sig21.net \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).