Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp565424pxk; Wed, 2 Sep 2020 08:55:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3zaxvpALNugSJPlrCdH+rgpukCuWUBzeHUrr7bBsJxQ24XcR3ph8PVXA8cdnRpPQUDlpi X-Received: by 2002:a50:fe0f:: with SMTP id f15mr683960edt.235.1599062113129; Wed, 02 Sep 2020 08:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599062113; cv=none; d=google.com; s=arc-20160816; b=MSEyCwN4zdkxh9ihPhEJfS0uYVF/0ns2tNCwjU5MgMIKZmahkdMQ1MxXMYgCg8NuO0 vQxCokOdKjWWc/SUQa6nCFRliCgdg/wEBBacpUQ9DsY5xhj/lsr1zV6FkYkhzIMA8CTA GIIyIwFYRIZA9oe+mLlqZD+vq0gIL164wjObWcwKVGH3/Gp/JsO4SJv6zTUSbnZiNkD2 eisbYCWodlGOpPPp5lxZ7JjROrflKpERUOYWBpvBDfVCM6dU1z9ovvWTS5zZTZ2EPuxA Kw4hj06cCNMwXyR0VLcnLVTvYxQYkbvP0SQzvXwF9ML+RCRJ7vNI9Ev7mmtBZcduCxIm 1QMQ== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=my67KyJdR+vJjUn+Dq2F1t9MW9ovxaSD59WTHugJtNU=; b=AhLWNkzMdW8It8dnqFR+++N6320G9lFOhC2bk3Rps8SgjDuxpycmAUlgWxJ8b5ee4M Qxe7ZuBRIE9AafeYCTPLInCSoJ+7E2qwqnB0TexnZ2VIIEJFdLX0wfMj+7p8AILViKQx gf5CDnk0i5im87uF0JP7he05cB2fvPytRcGN4ylIbVA4/gSjSkgEzjOQiuu3/23bGehS R5jrzicHs/rRZk7xRGrBAuW7aWEmFT8jQiBhL5Fvt0qVjAugdQW2tLKkgE6Rvd43HmXW j2u+dnCIDVnOxJQE76iDKP16qeCJTB/D24uOaMGRSkKBPA+cLtZpZEIF8IafReCWKSeV 9bpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QanVEyu0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx9si2539294edb.231.2020.09.02.08.54.50; Wed, 02 Sep 2020 08:55:13 -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=@kernel.org header.s=default header.b=QanVEyu0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbgIBPyP (ORCPT + 99 others); Wed, 2 Sep 2020 11:54:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:43684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbgIBPyL (ORCPT ); Wed, 2 Sep 2020 11:54:11 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF9DC2072A; Wed, 2 Sep 2020 15:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599062051; bh=T9iTGJwk3MutXitltZ85MC5KJh0naTlHQ9Yv1BlJG2A=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=QanVEyu0Y8fvXfxzCKQ7+7u25VxbaSQXAFUO6scvERn5gpnqEsKJGv4lwONrQGCu3 CZKS4fSd5rDP2lfP5Q0xrEJbGIcWDuMNYGqHjLO3wasWZqLcWZPRGR8cz1phTykO0o fdgmW/YejKomoK4ix6fO/RUO5XzGP/UDUoqFU2kw= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 64F07352157A; Wed, 2 Sep 2020 08:54:10 -0700 (PDT) Date: Wed, 2 Sep 2020 08:54:10 -0700 From: "Paul E. McKenney" To: Davidlohr Bueso Cc: peterz@infradead.org, mingo@redhat.com, will@kernel.org, linux-kernel@vger.kernel.org Subject: Re: Question on task_blocks_on_rt_mutex() Message-ID: <20200902155410.GH29330@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200831224911.GA13114@paulmck-ThinkPad-P72> <20200831232130.GA28456@paulmck-ThinkPad-P72> <20200901174938.GA8158@paulmck-ThinkPad-P72> <20200901235821.GA8516@paulmck-ThinkPad-P72> <20200902015128.wsulcxhbo7dutcjz@linux-p48b> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200902015128.wsulcxhbo7dutcjz@linux-p48b> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 01, 2020 at 06:51:28PM -0700, Davidlohr Bueso wrote: > On Tue, 01 Sep 2020, Paul E. McKenney wrote: > > > And it appears that a default-niced CPU-bound SCHED_OTHER process is > > not preempted by a newly awakened MAX_NICE SCHED_OTHER process. OK, > > OK, I never waited for more than 10 minutes, but on my 2.2GHz that is > > close enough to a hang for most people. > > > > Which means that the patch below prevents the hangs. And maybe does > > other things as well, firing rcutorture up on it to check. > > > > But is this indefinite delay expected behavior? > > > > This reproduces for me on current mainline as follows: > > > > tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --torture lock --duration 3 --configs LOCK05 > > > > This hangs within a minute of boot on my setup. Here "hangs" is defined > > as stopping the per-15-second console output of: > > Writes: Total: 569906696 Max/Min: 81495031/63736508 Fail: 0 > > Ok this doesn't seem to be related to lockless wake_qs then. fyi there have > been missed wakeups in the past where wake_q_add() fails the cmpxchg because > the task is already pending a wakeup leading to the actual wakeup ocurring > before its corresponding wake_up_q(). This is why we have wake_q_add_safe(). > But for rtmutexes, because there is no lock stealing only top-waiter is awoken > as well as try_to_take_rt_mutex() is done under the lock->wait_lock I was not > seeing an actual race here. This problem is avoided if stutter_wait() does the occasional sleep. I would have expected preemption to take effect, but even setting the kthreads in stutter_wait() to MAX_NICE doesn't help. The current fix destroys intended instant-on nature of stutter_wait(), so the eventual fix will need to use hrtimer-based sleeps or some such. Thanx, Paul