Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1157565rwd; Thu, 25 May 2023 08:44:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6o1Iapxxl46+mGgdkZPtoB8hkP1OfH/Ic1AzMY9j5u9oaLqdSgBQVbc6mhqU9xMcG73+8g X-Received: by 2002:a05:6a21:9999:b0:10a:c09c:bd with SMTP id ve25-20020a056a21999900b0010ac09c00bdmr21761005pzb.55.1685029440676; Thu, 25 May 2023 08:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685029440; cv=none; d=google.com; s=arc-20160816; b=a1OIQFJtEJApas3yAB8F2hvlbWfmnQaAsnvQN/tXcQmD0O7x9x17wMDjdRDZfpGV9y baBlZQwFbz5QR2ME+Tm/4bN3v0miJzyz5ouimXNny6PqrCRQM2vWOmMJlDtU8gp9RMCR PiRF8TzGbHzgg3BmyfCByMLEbhlwWiQym7wPb2GVGvYKA+j92EO20jxxwoC+6t/U+2Ta IzekoLxvhRED4eAoiwIiJvDZjB1WyDhQEiTv95hZdfRR7Fpv+YOWT5tOx6U0rbTuTF8c znOH3miv9i18TdCNqpRFgCzReGuJzHCMa7EGSjemAzE8Q/uu37BmsDMgSOpkQKmp7etr W8cg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=8IcW9rC36xzwMdbICTITL2z/ciN/8f8kQF9VFbHEV/M=; b=xSgfHZoxc9jxU9k2WfmatsctjWgByuQlm7IVU2Q30NECfkVTHIuoliNo0+x/qz9U+J uxjAcILKBJOj+u8iCIllXwHWf/Dva/yokvJdzzrqvargsZRrzZIshVAG8INpHpLyepzE FvoKjY4zPrewczi+p0Ux+lzbDLtB+jweTVH8Y1tuQ/QC+3ykaoVxdH8oQDvyEag8QyLf X5APL5Kk+/B6f5SvdXrh9NuIQWjviYef7qjQsJTPr9XIai//emE/bYNeZe7g82k7U6TK RmNQBVc9/4mv1bUTj92lUd2j5MRw/jSDCD1sTMVc1V9UDqk7N9d/TQTW18U2Es3EXnn5 tBfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DipyCF2V; dkim=neutral (no key) header.i=@linutronix.de header.b=72LYjcqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a17090abc4b00b00256001d8f68si1831038pjv.2.2023.05.25.08.43.48; Thu, 25 May 2023 08:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DipyCF2V; dkim=neutral (no key) header.i=@linutronix.de header.b=72LYjcqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241766AbjEYPZN (ORCPT + 99 others); Thu, 25 May 2023 11:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241592AbjEYPZK (ORCPT ); Thu, 25 May 2023 11:25:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04AB618D for ; Thu, 25 May 2023 08:25:08 -0700 (PDT) Date: Thu, 25 May 2023 17:25:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685028307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8IcW9rC36xzwMdbICTITL2z/ciN/8f8kQF9VFbHEV/M=; b=DipyCF2VJlIvZhy1SaQDDJGeqdtzdKSIr3hldqaBDuALGxnV4F9qpRgOAa3xV7N98OKai9 XwCef9hPfzy0so0FmGGN8viFmO33snwdazU2vP+6iCqgpvUIHsLWgDrQ1B/wNpea4BPHh7 azCuXvSsLtnCXBm8BwHx11lbxRfk2vgz4/cnGONP5vo6OAUGe3V7ySW5O9UMNfOQ3npZ0+ Qs3FSIxHQnyJgxQNbx/tHPPp8jmah93HuOO2JJkMYGk6R6fFhJknAR845k0oy0sXlPQr8i 8oSt6GIhAifm93+R5c4DJDCP0qt7RCMPVHxOi/PPCDZx3y8rZL/D8NWGPVaD6A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685028307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8IcW9rC36xzwMdbICTITL2z/ciN/8f8kQF9VFbHEV/M=; b=72LYjcqsdNTY0LTHn7swrYGO8pKrQ0aok0hlESiwa1Kf4cNTPCOoBIiFOH63b6FtezcjJu aaEx+/ePBQAdWhCg== From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ben Segall , Boqun Feng , Crystal Wood , Daniel Bristot de Oliveira , Dietmar Eggemann , Ingo Molnar , John Stultz , Juri Lelli , Mel Gorman , Steven Rostedt , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Waiman Long , Will Deacon Subject: Re: [PATCH v2 1/4] sched/core: Provide sched_rtmutex() and expose sched work helpers Message-ID: <20230525152505.obklNijZ@linutronix.de> References: <20230427111937.2745231-1-bigeasy@linutronix.de> <20230427111937.2745231-2-bigeasy@linutronix.de> <20230503132051.GB1676736@hirez.programming.kicks-ass.net> <20230510150415.6BXNs0I1@linutronix.de> <20230511134308.GV4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230511134308.GV4253@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-05-11 15:43:08 [+0200], Peter Zijlstra wrote: > > If a sched_submit_work() would use a mutex_t lock then we would > > recursively call blk_flush_plug() before setting tsk->blocked_on and >=20 > I'm not following, mutex code sets tsk->blocked_on before it calls > schedule(), getting into the very same problem you have with rt_mutex. >=20 > > perform the same callback and block on the very same lock (again). > > This isn't different compared to !RT therefore you must not use a > > sleeping lock (mutex_t) in the callback. >=20 > See the enforcement thing; today nothing stops the code from using a > mutex or other blocking primitives here. I tried to explain that if blk_flush_plug() blocks on a mutex_t then it will invoke schedule() -> blk_flush_plug() -> schedule() -> blk_flush_plug() -> =E2=80=A6 until it runs out of stack. So it is broken regardless of RT but yes we don't enforce it and yes people might use it and it would work as long as the lock is not contended. > > Do I rebase my stuff on top of his then and we good? >=20 > I just suggested he try something else: >=20 > https://lkml.kernel.org/r/20230510150946.GO4253@hirez.programming.kicks= -ass.net >=20 > if that works out this worry goes away. >=20 > If we get PROVE_RAW_LOCK_NESTING usable, something like the below might > help out with the validation part... Okay. So if I don't collide with workqueue do you buy this or do you ask for something else. I'm not sure=E2=80=A6 Regarding PROVE_RAW_LOCK_NESTING: If I boot -rc3 with `quiet' then I don't see any complains. Otherwise it is printk during boot (caller is holding raw_spinlock_t and then printk() calls to serial driver with spinlock_t). =46rom time to time ppl send "fixes" for PROVE_RAW_LOCK_NESTING splats so I would guess they boot with `quiet' and there isn't much else. So we are getting close here I guess. Do you want me to test the suggested validation map somewhere? Because if it works, it could be queued. Sebastian