Netdev List
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Herbert Xu' <herbert@gondor.apana.org.au>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"tgraf@suug.ch" <tgraf@suug.ch>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"oss-drivers@netronome.com" <oss-drivers@netronome.com>,
	"neilb@suse.com" <neilb@suse.com>,
	Simon Horman <simon.horman@netronome.com>
Subject: RE: [PATCH 2/2] rhashtable: Fix cmpxchg RCU warnings
Date: Thu, 16 May 2019 09:20:36 +0000	[thread overview]
Message-ID: <e79357ea8fde45b281be9a8196b806f8@AcuMS.aculab.com> (raw)
In-Reply-To: <E1hRAg8-0004Fy-0O@gondobar>

From: Herbert Xu
> Sent: 16 May 2019 08:20
> 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.
> 
...
> -	if (cmpxchg(prev, NULL, ntbl) == NULL)
> +	if (cmpxchg((union nested_table **)prev, NULL, ntbl) == NULL)

I presume these casts remove an 'rcu' marker on the variable.
Is there a way of marking such casts as 'for sparse only' so
that the compiler does proper type checking.
(Clearly this isn't that relevant here as the cast could be (void **).)

Hmmm something should be checking that the type of the argument
to cmpxchg is 'pointer to "something the size of a pointer"'
Adding any kind of cast subverts that test.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2019-05-16  9:20 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   ` [PATCH 2/2] rhashtable: Fix cmpxchg RCU warnings Herbert Xu
2019-05-16  9:20     ` David Laight [this message]
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=e79357ea8fde45b281be9a8196b806f8@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --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