Re: PREEMPT/PREEMPT_RT question

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

 



On Tue, Jul 12, 2005 at 07:47:15PM -0400, Steven Rostedt wrote:
> On Tue, 2005-07-12 at 14:34 -0700, Paul E. McKenney wrote:
> > > Yeah, mips has the crazy Load Linked and Store Conditional crap, so it
> > > is a little more complex than the simple add one.  And I think PPC does
> > > too, although it has been a while since I've used them.  And older mips
> > > don't have the LL SC command so the only option is to turn off
> > > interrupts (of course those that don't have the LL and SC are not SMP
> > > compatible).  So, I will admit that having a smp_atomic_inc might be
> > > nice. I was just being a narrow minded x86 hacker ;-)
> > 
> > I am sure that LL/SC seemed like a good idea at the time.  ;-)
> > 
> > To be fair, LL/SC does allow allow some things to be done more easily
> > than with cmpxchg, since it allows you to tell that the value changed
> > even if it later changed back.  Helps with some linked-list operations.
> 
> I was being a little harsh in my statements.  I didn't really mind the
> LL and SC but a true atomic inc would have been nice.  I actually had to
> port Linux to a MIPS board once that didn't have the LL or SC, and that
> was even more painful.

I could believe that!

> > > > > Yep interrupts are threads in CONFIG_PREEMPT_RT.  I guess you could also
> > > > > just use local_irq_save with spin_lock, since now local_irq_save no
> > > > > longer disables interrupts in PREEMPT_RT.
> > > > 
> > > > By this you mean the following?
> > > > 
> > > > 	local_irq_save(flags);
> > > > 	_raw_spin_lock(&mylock);
> > > > 
> > > > 	/* critical section */
> > > > 
> > > > 	_raw_spin_unlock(&mylock);
> > > > 	local_irq_restore(flags);
> > > 
> > > Yeah, that on PREEMP_RT would not turn off interrupts but just stops
> > > preemption. This is fine as long as the mylock is not used in any
> > > SA_NODELAY interrupt.
> > 
> > Cool!  Is the scheduling-clock interrupt an SA_NODELAY interrupt?
> 
> If you are talking about scheduler_tick, then yes, it is called by the
> timer interrupt which is a SA_NODELAY interrupt.  If you don't want to
> get interrupted by the timer interrupt, then you will need to disable
> interrupts for both. Since currently, the timer interrupt is the only
> true hard interrupt in the PREEMPT_RT and that may not change.

OK, so if I take a spinlock in something invoked from scheduler_tick(),
then any other acquisitions of that spinlock must disable hardware
interrupts, right?

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux