linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] mmc: mmci: Bugfix in pio read for small packets
Date: Fri, 7 Oct 2011 20:11:28 +0100	[thread overview]
Message-ID: <20111007191128.GA25689@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4E8F00E4.5010702@stericsson.com>

On Fri, Oct 07, 2011 at 03:38:44PM +0200, Ulf Hansson wrote:
> In this hot path we already do a read of the FIFOCNT register for every  
> loop in pio_read, won't this sometimes cause caches to flush and  
> similar, thus cost quite a lot - at least a lot more than executing a  
> switch/if sentence like Stefan added? Or do I miss something?

The read of FIFOCNT just reads the counter and does nothing more.  Why
do you think it causes a cache flush, and what cache do you think would
be flushed?

> I were also thinking of a possible optimization of minimizing the total  
> numbers of reads of the FIFOCNT register in pio_read. Basically we can  
> make use of the RXFIFOHALFFULL irq/status to know when there is a  
> "burst" available in the FIFO. Do you think this will be feasible for  
> the ARM MMCI Pl18x IP as well? I mean the consequence of using  
> RXFIFOHALFFULL will be less numbers of IRQ raised and then when reading  
> data from the FIFO it will be done in larger chunks.

We read the FIFOCNT register to allow us to empty as much data from the
FIFO as we possibly can at each interrupt.  We know that it's going to
be at least half full at that time because that's the interrupt which is
triggering us to do the read (except for the final few words).  What we
want to do is not just read half the FIFO, but everything that it
contains.  Hence why we read FIFOCNT.

> We could make use of the "likely" makro to make compiler optimizations  
> of the code, is that a way forward do you think?

That only helps if you look at the assembled code and inspect what the
compiler is doing.  If it's already correctly guessing the best paths,
then the likely macro does nothing for you.

But first, you need to fix your code so you're only reading 32-bit
quantities from the FIFO register.

  reply	other threads:[~2011-10-07 19:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27  7:46 [PATCH 1/4] mmc: mmci: Bugfix in pio read for small packets Ulf Hansson
2011-10-01 16:09 ` Russell King - ARM Linux
2011-10-03  7:08   ` Stefan Nilsson XK
2011-10-07 13:38     ` Ulf Hansson
2011-10-07 19:11       ` Russell King - ARM Linux [this message]
2011-10-14  7:38         ` Stefan Nilsson XK
2011-10-07 13:45   ` Ulf Hansson
2011-10-08  9:10     ` Russell King - ARM Linux
2011-10-09  6:59       ` Linus Walleij
2011-10-10  8:23         ` Ulf Hansson
2011-10-13 15:48           ` Russell King - ARM Linux
2011-10-14  8:07             ` Ulf Hansson

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=20111007191128.GA25689@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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).