public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: Kirkwood: Add memory barriers to kwgbe_send/recv
Date: Wed, 1 Jul 2009 19:09:21 +0200	[thread overview]
Message-ID: <200907011909.21754.sr@denx.de> (raw)
In-Reply-To: <m2my7oqr4d.fsf@ohwell.denx.de>

Hi Detlev,

On Wednesday 01 July 2009 18:56:18 Detlev Zundel wrote:
> > Add memory barriers to kwgbe_send/recv
> >
> > kwgbe_send/recv both have loops waiting for the hardware to set  a bit.
> > GCC 4.3.3 cleverly optimizes this to ... a while(1); loop. This patch
> > introduces memory barriers to force re-loading of the transmit
> > descriptor.
> >
> > mb() wasn't defined for arm, but perhaps it should?
>
> You should rather use read/write accessor macros which "do the right
> thing".  Try using readl() for the loop.  Memory barriers do not belong
> into "upper level" code.

I know that we advertised the usage of the io accessor functions for quite 
some time now. But I'm not so sure here anymore. One disadvantage of this 
usage could be speed penalty by the usage of too many unnecessary barriers 
(included via the accessor functions on some platforms). 

I remember a discussion either on the linuxppc-dev, linux-arm-kernel or the 
nextdev list about removing the accessor functions from the Linux version of 
this Marvell ethernet drivers (mv643xx_eth.c) at some time because of this 
speed penalty. Sorry but I don't have a link for this mlist discussion.

Just my 0.02$.

Best regards,
Stefan

=====================================================================
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 at denx.de
=====================================================================

  reply	other threads:[~2009-07-01 17:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01 15:16 [U-Boot] [PATCH] arm: Kirkwood: Add memory barriers to kwgbe_send/recv Simon Kagstrom
2009-07-01 16:56 ` Detlev Zundel
2009-07-01 17:09   ` Stefan Roese [this message]
2009-07-01 17:14     ` Scott Wood
2009-07-03  9:15       ` Detlev Zundel
2009-07-01 16:57 ` Prafulla Wadaskar
2009-07-02  6:47   ` Simon Kagstrom
2009-07-02  8:12     ` Prafulla Wadaskar
2009-07-03  8:57       ` Detlev Zundel
2009-07-04 23:52     ` Wolfgang Denk

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=200907011909.21754.sr@denx.de \
    --to=sr@denx.de \
    --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