All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: Julia Lawall <julia@diku.dk>
Cc: Robin Holt <holt@sgi.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] drivers/misc/sgi-xp/xpc_uv.c: convert nested
Date: Wed, 20 Oct 2010 02:51:31 +0000	[thread overview]
Message-ID: <20101020025130.GE14068@sgi.com> (raw)
In-Reply-To: <1287481436-26656-4-git-send-email-julia@diku.dk>

On Tue, Oct 19, 2010 at 11:43:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> If spin_lock_irqsave is called twice in a row with the same second
> argument, the interrupt state at the point of the second call overwrites
> the value saved by the first call.  Indeed, the second call does not need
> to save the interrupt state, so it is changed to a simple spin_lock.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression lock1,lock2;
> expression flags;
> @@
> 
> *spin_lock_irqsave(lock1,flags)
> ... when != flags
> *spin_lock_irqsave(lock2,flags)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Acked-by: Robin Holt <holt@sgi.com>

> 
> ---
>  drivers/misc/sgi-xp/xpc_uv.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 1f59ee2..7aeaef7 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -451,9 +451,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
>  
>  		if (msg->activate_gru_mq_desc_gpa !>  		    part_uv->activate_gru_mq_desc_gpa) {
> -			spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
> +			spin_lock(&part_uv->flags_lock);
>  			part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV;
> -			spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
> +			spin_unlock(&part_uv->flags_lock);
>  			part_uv->activate_gru_mq_desc_gpa >  			    msg->activate_gru_mq_desc_gpa;
>  		}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

WARNING: multiple messages have this Message-ID (diff)
From: Robin Holt <holt@sgi.com>
To: Julia Lawall <julia@diku.dk>
Cc: Robin Holt <holt@sgi.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] drivers/misc/sgi-xp/xpc_uv.c: convert nested spin_lock_irqsave to spin_lock
Date: Tue, 19 Oct 2010 21:51:31 -0500	[thread overview]
Message-ID: <20101020025130.GE14068@sgi.com> (raw)
In-Reply-To: <1287481436-26656-4-git-send-email-julia@diku.dk>

On Tue, Oct 19, 2010 at 11:43:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> If spin_lock_irqsave is called twice in a row with the same second
> argument, the interrupt state at the point of the second call overwrites
> the value saved by the first call.  Indeed, the second call does not need
> to save the interrupt state, so it is changed to a simple spin_lock.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression lock1,lock2;
> expression flags;
> @@
> 
> *spin_lock_irqsave(lock1,flags)
> ... when != flags
> *spin_lock_irqsave(lock2,flags)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Acked-by: Robin Holt <holt@sgi.com>

> 
> ---
>  drivers/misc/sgi-xp/xpc_uv.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 1f59ee2..7aeaef7 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -451,9 +451,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
>  
>  		if (msg->activate_gru_mq_desc_gpa !=
>  		    part_uv->activate_gru_mq_desc_gpa) {
> -			spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
> +			spin_lock(&part_uv->flags_lock);
>  			part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV;
> -			spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
> +			spin_unlock(&part_uv->flags_lock);
>  			part_uv->activate_gru_mq_desc_gpa =
>  			    msg->activate_gru_mq_desc_gpa;
>  		}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2010-10-20  2:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19  9:43 [PATCH 4/4] drivers/misc/sgi-xp/xpc_uv.c: convert nested spin_lock_irqsave to spin_lock Julia Lawall
2010-10-19  9:43 ` Julia Lawall
2010-10-20  2:51 ` Robin Holt [this message]
2010-10-20  2:51   ` Robin Holt

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=20101020025130.GE14068@sgi.com \
    --to=holt@sgi.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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.