Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3284364pxf; Mon, 15 Mar 2021 06:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzntsFnTiZZeu8sA6rePAs9HjeuUurecGq/a9Ip7X3q/qHruHYJUCHHIR4UXw3A3rrrXF3N X-Received: by 2002:a17:906:2ac1:: with SMTP id m1mr13561779eje.472.1615814176448; Mon, 15 Mar 2021 06:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615814176; cv=none; d=google.com; s=arc-20160816; b=t9KT7jfcskG7wbITFC16rM64ujEMlDwOGQ0rZ2psdJPTCjxtHbSjXEOu3pG6PdoJ/P Q8HlHOA4i/Bhukgx4fKCNtEp9mF5QQdVFmlerVWaXXQ44CBlZ43xm83897zmgs44o0/v OTao/byFLSqStSj4x+prIj0c9S1MeNCfWtSCFyhL53RjtnlomMpqfgJnJaxqeq7ng7EO pao4I/JSfnyN2KP6glFwalik73i43U4CJylUusA9dO7TgjEXhW815m8qm90EtV4GSFaq xN56fI/WB9wxiWRLatRvBHeU/Bko4XxqiGlLJ3HvThOTy8xei2bxyg70P3Dm3tmaDUuG 2NxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KQZxGT3iZM0XuWdH8rSDyKf5uYuruMkEoTeToypALMc=; b=CwguXOrXXSTyyf5HTFhTLqe1aHtDitBrnugesxpoT/BPrCsBxynv/KVM+R/a3bXRYR ldiAN2ppy5gIgNR9vuDMMhz+H1aorExspgPdRYXVldDbvsVSZv6Os6Qf6iK1tG4Y4352 fdi2wxvxNh5iWKr6uvG0+C8MbbrwMvhc3CzM8jStZaLoCmIYwLy8EyLIvyBkvXlGbJUi Gk+4NZxLi4x6PTG1aiZn7ipAD8jsAcldYOschnsQgeFItVSmD7IS168hkWalnqt5Cqn7 GWFV8YiYGPH6liiTE0z7y4L5C2k1eR8RoidXr66zPdSe7A7dcCZfGA8wCIP9y8KYrnRb OiKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=pDMzXvxY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga16si11217751ejb.361.2021.03.15.06.15.50; Mon, 15 Mar 2021 06:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=pDMzXvxY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbhCONOw (ORCPT + 99 others); Mon, 15 Mar 2021 09:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbhCONOb (ORCPT ); Mon, 15 Mar 2021 09:14:31 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD9BAC06174A for ; Mon, 15 Mar 2021 06:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KQZxGT3iZM0XuWdH8rSDyKf5uYuruMkEoTeToypALMc=; b=pDMzXvxYeMIiBzwuJdtRPz4Q1o +pbsYhAYi+TPyv5XAYYDDtvGu8pOzR/L7480DE1rCPz77xdaK3yDn8mjZ2vHXpSUIDIy2YhFPGjAs X8mLYfPwg1D+c8bcIS4M7Thz2twe/3klF0XM4O+PU41e+p1NqSxi6MpeEhFUFYgXV6CQKvUNMhrGq LFL2aGGfSaj/T546RMqV1Jd2+bereUervDdJoyiFGKTAzT/0hH4JXnhDxunojw+nriIcBGaf++Iga vBTU5oFGVeM5dqB+s+ksmzgj2gtyGkfH9IZjlIWXT24wZexHp9xtdTej5/M87rLfEFx0q62ySA6u6 jZtM2KcA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lLn1B-00FvtE-BK; Mon, 15 Mar 2021 13:14:21 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F36713003D8; Mon, 15 Mar 2021 14:12:19 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E52C623CC228E; Mon, 15 Mar 2021 14:12:19 +0100 (CET) Date: Mon, 15 Mar 2021 14:12:19 +0100 From: Peter Zijlstra To: Davidlohr Bueso Cc: tglx@linutronix.de, mingo@redhat.com, dvhart@infradead.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 1/2] futex: Fix irq mismatch in exit_pi_state_list() Message-ID: References: <20210315050224.107056-1-dave@stgolabs.net> <20210315050224.107056-2-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210315050224.107056-2-dave@stgolabs.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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?