Re: [PATCH 1/3] rcu: Use static initializer for krc.lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 16, 2020 at 02:40:02PM -0400, Steven Rostedt wrote:
> On Thu, 16 Apr 2020 18:33:02 +0200
> Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
> 
> > > > > You mean that in CONFIG_PREEMPT_RT:
> > > > > 
> > > > > <snip>
> > > > >  local_irq_save(flags);
> > > > >  krcp = this_cpu_ptr(&krc);
> > > > >  spin_lock(&krcp->lock);
> > > > > <snip>
> > > > > 
> > > > > it will not be preempted, what does not follow PREEMPT_RT policy. Is that correct?  
> > > > 
> > > > No. local_irq_save() disables interrupts and spin_lock() acquires a
> > > > sleeping lock which may schedule() if contended. The documentation has
> > > > this piece:
> > > >  
> > > Ah. Got it. Then it is a problem, agree. Do you have something
> > > that would guarantee of being staying on the same CPU?
> > > migration_disable()?  
> > 
> > migrate_disable() would work.
> 
> I wonder if we should have a this_cpu_spin_lock_irqsave(), that would
> encapsulate the migrate_disable()?
> 
> static inline this_cpu_spin_lock_irqsave(struct spinlock __per_cpu *lock)
> {
> 	migrate_disable();
> 	spin_lock_irqsave(this_cpu_ptr(lock));
> 	migrate_enable();
> }

Here we want to grab the pointer of a per-CPU structure for the local CPU,
and then grab its lock at the same time without getting migrated, so at least
for this code the above API, it may not fit properly but perhaps for other
code it may.

thanks,

 - Joel




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux