From: Manfred Spraul <manfred@colorfullife.com>
To: Mike Galbraith <bitbucket@online.de>
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: Sat, 14 Sep 2013 14:24:34 +0200 [thread overview]
Message-ID: <52345582.7020000@colorfullife.com> (raw)
In-Reply-To: <1379052760.5455.127.camel@marge.simpson.net>
Hi Mike,
On 09/13/2013 08:12 AM, Mike Galbraith wrote:
> goto again loop can and does induce livelock in -rt. Remove it.
>
> spin_unlock_wait(lock) in -rt kernels takes/releases the lock in question, so
> all it takes to create a self perpetuating loop is for one task to start the
> ball rolling by taking the array lock, other tasks see this, and react by
> take/release/retry endlessly.
>
> Signed-off-by: Mike Galbraith <bitbucket@online.de>
>
> ---
> ipc/sem.c | 56 ++++++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 38 insertions(+), 18 deletions(-)
>
> 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:
It reads like a micro-optimization for spin_unlock_wait() within the
ipc/sem.c code.
If spin_unlock_wait() for CONFIG_PREEMPT_RT_BASE is broken, then the
implementation of spin_unlock_wait() should be fixed.
Something like
#define spin_unlock_wait(x) if(spin_is_locked(x)) __spin_unlock_wait(x)
--
Manfred
next prev parent reply other threads:[~2013-09-14 12:24 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 [this message]
2013-09-15 3:41 ` Mike Galbraith
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=52345582.7020000@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=a.p.zijlstra@chello.nl \
--cc=bigeasy@linutronix.de \
--cc=bitbucket@online.de \
--cc=linux-rt-users@vger.kernel.org \
--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.