Netdev List
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>, davem@davemloft.net
Cc: herbert@gondor.apana.org.au, tgraf@suug.ch,
	netdev@vger.kernel.org, oss-drivers@netronome.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Simon Horman <simon.horman@netronome.com>
Subject: Re: [PATCH net] rhashtable: fix sparse RCU warnings on bit lock in bucket pointer
Date: Thu, 16 May 2019 07:42:29 +1000	[thread overview]
Message-ID: <87sgtfwg1m.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20190515205501.17810-1-jakub.kicinski@netronome.com>

[-- Attachment #1: Type: text/plain, Size: 2227 bytes --]

On Wed, May 15 2019, Jakub Kicinski wrote:

> Since the bit_spin_lock() operations don't actually dereference
> the pointer, it's fine to forcefully drop the RCU annotation.
> This fixes 7 sparse warnings per include site.
>
> Fixes: 8f0db018006a ("rhashtable: use bit_spin_locks to protect hash bucket.")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>

Hi, sorry for not responding to your initial post, but I'm otherwise
engaged this week and cannot give it any real time.  I don't object to
this patch, but I'll try to have a proper look next week, if only to
find out how I didn't get the warnings, as I was testing with sparse.

Thanks,
NeilBrown


> ---
>  include/linux/rhashtable.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
> index f7714d3b46bd..bea1e0440ab4 100644
> --- a/include/linux/rhashtable.h
> +++ b/include/linux/rhashtable.h
> @@ -325,27 +325,27 @@ static inline struct rhash_lock_head __rcu **rht_bucket_insert(
>   */
>  
>  static inline void rht_lock(struct bucket_table *tbl,
> -			    struct rhash_lock_head **bkt)
> +			    struct rhash_lock_head __rcu **bkt)
>  {
>  	local_bh_disable();
> -	bit_spin_lock(0, (unsigned long *)bkt);
> +	bit_spin_lock(0, (unsigned long __force *)bkt);
>  	lock_map_acquire(&tbl->dep_map);
>  }
>  
>  static inline void rht_lock_nested(struct bucket_table *tbl,
> -				   struct rhash_lock_head **bucket,
> +				   struct rhash_lock_head __rcu **bkt,
>  				   unsigned int subclass)
>  {
>  	local_bh_disable();
> -	bit_spin_lock(0, (unsigned long *)bucket);
> +	bit_spin_lock(0, (unsigned long __force *)bkt);
>  	lock_acquire_exclusive(&tbl->dep_map, subclass, 0, NULL, _THIS_IP_);
>  }
>  
>  static inline void rht_unlock(struct bucket_table *tbl,
> -			      struct rhash_lock_head **bkt)
> +			      struct rhash_lock_head __rcu **bkt)
>  {
>  	lock_map_release(&tbl->dep_map);
> -	bit_spin_unlock(0, (unsigned long *)bkt);
> +	bit_spin_unlock(0, (unsigned long __force *)bkt);
>  	local_bh_enable();
>  }
>  
> -- 
> 2.21.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2019-05-15 21:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 20:55 [PATCH net] rhashtable: fix sparse RCU warnings on bit lock in bucket pointer Jakub Kicinski
2019-05-15 21:42 ` NeilBrown [this message]
2019-05-15 22:04   ` Jakub Kicinski
2019-05-16  5:16 ` Herbert Xu
2019-05-16  7:18   ` [PATCH 0/2] rhashtable: Fix sparse warnings Herbert Xu
2019-05-16 16:45     ` David Miller
2019-05-16  7:19   ` [PATCH 1/2] rhashtable: Remove RCU marking from rhash_lock_head Herbert Xu
2019-05-16  7:19   ` [PATCH 2/2] rhashtable: Fix cmpxchg RCU warnings Herbert Xu
2019-05-16  9:20     ` David Laight
2019-05-16 12:42       ` Herbert Xu
2019-05-16 15:19   ` [PATCH net] rhashtable: fix sparse RCU warnings on bit lock in bucket pointer Jakub Kicinski

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=87sgtfwg1m.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=simon.horman@netronome.com \
    --cc=tgraf@suug.ch \
    /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