[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] cgroup: use irqsave in cgroup_rstat_flush_locked()
(cc'ing Peter and Ingo for lockdep)

Hello, Sebastian.

On Tue, Jul 03, 2018 at 06:45:44PM +0200, Sebastian Andrzej Siewior wrote:
> All callers of cgroup_rstat_flush_locked() acquire cgroup_rstat_lock
> either with spin_lock_irq() or spin_lock_irqsave().

So, irq is always disabled in cgroup_rstat_flush_locked().

> cgroup_rstat_flush_locked() itself acquires cgroup_rstat_cpu_lock which
> is a raw_spin_lock. This lock is also acquired in cgroup_rstat_updated()
> in IRQ context and therefore requires _irqsave() locking suffix in
> cgroup_rstat_flush_locked().

Yes, the cpu locks should be irqsafe too; however, as irq is always
disabled in that function, save/restore is redundant, no?

> Since there is no difference between spin_lock_t and raw_spin_lock_t
> on !RT lockdep does not complain here. On RT lockdep complains because
> the interrupts were not disabled here and a deadlock is possible.

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?



 \ /
  Last update: 2018-07-03 22:25    [W:0.092 / U:4.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site