Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 3/4] cr_tests: futex: pu: Fix potential livelock
Date: Wed, 14 Apr 2010 09:58:40 -0500	[thread overview]
Message-ID: <20100414145840.GA11741@us.ibm.com> (raw)
In-Reply-To: <4b62b2004556809368f788e9baaf39c529dc3d80.1271197507.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> Fixup flow of release_pi_futex to truly break out of the loop during
> an error.
> 
> Also, since it's not used, remove the retries parameter from
> do_unlock_contended_futex.
> 
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  futex/pi.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/futex/pi.c b/futex/pi.c
> index 53d4c5d..a39964d 100644
> --- a/futex/pi.c
> +++ b/futex/pi.c
> @@ -330,7 +330,7 @@ again:
>  	return -1;
>  }
> 
> -int do_unlock_contended_pi_futex(int retries)
> +int do_unlock_contended_pi_futex(void)
>  {
>  	if (futex(&pi_futex->counter, FUTEX_UNLOCK_PI, 1, NULL, NULL, 0) == 0)
>  		return 0;
> @@ -400,12 +400,12 @@ void release_pi_futex(int *retries, int *retval, pid_t tid)
>  		/* Release the futex */
>  		pi_val = atomic_cmpxchg(pi_futex, tid, 0);
>  		if (pi_val != tid) {
> -		    switch (do_unlock_contended_pi_futex(*retries)) {
> +		    switch (do_unlock_contended_pi_futex(void)) {

Just fyi, my compiler didn't like this.  Replacing it with
		    switch (do_unlock_contended_pi_futex()) {

It also doesn't change the failure of robust testcase on my s390 box:

linuz11:~/cr_tests/futex # sh run.sh 
Using output dir ./cr_futex_PR5nlHC
WARNING: Priority inheritance test must be able to set at least two realtime priorities. ulimit -r indicates otherwise so skipping pi futex test(s).
Running test: plain
Test plain done, returned 0
PASS
Restart of test plain done, returned 0
PASS
Running test: robust
run.sh: line 49: kill: (3900) - No such process
run.sh: line 49: kill: (3900) - No such process

Changing the line waiting for the original testcase to
exit from
	wait ${TEST_PID}
to
        wait ${TEST_PID} || true

lets that continue and pass.

(further changing it to
	wait ${TEST_PID} || echo "wait returned $?" && true
gives me
	wait returned 1
while checking process listings before and after the wait
shows that robust is running for a few seconds, and does
die before wait returns, so I assume robust.c is in fact
exiting with error code)

Meanwhile, after ulimit -r 2 pi testcase still just hogs my
cpus :)

-serge

  parent reply	other threads:[~2010-04-14 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 22:25 [PATCH 1/4] cr_tests: futex: pi: Adjust RT priority range Matt Helsley
     [not found] ` <2925834e94ea965d668717d0c993b6bc02697799.1271197507.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-13 22:25   ` [PATCH 2/4] cr_tests: futex: pi: Factor out release_pi_futex() Matt Helsley
2010-04-13 22:25   ` [PATCH 3/4] cr_tests: futex: pu: Fix potential livelock Matt Helsley
     [not found]     ` <4b62b2004556809368f788e9baaf39c529dc3d80.1271197507.git.matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-14 14:58       ` Serge E. Hallyn [this message]
2010-04-13 22:25   ` [PATCH 4/4] cr_tests: futex: pi: Set the FUTEX_WAITERS bit Matt Helsley

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=20100414145840.GA11741@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox