On Wed, Aug 26, 2026 at 04:03:14PM +0200, Ricardo Ribalda wrote:
> Hi David, Dan and Paul
> 
> On Wed, 26 Aug 2026 at 15:22, David Laight <[email protected]> 
> wrote:
> >
> > On Wed, 26 Aug 2026 13:28:42 +0200
> > Ricardo Ribalda <[email protected]> wrote:
> >
> > > Hi David
> > >
> > > On Wed, 26 Aug 2026 at 11:55, David Laight <[email protected]> 
> > > wrote:
> > > >
> > > > On Tue, 25 Aug 2026 20:02:10 +0000
> > > > Ricardo Ribalda <[email protected]> wrote:
> > > > >
> > > > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > > > > index 44c07a66edff..80276cedda80 100644
> > > > > --- a/include/linux/rcupdate.h
> > > > > +++ b/include/linux/rcupdate.h
> > > > > @@ -488,7 +488,7 @@ static __always_inline bool 
> > > > > lockdep_assert_rcu_helper(bool c, const struct __ctx
> > > > >  context_unsafe(                                                      
> > > > >         \
> > > > >       typeof(*p) *local = (typeof(*p) *__force)(p);                   
> > > > > \
> > > > >       rcu_check_sparse(p, __rcu);                                     
> > > > > \
> > > > > -     ((typeof(*p) __force __kernel *)(local))                        
> > > > > \
> > > > > +     ((TYPEOF_UNQUAL(*p) __force __kernel *)(local))                 
> > > > > \
> > > >
> > > > Ugg... TYPEOF_UNQUAL() is absolutely horrid...
> > > > When __CHECKER__ is undefined the whole thing is just (p).
> > >
> > > About using __CHECKER__: Are you suggesting using #ifdef __CHECKER__
> > > to use TYPEOF_UNQUAL or the current code?
> > >
> > > I am open to doing that, but I would like to hear from Paul if he
> > > favors adding the (also horrid) #ifdef to save some CPU cycles on
> > > older compilers.
> > >
> > > >
> > > > I suspect reducing all the definitions would measurably improve
> > > > kernel compile time (even before these changes).
> > >
> > > When I checked earlier in the other patch in this patchset, with my
> > > compiler I can hardly see any difference in compilation times [1].
> > > This is probably because GCC15 direclty maps TYPEOF_UNQUAL to the
> > > built-in __typeof_unqual__.
> >
> > I was thinking of the _Generic() version.
> >
> > But here you only want to remove the (I think) __user marker.
> > I don't think you want to get rid of 'const'.
> > So you don't really want gcc to remove any qualifiers.
> 
> Yeah, I see your point, removing `const` might hide other issues.
> 
> Dan, what would be the best "sparse-approved" way of removing the
> address space qualifiers (__user __rcu)  but keeping the other ones
> (const) ?
> 
> Paul, would you accept an #ifdef __CHECKER__  block to keep Sparse
> happy without affecting GCC type checking?

Potentially...

For example, if this be done so that there is just one such #ifdef
__CHECKER__  block that defines empty/non-empty macros that are used by
the various conversion macros.

In contrast, providing a full separate definition of each macro that
uses __rcu?  That would be quite unfriendly to future readers of the code,
so please, no.

                                                        Thanx, Paul

> Thanks!
> 
> >
> > There is an similar(ish) issue when an __force cast is used to
> > remove one of the extra qualifiers.
> > You really want the compiler to ignore the cast - so it checks
> > the actual types match.
> >
> > David
> >
> > >
> > >
> > > Thanks!
> > >
> > >
> > > [1] 
> > > https://lore.kernel.org/all/canidscsmrulsrgqg76x28grxlg+hskfwhha14zcn8hdm4ky...@mail.gmail.com/
> > >
> > > >
> > > > David
> >
> 
> 
> -- 
> Ricardo Ribalda

Reply via email to