All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 3/3] smc911x: Make the driver safer on SMP
Date: Wed, 22 Oct 2008 06:57:31 -0400	[thread overview]
Message-ID: <48FF071B.6080705@garzik.org> (raw)
In-Reply-To: <20081020171535.6277.50.stgit@pc1117.cambridge.arm.com>

Catalin Marinas wrote:
> This patch extends the critical regions covered by lp->lock to make it
> safer on SMP. The main failure point was the smc911x_hard_start_xmit
> function being called from different CPUs. It was tested on the ARM SMP
> platforms.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  drivers/net/smc911x.c |   25 ++++++++-----------------
>  1 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index 0216440..89f1fa6 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -155,23 +155,17 @@ static void PRINT_PKT(u_char *buf, int length)
>  /* this enables an interrupt in the interrupt mask register */
>  #define SMC_ENABLE_INT(lp, x) do {			\
>  	unsigned int  __mask;				\
> -	unsigned long __flags;				\
> -	spin_lock_irqsave(&lp->lock, __flags);		\
>  	__mask = SMC_GET_INT_EN((lp));			\
>  	__mask |= (x);					\
>  	SMC_SET_INT_EN((lp), __mask);			\
> -	spin_unlock_irqrestore(&lp->lock, __flags);	\
>  } while (0)
>  
>  /* this disables an interrupt from the interrupt mask register */
>  #define SMC_DISABLE_INT(lp, x) do {			\
>  	unsigned int  __mask;				\
> -	unsigned long __flags;				\
> -	spin_lock_irqsave(&lp->lock, __flags);		\
>  	__mask = SMC_GET_INT_EN((lp));			\
>  	__mask &= ~(x);					\
>  	SMC_SET_INT_EN((lp), __mask);			\
> -	spin_unlock_irqrestore(&lp->lock, __flags);	\
>  } while (0)

Very nice... this has the added benefit of making the locking more 
obvious to the reviewer, rather than burying the locking in a macro as 
the previous code did.

	Jeff




  reply	other threads:[~2008-10-22 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 17:12 [PATCH 0/3] smc911x driver updates Catalin Marinas
2008-10-20 17:15 ` [PATCH 1/3] smc911x: Allow Kconfig dependency on ARM Catalin Marinas
2008-10-20 17:15 ` [PATCH 2/3] smc911x: Add IRQ polarity configuration Catalin Marinas
2008-10-20 17:15 ` [PATCH 3/3] smc911x: Make the driver safer on SMP Catalin Marinas
2008-10-22 10:57   ` Jeff Garzik [this message]
2008-10-22 11:01   ` Jeff Garzik
2008-10-22 11:04     ` Catalin Marinas

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=48FF071B.6080705@garzik.org \
    --to=jeff@garzik.org \
    --cc=catalin.marinas@arm.com \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.