Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5157270ybe; Tue, 17 Sep 2019 03:41:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoVwdlxGRDOa2LGXmjB9c1tTnXbKwR687KGRx2hi/mVBSKcYOgjOtSsa5xXpOYPzLph4+4 X-Received: by 2002:aa7:cf86:: with SMTP id z6mr3758189edx.230.1568716863016; Tue, 17 Sep 2019 03:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568716863; cv=none; d=google.com; s=arc-20160816; b=lT7JG/SSolSF5ksZ5AW0t69VFWTHrjfDWxrVoZE2uRx87cqWa6L5OR0lVtrV5pzXrY tLToSH9mxmnGAItvB0Y3H23/90gG3kvA+HsjnFogO+bBIzdora0ERTtBozZ98B8UYF80 5iyxT1YpocUTQnMNru26hBBKN28SenTT+6cOOmsHCzvLAHhhHh2VFur7HHdqkB2NAvb3 cyjzNuM7z8Ub6ZjmIoTuzORUFLkkhrO4KTVMtfSdPQNEyuT/S5tbEG+wAEfZrerVXv+i 4V4h3l9QuV31kM1PXUO8A1+Julgwm/obnER+3ickzTKhgSM+rHUVYPZ1ZsC56jFIbteU QE6w== 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; bh=vttp233ontpMceqhU+RvS9RzhsZBzZL34hsL3IV32es=; b=eEvBylWb9XttigxhSKrSU62iwbAr1uye0p15mXkXRe2T2942clS790xB5sRb9pdH8c 7X7a3ncHoTSWmcKoojQxHr2xQUknl1Dlw8fMbXkU61bcpKwabpgF6geD8B0xMVBQXoYM QZN35YXFD0znWHX+Bfn2OqaDwNbCtBOeFPjiJ7iRwNads0jUHpWXFrV/0TyUXBYAsO4m 6j1q3ZZKHWwqKuFTE3LADDwzjstRUQbvjnDTyUxq9RaD8j4E7OE4nyweQiK4jPHC+uLN Nsa8g91KBW6mhiZYfhs7uyX7ffbs0WbGrXwSMBmYLC/ulkgScMHDJQPEaZamYZ5JWtf3 PfYA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v31si1067826edm.402.2019.09.17.03.40.39; Tue, 17 Sep 2019 03:41:03 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbfIQKHd (ORCPT + 99 others); Tue, 17 Sep 2019 06:07:33 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41162 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbfIQKHc (ORCPT ); Tue, 17 Sep 2019 06:07:32 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1iAAOO-0001K5-MJ; Tue, 17 Sep 2019 12:07:28 +0200 Date: Tue, 17 Sep 2019 12:07:28 +0200 From: Sebastian Andrzej Siewior To: Scott Wood Cc: Joel Fernandes , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Thomas Gleixner , Steven Rostedt , Peter Zijlstra , Juri Lelli , Clark Williams Subject: Re: [PATCH RT v3 5/5] rcutorture: Avoid problematic critical section nesting on RT Message-ID: <20190917100728.wnhdvmbbzzxolef4@linutronix.de> References: <20190911165729.11178-1-swood@redhat.com> <20190911165729.11178-6-swood@redhat.com> <20190912221706.GC150506@google.com> <500cabaa80f250b974409ee4a4fca59bf2e24564.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <500cabaa80f250b974409ee4a4fca59bf2e24564.camel@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-09-16 11:55:57 [-0500], Scott Wood wrote: > 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. We have: - local_irq_disable() (+save) - spin_lock() - local_bh_disable() - preempt_disable() On non-RT you can (but should not) use the counter part of the function in random order like: local_bh_disable(); local_irq_disable(); local_bh_enable(); local_irq_enable(); The non-RT will survive this. On RT the counterpart functions have to be used in reverse order: local_bh_disable(); local_irq_disable(); local_irq_enable(); local_bh_enable(); or the kernel will fall apart. Since you _can_ use it in random order Paul wants to test that the random use of those function does not break RCU in any way. Since they can not be used on RT in random order it has been agreed that we keep the test for !RT but disable it on RT. > -Scott Sebastian