netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Roland Stigge <stigge@antcom.de>,
	alexander.h.duyck@intel.com, baruch@tkos.co.il,
	ian.campbell@citrix.com, arnd@arndb.de, netdev@vger.kernel.org,
	eilong@broadcom.com, kevin.wells@nxp.com, w.sang@pengutronix.de,
	jeffrey.t.kirsher@intel.com, joe@perches.com,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4] lpc32xx: Added ethernet driver: smp_wmb()
Date: Tue, 6 Mar 2012 14:17:45 +0000	[thread overview]
Message-ID: <20120306141745.GA15201@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1331042608.2347.1.camel@bwh-desktop>

On Tue, Mar 06, 2012 at 02:03:28PM +0000, Ben Hutchings wrote:
> On Tue, 2012-03-06 at 11:43 +0100, Roland Stigge wrote:
> > On 03/05/2012 11:45 PM, Ben Hutchings wrote:
> > >> +	/* Clear and enable interrupts */
> > >> +	writel(0xFFFF, LPC_ENET_INTCLEAR(pldat->net_base));
> > >> +	lpc_eth_enable_int(pldat->net_base);
> > >> +
> > >> +	/* Get the next TX buffer output index */
> > >> +	pldat->num_used_tx_buffs = 0;
> > >> +	pldat->last_tx_idx =
> > >> +		readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base));
> > > 
> > > Doesn't this need to be done *before* enabling interrupts?  Also, I
> > > think you need an smp_wmb() so that the interrupt handler is guaranteed
> > > to see all these writes.
> > 
> > Do you mean _one_ smp_wmb() directly after lpc_eth_enable_int() (which
> > I'm moving behind the above code?
> 
> The sequence should be
> 
> 	pldat->state = values...;
> 	smp_wmb();
> 	enable_interrupts();

Is this correct?

"SMP BARRIER PAIRING" and "EXAMPLES OF MEMORY BARRIER SEQUENCES" in
Documentation/memory-barriers.txt suggest that there should be some kind
of pairing with smp_wmb() to ensure correctness.

  reply	other threads:[~2012-03-06 14:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 21:40 [PATCH v4] lpc32xx: Added ethernet driver Roland Stigge
2012-03-05 22:45 ` Ben Hutchings
2012-03-06  0:49   ` Eric Dumazet
2012-03-06  1:26     ` Ben Hutchings
2012-03-06  8:53   ` Roland Stigge
2012-03-06 12:13     ` Eric Dumazet
2012-03-06 10:43   ` [PATCH v4] lpc32xx: Added ethernet driver: smp_wmb() Roland Stigge
2012-03-06 14:03     ` Ben Hutchings
2012-03-06 14:17       ` Russell King - ARM Linux [this message]
2012-03-06 15:37         ` Ben Hutchings

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=20120306141745.GA15201@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=alexander.h.duyck@intel.com \
    --cc=arnd@arndb.de \
    --cc=baruch@tkos.co.il \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=ian.campbell@citrix.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=joe@perches.com \
    --cc=kevin.wells@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stigge@antcom.de \
    --cc=w.sang@pengutronix.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;
as well as URLs for NNTP newsgroup(s).