All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <bitbucket@online.de>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [patch 1/3] ipc/sem: fix -rt livelock
Date: Sun, 15 Sep 2013 05:41:41 +0200	[thread overview]
Message-ID: <1379216501.5545.72.camel@marge.simpson.net> (raw)
In-Reply-To: <52345582.7020000@colorfullife.com>

On Sat, 2013-09-14 at 14:24 +0200, Manfred Spraul wrote: 
> Hi Mike,

Hi,

> > Index: linux-2.6/ipc/sem.c
> > ===================================================================
> > --- linux-2.6.orig/ipc/sem.c
> > +++ linux-2.6/ipc/sem.c
> > @@ -247,11 +256,22 @@ static inline int sem_lock(struct sem_ar
> >   		 */
> >    lock_array:
> >   		spin_lock(&sma->sem_perm.lock);
> > + wait_array:
> >   		for (i = 0; i < sma->sem_nsems; i++) {
> > -			struct sem *sem = sma->sem_base + i;
> > +			sem = sma->sem_base + i;
> > +#ifdef CONFIG_PREEMPT_RT_BASE
> > +			if (spin_is_locked(&sem->lock))
> > +#endif
> >   			spin_unlock_wait(&sem->lock);
> >   		}
> >   
> I don't like this part of the change:

None of it is pretty, but the livelock is even less pretty ;-)

> It reads like a micro-optimization for spin_unlock_wait() within the 
> ipc/sem.c code.

It's exactly that, hope to hammer fewer locks.

> If spin_unlock_wait() for CONFIG_PREEMPT_RT_BASE is broken, then the 
> implementation of spin_unlock_wait() should be fixed.

But it's not broken, taking the lock lets PI see/fix inversion.

Preemptible locks are (necessary) evil incarnate.

-Mike


  reply	other threads:[~2013-09-15  3:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1379051751.5455.112.camel@marge.simpson.net>
2013-09-13  6:12 ` [patch 1/3] ipc/sem: fix -rt livelock Mike Galbraith
2013-09-14 12:24   ` Manfred Spraul
2013-09-15  3:41     ` Mike Galbraith [this message]
2013-09-14 21:46   ` Manfred Spraul
2013-09-15  4:45     ` Mike Galbraith
2013-10-04 10:44       ` Sebastian Andrzej Siewior
2013-10-04 11:16         ` Mike Galbraith
2013-10-04 11:28           ` Sebastian Andrzej Siewior
2013-10-04 13:55             ` Mike Galbraith
2013-10-04 14:02               ` Manfred Spraul
2013-10-04 14:08                 ` Mike Galbraith
2013-10-11 15:36                   ` Sebastian Andrzej Siewior
2013-10-12  4:34                     ` Mike Galbraith
2013-09-13  6:12 ` [patch 2/3] ipc/sem: revert ipc/sem: Rework semaphore wakeups Mike Galbraith
2013-09-13  6:12 ` [patch 3/3] ipc/sem: Add -RT compatible wakeup scheme Mike Galbraith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379216501.5545.72.camel@marge.simpson.net \
    --to=bitbucket@online.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=bigeasy@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.