Re: [PATCH] cgroup: use irqsave in cgroup_rstat_flush_locked()

From: Tejun Heo
Date: Wed Jul 11 2018 - 13:28:54 EST


Hello, Sebastian.

On Wed, Jul 11, 2018 at 01:05:13PM +0200, Sebastian Andrzej Siewior wrote:
> > > We at least used to do this in the kernel - manipulating irqsafe locks
> > > with spin_lock/unlock() if the irq state is known, whether enabled or
> > > disabled, and ISTR lockdep being smart enough to track actual irq
> > > state to determine irq safety. Am I misremembering or is this
> > > different on RT kernels?
> >
> > No, this is correct. So on !RT kernels the spin_lock_irq() disables
> > interrupts and the raw_spin_lock() has the interrupts already disabled,
> > everything is good. On RT kernels the spin_lock_irq() does not disable
> > interrupts and the raw_spin_lock() acquires the lock with enabled
> > interrupts and lockdep complains properly.
> > lockdep sees the hardirq path via:

I feel weary about applying a patch which isn't needed in mainline,
especially without annotations or at least comments. I suppose it may
not be too common but this can't be the only place which needs this
and using irqsave/restore spuriously in all those sites doesn't sound
like a good solution. Is there any other way of handling this?

Thanks.

--
tejun