Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp404025ybl; Fri, 23 Aug 2019 02:38:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFjkWAR+CWHQgLQkBS8FImYiPEN0ERxbgrUcaiKZpKW1sSEp3sN0JXyove4UIhZ/o2auj5 X-Received: by 2002:a17:90a:2069:: with SMTP id n96mr4233388pjc.4.1566553125842; Fri, 23 Aug 2019 02:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566553125; cv=none; d=google.com; s=arc-20160816; b=X1VzymsqRGkixrE8aGO0Qw2EwbDW5hLNh7Z0tsuhvO+/5AQVYenQS/M4bv7d2Nst8J ZP2iEESJMKHvG8NJfufqIQmAdEuuyk21uklYYM2ifvQIvLO4KUNwU9ArLZ9bOe/r2dBT QSyCfaH2dmAnuMYhyKjdMTp8QaK+4zsCoeSFLYdtyrYFxwLniqeSuOVm5K14dG8nQLFo kH1QEdCiL9v6Py6jd1xMdFz7FK+bJzPvtrNMu8N5XStwLGRfxcUUShiR4mhxGXOpK+O/ 4aGU3M8zmjyncIC8gky+zmDyhJdjsgPkOlwf+cCrNLnnGuQXHY26tiZx5AP9wtDLoJXq +w5g== 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:dkim-signature; bh=nVpIaULoP5xHhVhqVwCnL2/nr72RjF/GeMw6NFKePik=; b=h/BPmUDbVTIKcLTGP5D+bWMmaS+TR7TJACU4DGEz91Ta2dIVXCtiSCTrVRBhrjKQGz PU9ylFWwYxRvpiOl1EsK9UlfvR2gpB7r3TgWqDhYCpdpql0b3pC4RpuNSV+WcbOYzX/t noLw2/E5jOQlXDQt9lqwcDb2v28M7/4+0qr09QCUy6WNBlwZ/sOxLQuz2hAQXY9uvIDr ZrZr/srHhKVvp/j8YAEokpsnyR2nXSqIkumQgjyaALC9Iag7Jxmh1S/DOwj5KRasGlbm RKS1SrCFsSRowbgBY1jYWrEFpRSY/DZdCHoVhxaJQZGvVpgnWBVHQQGjywklOKBuqYnd y7lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=iXWjbHRa; 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 i6si1869446pjs.13.2019.08.23.02.38.30; Fri, 23 Aug 2019 02:38:45 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=iXWjbHRa; 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 S2388244AbfHWBuN (ORCPT + 99 others); Thu, 22 Aug 2019 21:50:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45310 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730401AbfHWBuM (ORCPT ); Thu, 22 Aug 2019 21:50:12 -0400 Received: by mail-pf1-f195.google.com with SMTP id w26so5258718pfq.12 for ; Thu, 22 Aug 2019 18:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nVpIaULoP5xHhVhqVwCnL2/nr72RjF/GeMw6NFKePik=; b=iXWjbHRav/jxO8IDVueGiQsPLqyZ2UBzkvdzUstOgkEklotIMp8PhS8shzzN9Zuwkb J/oC2mR2wQoaRxCqzPMdMqWdrZL7QQhbmcpkgNsVVqZcEuBx3ri3ZZ4GQfYVXpZq+Qha OhoJWf9g/svDxyaIdNDLhULNDPAdA+aoctMlc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nVpIaULoP5xHhVhqVwCnL2/nr72RjF/GeMw6NFKePik=; b=XbnTrbqEZEldC/GvbLQcxJBmWPeJUBcGk7n9eK7oX09FLZ0E89NnQqjtOeFo8uc+up Eub+NcLbgRvTAbDl7z/SdEscQsvEYEKg/aKUCl6c490cuc5latJcvMe9L0CelUPRLlYG 82YxyVUTfoIxhjgskO39xlVBEeTH17xVCmjJGFyGy5NoM44IDhSIERMXYmyQSWE0I56s VbOamSG0b82nYLpbistcKR9B1p+3ySfE8TrDgJA4LTWZ8PeO/7ymW5IETQkwWgXTgdHO jgohGdUwO/0hyes1frXELQB3KwnwRjM0c7p86y8aIaOBUqAgHP14GdfGB6rVa0GwSzIr IOTQ== X-Gm-Message-State: APjAAAUS/XXitHUh1EKHWbgVK/WQs8eoUUdm0HD5ALG0pqdEM2xkfQD8 CNwVTOdCYtA0h0GPhPO1R0xSCQ== X-Received: by 2002:aa7:8f29:: with SMTP id y9mr2491838pfr.27.1566525011711; Thu, 22 Aug 2019 18:50:11 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id a3sm688640pfc.70.2019.08.22.18.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2019 18:50:10 -0700 (PDT) Date: Thu, 22 Aug 2019 21:50:09 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: Scott Wood , Sebastian Andrzej Siewior , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Juri Lelli , Clark Williams Subject: Re: [PATCH RT v2 1/3] rcu: Acquire RCU lock when disabling BHs Message-ID: <20190823015009.GA152050@google.com> References: <20190821231906.4224-1-swood@redhat.com> <20190821231906.4224-2-swood@redhat.com> <20190821233358.GU28441@linux.ibm.com> <20190822133955.GA29841@google.com> <20190822152706.GB28441@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190822152706.GB28441@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 22, 2019 at 08:27:06AM -0700, Paul E. McKenney wrote: > On Thu, Aug 22, 2019 at 09:39:55AM -0400, Joel Fernandes wrote: > > On Wed, Aug 21, 2019 at 04:33:58PM -0700, Paul E. McKenney wrote: > > > On Wed, Aug 21, 2019 at 06:19:04PM -0500, Scott Wood wrote: > > > > A plain local_bh_disable() is documented as creating an RCU critical > > > > section, and (at least) rcutorture expects this to be the case. However, > > > > in_softirq() doesn't block a grace period on PREEMPT_RT, since RCU checks > > > > preempt_count() directly. Even if RCU were changed to check > > > > in_softirq(), that wouldn't allow blocked BH disablers to be boosted. > > > > > > > > Fix this by calling rcu_read_lock() from local_bh_disable(), and update > > > > rcu_read_lock_bh_held() accordingly. > > > > > > Cool! Some questions and comments below. > > > > > > Thanx, Paul > > > > > > > Signed-off-by: Scott Wood > > > > --- > > > > Another question is whether non-raw spinlocks are intended to create an > > > > RCU read-side critical section due to implicit preempt disable. > > > > > > Hmmm... Did non-raw spinlocks act like rcu_read_lock_sched() > > > and rcu_read_unlock_sched() pairs in -rt prior to the RCU flavor > > > consolidation? If not, I don't see why they should do so after that > > > consolidation in -rt. > > > > May be I am missing something, but I didn't see the connection between > > consolidation and this patch. AFAICS, this patch is so that > > rcu_read_lock_bh_held() works at all on -rt. Did I badly miss something? > > I was interpreting Scott's question (which would be excluded from the > git commit log) as relating to a possible follow-on patch. > > The question is "how special can non-raw spinlocks be in -rt?". From what > I can see, they have been treated as sleeplocks from an RCU viewpoint, > so maybe that should continue to be the case. It does deserve some > thought because in mainline a non-raw spinlock really would block a > post-consolidation RCU grace period, even in PREEMPT kernels. > > But then again, you cannot preempt a non-raw spinlock in mainline but > you can in -rt, so extending that exception to RCU is not unreasonable. > > Either way, we do need to make a definite decision and document it. > If I were forced to make a decision right now, I would follow the old > behavior, so that only raw spinlocks were guaranteed to block RCU grace > periods. But I am not being forced, so let's actually discuss and make > a conscious decision. ;-) I think non-raw spinlocks on -rt should at least do rcu_read_lock() so that any driver or kernel code that depends on this behavior and works on non-rt also works on -rt. It also removes the chance a kernel developer may miss documentation and accidentally forget that their code may break on -rt. I am curious to see how much this design pattern appears in the kernel (spin_lock'ed section "intended" as an RCU-reader by code sequences). Logically speaking, to me anything that disables preemption on non-RT should do rcu_read_lock() on -rt so that from RCU's perspective, things are working. But I wonder where we would draw the line and if the bar is to need actual examples of usage patterns to make a decision.. Any thoughts? thanks, - Joel