All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Julia Lawall <julia@diku.dk>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drivers/acpi: call rcu_read_unlock in default case
Date: Sun, 01 Aug 2010 04:46:08 +0000	[thread overview]
Message-ID: <20100801044608.GG2470@linux.vnet.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1007312234590.12199@ask.diku.dk>

On Sat, Jul 31, 2010 at 10:35:28PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Adjust the default case so that it benefits from the call to rcu_read_unlock.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @rcu@
> position p1;
> @@
> 
> rcu_read_lock@p1();
> ...
> rcu_read_unlock();
> 
> @@
> position rcu.p1;
> @@
> 
> *rcu_read_lock@p1();
> ... when != rcu_read_unlock();
> // </smpl>

I don't claim to understand the SmPL above, but I do like the patch.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/acpi/atomicio.c             |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
> index 8f8bd73..f426010 100644
> --- a/drivers/acpi/atomicio.c
> +++ b/drivers/acpi/atomicio.c
> @@ -267,6 +267,7 @@ EXPORT_SYMBOL_GPL(acpi_post_unmap_gar);
>  static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
>  {
>  	void __iomem *addr;
> +	int res = 0;
> 
>  	rcu_read_lock();
>  	addr = __acpi_ioremap_fast(paddr, width);
> @@ -284,16 +285,17 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
>  		*val = readq(addr);
>  		break;
>  	default:
> -		return -EINVAL;
> +		res = -EINVAL;
>  	}
>  	rcu_read_unlock();
> 
> -	return 0;
> +	return res;
>  }
> 
>  static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
>  {
>  	void __iomem *addr;
> +	int res = 0;
> 
>  	rcu_read_lock();
>  	addr = __acpi_ioremap_fast(paddr, width);
> @@ -311,11 +313,11 @@ static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
>  		writeq(val, addr);
>  		break;
>  	default:
> -		return -EINVAL;
> +		res = -EINVAL;
>  	}
>  	rcu_read_unlock();
> 
> -	return 0;
> +	return res;
>  }
> 
>  /* GAR accessing in atomic (including NMI) or process context */
> --
> 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: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Julia Lawall <julia@diku.dk>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drivers/acpi: call rcu_read_unlock in default case
Date: Sat, 31 Jul 2010 21:46:08 -0700	[thread overview]
Message-ID: <20100801044608.GG2470@linux.vnet.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1007312234590.12199@ask.diku.dk>

On Sat, Jul 31, 2010 at 10:35:28PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Adjust the default case so that it benefits from the call to rcu_read_unlock.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @rcu@
> position p1;
> @@
> 
> rcu_read_lock@p1();
> ...
> rcu_read_unlock();
> 
> @@
> position rcu.p1;
> @@
> 
> *rcu_read_lock@p1();
> ... when != rcu_read_unlock();
> // </smpl>

I don't claim to understand the SmPL above, but I do like the patch.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/acpi/atomicio.c             |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
> index 8f8bd73..f426010 100644
> --- a/drivers/acpi/atomicio.c
> +++ b/drivers/acpi/atomicio.c
> @@ -267,6 +267,7 @@ EXPORT_SYMBOL_GPL(acpi_post_unmap_gar);
>  static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
>  {
>  	void __iomem *addr;
> +	int res = 0;
> 
>  	rcu_read_lock();
>  	addr = __acpi_ioremap_fast(paddr, width);
> @@ -284,16 +285,17 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
>  		*val = readq(addr);
>  		break;
>  	default:
> -		return -EINVAL;
> +		res = -EINVAL;
>  	}
>  	rcu_read_unlock();
> 
> -	return 0;
> +	return res;
>  }
> 
>  static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
>  {
>  	void __iomem *addr;
> +	int res = 0;
> 
>  	rcu_read_lock();
>  	addr = __acpi_ioremap_fast(paddr, width);
> @@ -311,11 +313,11 @@ static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
>  		writeq(val, addr);
>  		break;
>  	default:
> -		return -EINVAL;
> +		res = -EINVAL;
>  	}
>  	rcu_read_unlock();
> 
> -	return 0;
> +	return res;
>  }
> 
>  /* GAR accessing in atomic (including NMI) or process context */
> --
> 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-08-01  4:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-31 20:35 [PATCH] drivers/acpi: call rcu_read_unlock in default case Julia Lawall
2010-07-31 20:35 ` Julia Lawall
2010-08-01  4:46 ` Paul E. McKenney [this message]
2010-08-01  4:46   ` Paul E. McKenney

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=20100801044608.GG2470@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@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.