Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5790004ybl; Tue, 10 Dec 2019 11:31:00 -0800 (PST) X-Google-Smtp-Source: APXvYqw4Ysx/Za+pjRTZy5mLYxRWfjYRGNITXnOqNFac3j3JFAGs4AiIgPRdNQlHBZPoN1SwSLk6 X-Received: by 2002:a9d:4543:: with SMTP id p3mr27607193oti.350.1576006260083; Tue, 10 Dec 2019 11:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576006260; cv=none; d=google.com; s=arc-20160816; b=UGVM7FrDv85eVOMg2hRQBML7yNEb57nnT706zFzOGbz0dX12AbQ/74QQ4KLwQ+6fjx 1cJ2I6Rj5eE625xI9QPNuyfk34dsgPyAw0m0DMBbD0WMMh/QFxCq9E29Cn9X7cMWvbjI 2EGf2yyocCKoU1uDokGmrvGCGly1+8JzBXzjA51Zv8gMSv+e8t8/u1IgLhGKyTT19mTJ obfxMNKHP1jqaV8bkWpWXnjP1dPtys1HKpfxOnS3ssckryxDWkgjXibvQpxzH3PvKIwr ipT6dgKpNHyTf9sE0oiqE2sl8ByT/htP6HRXTQD2OrA8Gc4rCkbIuNHLfPTneHIObLJk rfRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Tw2JPIMYDsfgukvM8WXHM1nu5JQP5vubIup8mX2xa3Y=; b=UZ5Oo2VCLgMbqhQDspxPUWCkqyB36017ZQUas9lMdqdvV+0T+3zmQf6KoHsvW45XS7 b0LeHgKqZbEo7IkRBn4+T5T9beOz6fLHKC9yrwpJE9+xY0nRPFpMcayoMDGUsPJKkRZY jsUj7gyA5O6ZJXNwFs0WahRhTv8vGC5m0umCKFsbMkJi29bvAlhEfItKTuE0qpvPyHVj /EMdBa0LVFLzK/mGNB1KulBg0W8FZUcfH19n4UC3k2tMRUK1juZ9fIH+iE6zJz+aRTRl mzSZUz/AHlAOBxWK3nHXbrD/9Lg2KLo6BU1A07wEJl0K5uv4lY687O/vomhShj4NLtOx 1rmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=OHQtieOK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si2261959otk.154.2019.12.10.11.30.46; Tue, 10 Dec 2019 11:31:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=OHQtieOK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbfLJTaS (ORCPT + 99 others); Tue, 10 Dec 2019 14:30:18 -0500 Received: from merlin.infradead.org ([205.233.59.134]:45134 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbfLJTaR (ORCPT ); Tue, 10 Dec 2019 14:30:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Tw2JPIMYDsfgukvM8WXHM1nu5JQP5vubIup8mX2xa3Y=; b=OHQtieOKJ3KsSxH0XLa2EtTsh XAnLaFDGOgNiQCq63QIcZzsCqoyHH0w0ataQ3lJhpbatDvRxXkLrFwL/6ycEWDG1V5dUNk1p+rbBx RsHnzwKVc/XXESf1jD+CW2exZ3u5t3U5A/mxjfmN+ZM/GMa8zYBIN1oLTXlW+pHEY2ykRHxACV1G+ bfpGOMKesC5bHP/dr8uU4QVWUPHfvlSja7190Ge7YmC/iJJNGu3mM7KMSLwIe4Ezpz8mU8kvPgaFf X/YQHWctWfaPlrTclyGn4vRJTXPbKpNacgsXe7mGLBIn5pyzi368hMnchEhtTcf+Qq4DZZFKsuE3e Ud3Unr15g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ielD3-0002k5-Kt; Tue, 10 Dec 2019 19:30:14 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id CC80F980D21; Tue, 10 Dec 2019 20:30:11 +0100 (CET) Date: Tue, 10 Dec 2019 20:30:11 +0100 From: Peter Zijlstra To: David Howells Cc: linux-afs@lists.infradead.org, Ingo Molnar , Will Deacon , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Davidlohr Bueso Subject: Re: [PATCH] rxrpc: Mutexes are unusable from softirq context, so use rwsem instead Message-ID: <20191210193011.GA11802@worktop.programming.kicks-ass.net> References: <157599917879.6327.69195741890962065.stgit@warthog.procyon.org.uk> <20191210191009.GA11457@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191210191009.GA11457@worktop.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 08:10:09PM +0100, Peter Zijlstra wrote: > On Tue, Dec 10, 2019 at 05:32:58PM +0000, David Howells wrote: > > rxrpc_call::user_mutex is of type struct mutex, but it's required to start > > off locked on an incoming call as it is being set up in softirq context to > > prevent sendmsg and recvmsg interfering with it until it is ready. It is > > then unlocked in rxrpc_input_packet() to make the call live. > > > > Unfortunately, commit a0855d24fc22d49cdc25664fb224caee16998683 > > ("locking/mutex: Complain upon mutex API misuse in IRQ contexts") causes > > big warnings to be splashed in dmesg for each a new call that comes in from > > the server. > > > > It *seems* like it should be okay, since the accept path trylocks the mutex > > when no one else can see it and drops the mutex before it leaves softirq > > context. > > > > Fix this by switching to using an rw_semaphore instead as that is permitted > > to be used in softirq context. > > This really has the very same problem. It just avoids the WARN. We do PI > boosting for rwsem write side identical to what we do for mutexes. > > I would rather we revert David's patch for now and more carefully > consider what to do about this. To clarify (I only just reliazed David is a bit ambiguous here), take this patch out for now: a0855d24fc22 ("locking/mutex: Complain upon mutex API misuse in IRQ contexts") The RXRPC code has been there for a while... and like I wrote, both mutex and rwsem have the exact same issue, the rwsem code just doesn't have a WARN on it.