Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3910538imw; Thu, 7 Jul 2022 09:26:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vo1F2mMdqz0Mt5W6qCuBFU8yKuWwz69mSojcoO9lO5EwwHU3w07FQ+VeW3yFUQ5HZ/tkEU X-Received: by 2002:a05:6402:280b:b0:437:9efc:a065 with SMTP id h11-20020a056402280b00b004379efca065mr63509113ede.3.1657211206773; Thu, 07 Jul 2022 09:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657211206; cv=none; d=google.com; s=arc-20160816; b=ZiMcoNdE55PqrdAc2amhonPeoJmejXJ/QefoNkDZGpR6i/NvC/yTM8mNizZIX4qGoU 9xcltIcTO1CWe6W739JyVQO5GMWInjiFGI9DeFNRdPNK60O4vJo5B5aEDQx28DTBJ6Pu MujMbDdSxbNe7eFRx7RE76Bk28HM/2+sspaSnC6kG75colV/aBgHJFFST0aDEoLfRktm oysU8E9dnF9SQJc6HS8EzIPoMV7b3OWFO7+mGxBAGaYBIg7aB4iDrkRT8HuyRGxiRYso bJAlx6MW6kW/mRYMYrR+tanj4tQAMXCkKxLJi0/XWh8WalfDBTLUJpRo+gA9Fr3+nfjt pfDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=3DDkWLOEKf6+iNoL56BQzzDtABk3WtKw9TPvGZIrfz4=; b=mUop6KxO8BfRqBd4xqCnrjBqLnufOJUH3StM05muIf10ZPOQGJyzwulqi71+jXgw/5 v08+YI7D0Xkh7dw6jXHWFhTo2HZNBl/BLkZzNqmmatlmT5tWaMtiy5nuG0Ls2uqq4rdB /OAKZj6apaE947U1zsgn8DBbkqH6Io44xu6QGRdyHYSKPb+BXHWmOXz+h6ICCjuXtTJ3 PVZJG2lDQx+PpNu9g/psdTv/LvW35KIwenrUlPRkjuwx7mZH8FlPbYKYbbyYni3Clzr4 R9idcc6jwob4QiH5I7e9wfaGqmjxXufgfkcQuIyH8a8xo4NbaD8McPh5xBogvQ+Tiuye sAdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne16-20020a1709077b9000b006e8d1d9dc28si2005073ejc.32.2022.07.07.09.26.22; Thu, 07 Jul 2022 09:26:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235803AbiGGQUE (ORCPT + 99 others); Thu, 7 Jul 2022 12:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbiGGQUD (ORCPT ); Thu, 7 Jul 2022 12:20:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B0C725EAF; Thu, 7 Jul 2022 09:20:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 46F2FB82124; Thu, 7 Jul 2022 16:20:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9377DC3411E; Thu, 7 Jul 2022 16:19:58 +0000 (UTC) Date: Thu, 7 Jul 2022 12:19:56 -0400 From: Steven Rostedt To: John Keeping Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Sebastian Andrzej Siewior , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: Re: [PATCH] sched/core: Always flush pending blk_plug Message-ID: <20220707121956.0ab19fd8@gandalf.local.home> In-Reply-To: <20220707143902.529938-1-john@metanate.com> References: <20220707143902.529938-1-john@metanate.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Thu, 7 Jul 2022 15:39:02 +0100 John Keeping wrote: > Here the kworker is waiting on msdos_sb_info::s_lock which is held by > tar which is in turn waiting for a buffer which is locked waiting to be > flushed, but this operation is plugged in the kworker. > > The lock is a normal struct mutex, so tsk_is_pi_blocked() will always > return false on !RT and thus the behaviour changes for RT. > > It seems that the intent here is to skip blk_flush_plug() in the case > where a non-preemptible lock (such as a spinlock) has been converted to > a rtmutex on RT, which is the case covered by the SM_RTLOCK_WAIT > schedule flag. But sched_submit_work() is only called from schedule() > which is never called in this scenario, so the check can simply be > deleted. > > Looking at the history of the -rt patchset, in fact this change was > present from v5.9.1-rt20 until being dropped in v5.13-rt1 as it was part > of a larger patch [1] most of which was replaced by commit b4bfa3fcfe3b > ("sched/core: Rework the __schedule() preempt argument"). > Nice investigation. So basically what you are saying is that commit b4bfa3fcfe3b was the implementation of [1], but left out the removal of the tsk_is_pi_blocked(), and that what you are seeing is the problem that is described in [1]. Can you add this in the change log: "As described in [1]: The schedule process must distinguish between blocking on a regular sleeping lock (rwsem and mutex) and a RT-only sleeping lock (spinlock and rwlock): - rwsem and mutex must flush block requests (blk_schedule_flush_plug()) even if blocked on a lock. This can not deadlock because this also happens for non-RT. There should be a warning if the scheduling point is within a RCU read section. - spinlock and rwlock must not flush block requests. This will deadlock if the callback attempts to acquire a lock which is already acquired. Similarly to being preempted, there should be no warning if the scheduling point is within a RCU read section. and with the tsk_is_pi_blocked() in the scheduler path, we hit the first issue." Reviewed-by: Steven Rostedt (Google) -- Steve