Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4570116ybe; Mon, 16 Sep 2019 14:39:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9Yyyd8hJrC32FjGvhNXrqgBiRBpduFLkgPaHHrWBFiifjv0uOsw57xHTbqJgzWciv23rH X-Received: by 2002:a17:906:d926:: with SMTP id rn6mr1886325ejb.175.1568669971892; Mon, 16 Sep 2019 14:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568669971; cv=none; d=google.com; s=arc-20160816; b=TtoRmChiSCWKcjjVE4roD9Mx/uQQ0wPu7gXhP5XFLV0ZKq9qJtahQNaJSKdYYF6TQI URcj3oCFgrfCOhutKI+mYjIRy5kRPg8Y3RskzDKAa4kLYDSpW1uhqAc7PhWO/tXfOMcb 1BTQZIYvv8aXzlZSaIR+n3o8Xcf+SXldTt6L4cWYAh3ZWOvQT0JmhRdw1l/NgwddkdZo 9s/CMehmCBTjbJzV3Je2F0Ck0t1ujcoKKXa7JDJ3SsTcgF1b7ctemxuSO5XlGe3q2h+M /+0TMGZlnPWnUiJOG7YX4KYg2goci4JnJr7CHREcis7wSnYxXRrf7a36cFN9eUiwRRHe BAQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=Mnwz1PialJrFw3isfdcKzbQGAUpmXGztaakmVkb+5ZQ=; b=WMg+5/pQkxkWl4taL5u7BysYYbcCoc9TU5me8Q6lgYHMq2FtQ/ytxBjYZfiCF7F/3/ seQXlI8o6OZ8Q6u0BFC5mKSV3MoIdt0Pg26/1kRnMziSuuBXA7bkWQg5a0WaP6TbKzi/ i6liNuLM9qONgOJBi1jVyoifnS19KmBhMmV3cRI3MrEWGP58D2RMpFupCetsnCxzboyH oZaWqO/FCd/sKlTgS3FpAFnXXDaipQ/9fWQ9lLQQJGouc8NxRF2CT2W4Did4yuZ7vUs4 1tyOsmK9MHc6VeBwE7b9G7pZxHimgs3jcD3hvaBmMgQ4wq+psGFHk7dzFhd7WH4nSUNa i65g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id op27si77716ejb.253.2019.09.16.14.39.08; Mon, 16 Sep 2019 14:39:31 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390212AbfIPQ4F (ORCPT + 99 others); Mon, 16 Sep 2019 12:56:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49752 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbfIPQ4F (ORCPT ); Mon, 16 Sep 2019 12:56:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 078A318CB8E2; Mon, 16 Sep 2019 16:56:05 +0000 (UTC) Received: from ovpn-117-172.phx2.redhat.com (ovpn-117-172.phx2.redhat.com [10.3.117.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C9E75D9DC; Mon, 16 Sep 2019 16:55:58 +0000 (UTC) Message-ID: <500cabaa80f250b974409ee4a4fca59bf2e24564.camel@redhat.com> Subject: Re: [PATCH RT v3 5/5] rcutorture: Avoid problematic critical section nesting on RT From: Scott Wood To: Joel Fernandes Cc: Sebastian Andrzej Siewior , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Thomas Gleixner , Steven Rostedt , Peter Zijlstra , Juri Lelli , Clark Williams Date: Mon, 16 Sep 2019 11:55:57 -0500 In-Reply-To: <20190912221706.GC150506@google.com> References: <20190911165729.11178-1-swood@redhat.com> <20190911165729.11178-6-swood@redhat.com> <20190912221706.GC150506@google.com> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Mon, 16 Sep 2019 16:56:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-09-12 at 18:17 -0400, Joel Fernandes wrote: > On Wed, Sep 11, 2019 at 05:57:29PM +0100, Scott Wood wrote: > > rcutorture was generating some nesting scenarios that are not > > reasonable. Constrain the state selection to avoid them. > > > > Example #1: > > > > 1. preempt_disable() > > 2. local_bh_disable() > > 3. preempt_enable() > > 4. local_bh_enable() > > > > On PREEMPT_RT, BH disabling takes a local lock only when called in > > non-atomic context. Thus, atomic context must be retained until after > > BH > > is re-enabled. Likewise, if BH is initially disabled in non-atomic > > context, it cannot be re-enabled in atomic context. > > > > Example #2: > > > > 1. rcu_read_lock() > > 2. local_irq_disable() > > 3. rcu_read_unlock() > > 4. local_irq_enable() > > If I understand correctly, these examples are not unrealistic in the real > world unless RCU is used in the scheduler. I hope you mean "not realistic", at least when it comes to explicit preempt/irq disabling rather than spinlock variants that don't disable preempt/irqs on PREEMPT_RT. > > If the thread is preempted between steps 1 and 2, > > rcu_read_unlock_special.b.blocked will be set, but it won't be > > acted on in step 3 because IRQs are disabled. Thus, reporting of the > > quiescent state will be delayed beyond the local_irq_enable(). > > Yes, with consolidated RCU this can happen but AFAIK it has not seen to be > a > problem since deferred QS reporting will happen take care of it, which can > also happen from subsequent rcu_read_unlock_special(). The defer_qs_iw_pending stuff isn't in 5.2-rt. Still, given patch 4/5 (and special.b.deferred_qs on mainline) this shouldn't present a deadlock concern (letting the test run a bit now to double check) so this patch could probably be limited to the "example #1" sequence. > > For now, these scenarios will continue to be tested on non-PREEMPT_RT > > kernels, until debug checks are added to ensure that they are not > > happening elsewhere. > > Are you seeing real issues that need this patch? It would be good to not > complicate rcutorture if not needed. rcutorture crashes on RT without this patch (in particular due to the local_bh_disable misordering). -Scott