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 23:46:53 +0200 [thread overview]
Message-ID: <5234D94D.8010608@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.
I think your code inherits the race I just sent to you:
The test of complex_count must be after spin_is_locked().
http://marc.info/?l=linux-kernel&m=137919453307294
Could you check that?
Or alternatively: Is my proposed sem_lock() function -rt friendly?
> locknum = -1;
> +
> + if (nsops == 1 && !sma->complex_count) {
> + sem = sma->sem_base + sops->sem_num;
> + spin_lock(&sem->lock);
> + spin_unlock(&sma->sem_perm.lock);
> + locknum = sops->sem_num;
> + }
A clever idea:
If the decision that the slow path must be used proves to be a false
alarm, switch back to the fast path.
You can even move that block further up and skip the loop over all
per-semaphore arrays.
--
Manfred
next prev parent reply other threads:[~2013-09-14 21:47 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
2013-09-14 21:46 ` Manfred Spraul [this message]
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=5234D94D.8010608@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.