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)