linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: madhuparnabhowmik04@gmail.com
Cc: paulmck@kernel.org, linux-kernel@vger.kernel.org,
	rcu@vger.kernel.org, stefanr@s5r6.in-berlin.de,
	linux1394-devel@lists.sourceforge.net,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] drivers: firewire: core-transaction: Pass lockdep condition to address_handler_list iterator
Date: Sat, 4 Jan 2020 16:21:31 -0500	[thread overview]
Message-ID: <20200104212131.GN189259@google.com> (raw)
In-Reply-To: <20200104144215.27590-1-madhuparnabhowmik04@gmail.com>

On Sat, Jan 04, 2020 at 08:12:15PM +0530, madhuparnabhowmik04@gmail.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> 
> The address_handler_list is traversed with list_for_each_entry_rcu
> with address_handler_list_lock held.
> list_for_each_entry_rcu has built-in RCU and lock checking.
> Use it for address_handler_list traversal.
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel

> ---
>  drivers/firewire/core-transaction.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
> index 404a035f104d..a15e70027932 100644
> --- a/drivers/firewire/core-transaction.c
> +++ b/drivers/firewire/core-transaction.c
> @@ -61,6 +61,11 @@
>  #define PHY_CONFIG_ROOT_ID(node_id)	((((node_id) & 0x3f) << 24) | (1 << 23))
>  #define PHY_IDENTIFIER(id)		((id) << 30)
>  
> +static DEFINE_SPINLOCK(address_handler_list_lock);
> +static LIST_HEAD(address_handler_list);
> +
> +#define address_handler_list_lock_held() lock_is_held(&(address_handler_list_lock).dep_map)
> +
>  /* returns 0 if the split timeout handler is already running */
>  static int try_cancel_split_timeout(struct fw_transaction *t)
>  {
> @@ -485,7 +490,7 @@ static struct fw_address_handler *lookup_overlapping_address_handler(
>  {
>  	struct fw_address_handler *handler;
>  
> -	list_for_each_entry_rcu(handler, list, link) {
> +	list_for_each_entry_rcu(handler, list, link, address_handler_list_lock_held()) {
>  		if (handler->offset < offset + length &&
>  		    offset < handler->offset + handler->length)
>  			return handler;
> @@ -514,8 +519,6 @@ static struct fw_address_handler *lookup_enclosing_address_handler(
>  	return NULL;
>  }
>  
> -static DEFINE_SPINLOCK(address_handler_list_lock);
> -static LIST_HEAD(address_handler_list);
>  
>  const struct fw_address_region fw_high_memory_region =
>  	{ .start = FW_MAX_PHYSICAL_RANGE, .end = 0xffffe0000000ULL, };
> -- 
> 2.17.1
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2020-01-04 21:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 14:42 [Linux-kernel-mentees] [PATCH] drivers: firewire: core-transaction: Pass lockdep condition to address_handler_list iterator madhuparnabhowmik04
2020-01-04 21:21 ` Joel Fernandes [this message]

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=20200104212131.GN189259@google.com \
    --to=joel@joelfernandes.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=madhuparnabhowmik04@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.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).