Re: [RFC,PATCH 2/4] Deprecate synchronize_kernel, GPL replacement

From: Paul E. McKenney
Date: Sun Apr 03 2005 - 13:51:55 EST


On Sun, Apr 03, 2005 at 02:26:50PM +0530, Dipankar Sarma wrote:
> On Sat, Apr 02, 2005 at 10:21:50PM -0800, Paul E. McKenney wrote:
> > The synchronize_kernel() primitive is used for quite a few different
> > purposes: waiting for RCU readers, waiting for NMIs, waiting for interrupts,
> > and so on. This makes RCU code harder to read, since synchronize_kernel()
> > might or might not have matching rcu_read_lock()s. This patch creates
> > a new synchronize_rcu() that is to be used for RCU readers and a new
> > synchronize_sched() that is used for the rest. These two new primitives
> > currently have the same implementation, but this is might well change
> > with additional real-time support. Both new primitives are GPL-only,
> > the old primitive is deprecated.
> >
> > Signed-off-by: <paulmck@xxxxxxxxxx>
> > ---
> > Depends on earlier "Add deprecated_for_modules" patch.
> >
> > +/*
> > + * Deprecated, use synchronize_rcu() or synchronize_sched() instead.
> > + */
> > +void synchronize_kernel(void)
> > +{
> > + synchronize_rcu();
> > +}
> > +
>
> We should probably mark it deprecated -
>
> void __deprecated synchronize_kernel(void)
> {
> synchronize_rcu();
> }

Hello, Dipankar,

That was the first thing I tried. ;-)

When I did that, I got a "deprecated" warning from gcc on the
EXPORT_SYMBOL() later in that same file. After futzing around a
bit, I hit on the compromise of marking the rcupdate.h declaration
of synchronize_kernel() as "__deprecated_for_modules".

That said, you are quite right that it would be better if gcc also gave
the "deprecated" warning for use of synchronize_kernel() within in-tree
non-module code. I suppose I could do something like the following
before the #includes in rcupdate.c:

#define SUPPRESS_DEPRECATION_OF_SYNCHRONIZE_KERNEL

and then something like this in rcupdate.h:

#ifdef SUPPRESS_DEPRECATION_OF_SYNCHRONIZE_KERNEL
extern void synchronize_kernel(void);
#else /* #ifdef SUPPRESS_DEPRECATION_OF_SYNCHRONIZE_KERNEL */
extern __deprecated void synchronize_kernel(void);
#endif /* #else #ifdef SUPPRESS_DEPRECATION_OF_SYNCHRONIZE_KERNEL */

but this seemed a bit ugly at the time. Maybe it is worthwhile.

I couldn't find any way to suppress the "deprecated" warning that is
generated by the "&sym" in the last line of the __EXPORT_SYMBOL()
macro. Anyone know a way of doing this? There doesn't seem to me
to be any point to giving the warning on the EXPORT_SYMBOL() -- and
it does clutter up compiler output with useless "deprecated" warnings.

Thanx, Paul
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/