From: Peter Zijlstra <peterz@infradead.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: tglx@linutronix.de, mingo@redhat.com, dvhart@infradead.org,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 1/2] futex: Fix irq mismatch in exit_pi_state_list()
Date: Mon, 15 Mar 2021 14:12:19 +0100 [thread overview]
Message-ID: <YE9dM6PB9ZpC8AfY@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210315050224.107056-2-dave@stgolabs.net>
On Sun, Mar 14, 2021 at 10:02:23PM -0700, Davidlohr Bueso wrote:
> The pi_mutex->wait_lock is irq safe and needs to enable local
> interrupts upon unlocking, matching it's corresponding
> raw_spin_lock_irq().
>
> Fixes: c74aef2d06a9f (futex: Fix pi_state->owner serialization)
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
> kernel/futex.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 475055715371..ded7af2ba87f 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -885,7 +885,7 @@ static void exit_pi_state_list(struct task_struct *curr)
> */
> if (head->next != next) {
> /* retain curr->pi_lock for the loop invariant */
> - raw_spin_unlock(&pi_state->pi_mutex.wait_lock);
> + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
> spin_unlock(&hb->lock);
> put_pi_state(pi_state);
> continue;
This seems broken, afaict we own:
&hb->lock
&pi_state->pi_mutex.wait_lock
&curr->pi_lock
And we're only releasing:
&hb->lock
&pi_state->pi_mutex.wait_lock
Which leaves us holding:
&curr->pi_lock
which is also an IRQ safe lock, so enabling IRQs would be BAD.
Or am I reading this wrong?
next prev parent reply other threads:[~2021-03-15 13:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 5:02 [PATCH -tip 0/2] futex: Two pi fixes Davidlohr Bueso
2021-03-15 5:02 ` [PATCH 1/2] futex: Fix irq mismatch in exit_pi_state_list() Davidlohr Bueso
2021-03-15 13:12 ` Peter Zijlstra [this message]
2021-03-15 19:03 ` Davidlohr Bueso
2021-03-15 5:02 ` [PATCH 2/2] futex: Leave the pi lock stealer in a consistent state upon successful fault Davidlohr Bueso
2021-03-16 11:20 ` Peter Zijlstra
2021-03-16 18:03 ` Davidlohr Bueso
2021-03-16 19:48 ` Thomas Gleixner
2021-03-16 20:12 ` Peter Zijlstra
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=YE9dM6PB9ZpC8AfY@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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.