public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers
Date: Tue, 23 Aug 2011 14:35:13 -0400	[thread overview]
Message-ID: <201108231435.15771.vapier@gentoo.org> (raw)
In-Reply-To: <CAF6FioXeFQP2a0VaZOVOTmxPvJxF4=kamS18=2=p6TFNefwUuA@mail.gmail.com>

On Tuesday, August 23, 2011 14:12:09 Anton Staaf wrote:
> On Tue, Aug 23, 2011 at 10:30 AM, Mike Frysinger wrote:
> > On Tuesday, August 23, 2011 05:19:39 Lukasz Majewski wrote:
> >> On Mon, 22 Aug 2011 11:57:57 -0700 Anton Staaf wrote:
> >> > drivers/mmc/mmc.c: ext_csd in mmc_change_freq is allocated on the stac
> >> > drivers/mmc/mmc.c: scr and switch_status in sd_change_freq are
> >> > allocated on the stack.
> >> > drivers/mmc/mmc.c: ext_csd in mmc_startup is allocated on the stack.
> >> 
> >> This allocations are already fixed:
> >> 
> >> http://patchwork.ozlabs.org/patch/110300/
> >> http://patchwork.ozlabs.org/patch/109790/
> >> 
> >> If any doubts/comments/ideas, please let me know :-)
> > 
> > hmm, i wish we had a memalign_alloca().  and all this copy & pasting of
> > get_dcache_line_size() makes me unhappy as we're encoding
> > too-low-of-a-level logic into funcs.
> > 
> > what about adding a new func like:
> > #define dma_buffer_alloca(size)
> 
> I generally avoid large allocations on the stack, they can confuse
> virtual stack management and blow out small embedded stacks.  But
> neither of these are really a problem for most U-Boot targets.

and more importantly, we're already doing these things on the stack ;)

> Are you thinking something like:
> 
> #define dma_buffer_alloca(size) alloca(size + get_dcache_line_size() -
> 1) & ~(get_dcache_line_size() - 1);

yes, exactly

> Subtracting one from the total allocated size is technically correct,
> but could fail poorly if the get_dcache_line_size function returned 0
> for some reason.  Perhaps because it's called on a target with no
> cache so the implementer figured 0 was as good as any value to return.

i'm not sure we should cater to buggy get_dcache_line_size implementations

> I have a nagging suspicion that I'm forgetting something though.  I
> know I looked at using alloca first when I was starting to deal with
> cache and DMA issues on the Tegra.  And I seem to recall a reason not
> to use it.  But it's not coming back to me now.  Perhaps someone else
> will think of it.  :)

if the stack lives in a place that dma can't access, but that'd already be a 
problem for these funcs
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110823/a55c6093/attachment.pgp 

  reply	other threads:[~2011-08-23 18:35 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-19  9:25 [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers Lukasz Majewski
2011-08-19 13:57 ` Mike Frysinger
2011-08-19 15:28   ` Lukasz Majewski
2011-08-19 15:35     ` Mike Frysinger
2011-08-22  7:29       ` Lukasz Majewski
2011-08-22 16:08         ` Mike Frysinger
2011-08-22 16:42           ` Anton Staaf
2011-08-22 16:52             ` Marek Vasut
2011-08-22 17:17             ` Mike Frysinger
2011-08-22 18:15               ` Anton Staaf
2011-08-22 18:31                 ` Mike Frysinger
2011-08-22 18:57                   ` Anton Staaf
2011-08-23  9:19                     ` Lukasz Majewski
2011-08-23 17:00                       ` Anton Staaf
2011-08-23 17:30                       ` Mike Frysinger
2011-08-23 18:12                         ` Anton Staaf
2011-08-23 18:35                           ` Mike Frysinger [this message]
2011-08-23 18:36                           ` Mike Frysinger
2011-08-23 18:46                             ` Anton Staaf
2011-08-23 20:12                           ` Wolfgang Denk
2011-08-23 20:27                             ` Anton Staaf
2011-08-23 20:37                               ` Mike Frysinger
2011-08-23 21:06                                 ` Anton Staaf
2011-08-23 21:32                                   ` Mike Frysinger
2011-08-23 21:09                                 ` Wolfgang Denk
2011-08-23 21:32                                   ` Mike Frysinger
2011-08-23 21:48                                     ` Anton Staaf
2011-08-24 16:16                                       ` Mike Frysinger
2011-08-23 22:42                                     ` Wolfgang Denk
2011-08-24  3:00                                       ` Mike Frysinger
2011-08-24 10:07                                         ` Lukasz Majewski
2011-08-24 13:25                                           ` Wolfgang Denk
2011-08-24 14:31                                             ` Lukasz Majewski
2011-08-24 16:20                                             ` Mike Frysinger
2011-08-24 17:27                                             ` Anton Staaf
2011-08-24 18:06                                               ` Mike Frysinger
2011-08-24 18:12                                               ` Wolfgang Denk
2011-08-24 18:25                                                 ` Anton Staaf
2011-08-24 19:04                                                   ` Wolfgang Denk
2011-08-24 20:12                                                     ` Anton Staaf
2011-08-24 19:18                                                   ` Lukasz Majewski
2011-08-24 20:13                                                     ` Anton Staaf
2011-08-29 20:12                                                       ` Anton Staaf
2011-08-29 20:35                                                         ` Wolfgang Denk
2011-08-29 21:08                                                           ` Anton Staaf
2011-08-29 20:47                                                         ` Scott Wood
2011-08-29 20:58                                                           ` Anton Staaf
2011-08-29 21:23                                                             ` Scott Wood
2011-08-29 21:54                                                               ` Anton Staaf
2011-08-29 22:03                                                                 ` Scott Wood
2011-08-29 22:49                                                                   ` Anton Staaf
2011-08-29 23:01                                                                     ` Scott Wood
2011-08-29 23:05                                                                       ` Anton Staaf
2011-08-23 20:35                             ` Mike Frysinger
2011-08-23  8:42           ` Lukasz Majewski

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=201108231435.15771.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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