Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Jakub Kicinski <jakub.kicinski@netronome.com>,
	davem@davemloft.net, tgraf@suug.ch, netdev@vger.kernel.org,
	oss-drivers@netronome.com, neilb@suse.com,
	Simon Horman <simon.horman@netronome.com>
Subject: [PATCH 2/2] rhashtable: Fix cmpxchg RCU warnings
Date: Thu, 16 May 2019 15:19:48 +0800	[thread overview]
Message-ID: <E1hRAg8-0004Fy-0O@gondobar> (raw)
In-Reply-To: 20190516051622.b4x6hlkuevof4jzr@gondor.apana.org.au

As cmpxchg is a non-RCU mechanism it will cause sparse warnings
when we use it for RCU.  This patch adds explicit casts to silence
those warnings.  This should probably be moved to RCU itself in
future.
  
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 lib/rhashtable.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 7708699a5b96..935ec80f213f 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -131,7 +131,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht,
 			INIT_RHT_NULLS_HEAD(ntbl[i].bucket);
 	}
 
-	if (cmpxchg(prev, NULL, ntbl) == NULL)
+	if (cmpxchg((union nested_table **)prev, NULL, ntbl) == NULL)
 		return ntbl;
 	/* Raced with another thread. */
 	kfree(ntbl);
@@ -296,7 +296,8 @@ static int rhashtable_rehash_attach(struct rhashtable *ht,
 	 * rcu_assign_pointer().
 	 */
 
-	if (cmpxchg(&old_tbl->future_tbl, NULL, new_tbl) != NULL)
+	if (cmpxchg((struct bucket_table **)&old_tbl->future_tbl, NULL,
+		    new_tbl) != NULL)
 		return -EEXIST;
 
 	return 0;

  parent reply	other threads:[~2019-05-16  7:19 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
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   ` Herbert Xu [this message]
2019-05-16  9:20     ` [PATCH 2/2] rhashtable: Fix cmpxchg RCU warnings 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=E1hRAg8-0004Fy-0O@gondobar \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=neilb@suse.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