From: Darren Hart <dvhltc@us.ibm.com>
To: dino@in.ibm.com
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
linux-rt-users@vger.kernel.org
Subject: Re: [patch -rt] Fix infinite loop with 2.6.31.4-rt14
Date: Fri, 23 Oct 2009 09:21:22 -0700 [thread overview]
Message-ID: <4AE1D802.6050906@us.ibm.com> (raw)
In-Reply-To: <20091023134700.GA5578@in.ibm.com>
Hey Dino,
Dinakar Guniguntala wrote:
>
> Not sure if this the best way to go here, but the patch below seems to resolve
> the problem for me
>
> If this is fine, I'll send a separate patch for mainline. Currently mainline
> seems to be missing the earlier patch referenced above as well
So... something else sets ret to -EAGAIN which should be returned to
userspace, rather than used to retry.
> /**
> - * handle_early_requeue_pi_wakeup() - Detect early wakeup on the initial futex
> - * @hb: the hash_bucket futex_q was original enqueued on
> - * @q: the futex_q woken while waiting to be requeued
> - * @key2: the futex_key of the requeue target futex
> - * @timeout: the timeout associated with the wait (NULL if none)
> - *
> - * Detect if the task was woken on the initial futex as opposed to the requeue
> - * target futex. If so, determine if it was a timeout or a signal that caused
> - * the wakeup and return the appropriate error code to the caller. Must be
> - * called with the hb lock held.
> - *
> - * Returns
> - * 0 - no early wakeup detected
> - * <0 - -ETIMEDOUT or -ERESTARTNOINTR
> - */
> -static inline
> -int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
> - struct futex_q *q, union futex_key *key2,
> - struct hrtimer_sleeper *timeout)
> -{
Cramming this entire function into futex_wait_requeue_pi() doesn't
appear relevant to the problem. Please don't make
futex_wait_requeue_pi() any longer than it already is. My fault that,
but let's not make it worse!
> spin_unlock(&hb->lock);
> + if (ret == -EAGAIN) {
> + /* Retry on spurious wakeup */
> + put_futex_key(fshared, &q.key);
> + put_futex_key(fshared, &key2);
> + goto retry;
> + }
The above is the core of the change yes?
> if (ret)
> goto out_put_keys;
>
> @@ -2264,9 +2247,6 @@ out_put_keys:
> out_key2:
> put_futex_key(fshared, &key2);
>
> - /* Spurious wakeup ? */
> - if (ret == -EAGAIN)
> - goto retry;
I did a little digging trying to see what else might be returning EAGAIN
after the handle_early..() call. I only see fixup_pi_state_owner() and
rt_mutex_finish_proxy_lock(). Neither of those has an obvious return of
EAGAIN. I'll keep looking.
If this turns out to be the proper fix, please reduce it down to simply
check for EAGAIN after handle_early..() and return from there, with a
comment, and avoid moving the logic into this overly large function.
Thanks,
--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
next prev parent reply other threads:[~2009-10-23 16:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 13:47 [patch -rt] Fix infinite loop with 2.6.31.4-rt14 Dinakar Guniguntala
2009-10-23 16:21 ` Darren Hart [this message]
2009-10-23 20:08 ` [patch -rt] Fix infinite loop with 2.6.31.4-rt14 V2 Dinakar Guniguntala
2009-10-23 20:41 ` Darren Hart
2009-10-23 23:29 ` Darren Hart
2009-10-26 19:01 ` Darren Hart
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=4AE1D802.6050906@us.ibm.com \
--to=dvhltc@us.ibm.com \
--cc=dino@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).