Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400865

Re: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel
Date 2016-05-13 17:30 +0200
Message-ID <ryncm-6eB-17@gated-at.bofh.it> (permalink)
References <ryk4O-2Yo-19@gated-at.bofh.it> <ryk4O-2Yo-25@gated-at.bofh.it> <rykeu-343-27@gated-at.bofh.it> <ryko9-3d0-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 13, 2016 at 08:19:55PM +0800, Jisheng Zhang wrote:
> Dear Arnd,
> 
> On Fri, 13 May 2016 14:09:43 +0200 Arnd Bergmann wrote:
> 
> > On Friday 13 May 2016 19:59:19 Jisheng Zhang wrote:
> > >  /* port register accessors **************************************************/
> > >  static inline u32 rdl(struct mv643xx_eth_private *mp, int offset)
> > >  {
> > > -	return readl(mp->shared->base + offset);
> > > +	return readl_relaxed(mp->shared->base + offset);
> > >  }
> > >  
> > >  static inline u32 rdlp(struct mv643xx_eth_private *mp, int offset)
> > >  {
> > > -	return readl(mp->base + offset);
> > > +	return readl_relaxed(mp->base + offset);
> > >  }  
> > 
> > I'd recommend not changing these in general, but introducing new 'rdl_relaxed()'
> > and 'rdlp_relaxed()' etc variants that you use in the code that actually
> > is performance sensitive, but use the normal non-relaxed versions by
> > default.
> > 
> > Then add a comment to each use of the relaxed accessors on how you know
> > that it's safe for that caller. This usually is just needed for the xmit()
> > function and for the interrupt handler.
> 
> Got your points and I do think it makes sense. But could we always use the
> relaxed version to save some LoCs.

It is a trade off between lines of code and hard to find bugs. Getting
this wrong can introduce subtle bugs.

Best be paranoid and only touch the fast path, where this actually
matters.

     Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel Jisheng Zhang <jszhang@marvell.com> - 2016-05-13 14:10 +0200
  Re: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel Arnd Bergmann <arnd@arndb.de> - 2016-05-13 14:20 +0200
    Re: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed  instead of readl/writel Jisheng Zhang <jszhang@marvell.com> - 2016-05-13 14:30 +0200
      Re: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead  of readl/writel Andrew Lunn <andrew@lunn.ch> - 2016-05-13 17:30 +0200

csiph-web