Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp909951imm; Fri, 22 Jun 2018 07:21:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK0Vnv1OHZ0Vm/w/hQaPynWWcTAkiIutnXssg0NDdqzgJt2es+OSAqSwp7hj7+/yWSINfck X-Received: by 2002:a65:5648:: with SMTP id m8-v6mr1604153pgs.19.1529677287642; Fri, 22 Jun 2018 07:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529677287; cv=none; d=google.com; s=arc-20160816; b=Pd8M3KPGXwpsavGYLROvsOodKGZqtOkG43mS9jrlNiBXIbAfZx2/s+sZQbEG3DSsnH QYfN7AWFpewZWSQ6QScmpyHWlMYZwJuLVmFXulzglggK8wKbt9VvFVgdnkcmF+ZxdSMs LlZ8IUnsIQMcRq6HyBVNcbW1ai3kwZjqLVOu3SLBU4h6D5uYT72pU1D0836HaW9z7C1v gntyi3mACX9eFScAKSvUHrjB3aXSSxrRRyVim92o3TeCAL4VIlUFqqp7PGsTe59ovrNj 8M1Ow0Wqa+MWH5Z0YFY0EOEXOCqj7sPKVJFtTHxL1JMXsbS5qxckIGb8SDISr8vp6llO iqmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=JM8F6KtGr9lZroTJ22CBEv8JcbvjYyIEU5+qTdQMcXc=; b=CvbsJx0YJZFZGwsOiGg2RSxBa9s5vp++XToijYf7FfWBvkhx3wFnBYSP8UDFl7dnBh LI3RteILetW8q8WvV1pb1j5tfNDkSkP1hxk8847nWCTJbSRPw/qBkiPKuMCneoM5VPPH zzwsAn5P7du6wSpxvs2z1Gbo6EEjiDmFs7Jti/lYEMYNKUCMQCzvWP9biEZktMkwYwLx 30vAWsjdTZw/+rr+I5srbeulw0OPnwA/t0zJxt3uv6OFNils1EuC7CuXnIPFLraZOnAi qj01SxUDw3Husz80CxFL93lAy57ib5Z6dcx6D2cwr3khQdNQkELZ7X+P0PHq+kLqVi1I lVMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kbbC6z9m; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g79-v6si8376948pfa.271.2018.06.22.07.21.07; Fri, 22 Jun 2018 07:21:27 -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=@kernel.org header.s=default header.b=kbbC6z9m; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932981AbeFVOT2 (ORCPT + 99 others); Fri, 22 Jun 2018 10:19:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:35464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeFVOT1 (ORCPT ); Fri, 22 Jun 2018 10:19:27 -0400 Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB2132438B for ; Fri, 22 Jun 2018 14:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529677167; bh=XGU5MKu0RuEQpnWkuo0edRwUFsjyq9kfc6UNh/QSO7Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kbbC6z9m1VR7y+Fvv60xhnTusCI83Ua3YowTCf0zRSue0Lu9V7W9GgBAwNJX/SLhG Kzp0c98QQPUZvlhF2RJ1gWfZNBzhsFu3lbaqXJ/eWmXNmyxj5hvhW6ow9/FbT+KsIs /BWUJROjK6YoXAp1TVegY3VeJiyMhReUbV97L7KQ= Received: by mail-wr0-f171.google.com with SMTP id l14-v6so1818860wrq.13 for ; Fri, 22 Jun 2018 07:19:26 -0700 (PDT) X-Gm-Message-State: APt69E2wPPAQCK9Nc2z8exibTNeCrij9Gnr3qvWTnQOgRzwN2/TvLdVt mJbL3fGjyQpHSOtDWpjVuuZnfRgMEwGQsL0A3Pr9Ew== X-Received: by 2002:adf:85ec:: with SMTP id 41-v6mr1798202wru.120.1529677165422; Fri, 22 Jun 2018 07:19:25 -0700 (PDT) MIME-Version: 1.0 References: <1529484440-20634-1-git-send-email-byungchul.park@lge.com> <1529484440-20634-2-git-send-email-byungchul.park@lge.com> <20180620145814.GQ3593@linux.vnet.ibm.com> <20180620164902.GW3593@linux.vnet.ibm.com> <20180622055659.GA255098@joelaf.mtv.corp.google.com> <20180622132843.GN3593@linux.vnet.ibm.com> In-Reply-To: <20180622132843.GN3593@linux.vnet.ibm.com> From: Andy Lutomirski Date: Fri, 22 Jun 2018 07:19:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC 2/2] rcu: Remove ->dynticks_nmi_nesting from struct rcu_dynticks To: "Paul E. McKenney" Cc: joel@joelfernandes.org, max.byungchul.park@gmail.com, Byungchul Park , Lai Jiangshan , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , LKML , kernel-team@lge.com, Andrew Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 22, 2018 at 6:26 AM Paul E. McKenney wrote: > > On Thu, Jun 21, 2018 at 10:56:59PM -0700, Joel Fernandes wrote: > > Hi Paul, > > > > On Wed, Jun 20, 2018 at 09:49:02AM -0700, Paul E. McKenney wrote: > > > On Thu, Jun 21, 2018 at 01:05:22AM +0900, Byungchul Park wrote: > > > > On Wed, Jun 20, 2018 at 11:58 PM, Paul E. McKenney > > > > wrote: > > > > > On Wed, Jun 20, 2018 at 05:47:20PM +0900, Byungchul Park wrote: > > > > >> Hello folks, > > > > >> > > > > >> I'm careful in saying that ->dynticks_nmi_nesting can be removed but I > > > > >> think it's possible since the only thing we are interested in with > > > > >> regard to ->dynticks_nesting or ->dynticks_nmi_nesting is whether rcu is > > > > >> idle or not. > > > > > > > > > > Please keep in mind that NMIs cannot be masked, which means that the > > > > > rcu_nmi_enter() and rcu_nmi_exit() pair can be invoked at any point in > > > > > the process, between any consecutive pair of instructions. The saving > > > > > > And yes, I should have looked at this patch more closely before replying. > > > But please see below. > > > > > > > I believe I understand what NMI is and why you introduced > > > > ->dynticks_nmi_nesting. Or am I missing something? > > > > > > Perhaps the fact that there are architectures that can enter interrupt > > > handlers and never leave them when the CPU is non-idle. One example of > > > this is the usermode upcalls in the comment that you removed. > > > > I spent some time tonight and last night trying to understand this concept of > > never leaving an interrupt, I hope you don't mind me asking this dumb > > question... perhaps I will learn something : Could you let me know how is it > > possible that an interrupt never exits? > > > > Typically an interrupt never exiting sounds like a hard-lockup. This is how > > hardlock detector works: Since regular interrupts in linux can't nest, the > > hardlockup detector checks if hrtimer interrupts are being handled and if > > not, then it throws a splat, panics the kernel etc. So I am a bit troubled by > > this interrupt never exiting concept.. > > > > Further since an interrupt is an atomic context, it cannot sleep or schedule > > into usermode so how are these upcalls handled from the interrupt? > > It has been some years since I traced the code flow, but what happened > back then is that it switches itself from an interrupt handler to not > without actually returning from the interrupt. This can only happen when > interrupting a non-idle process, thankfully, and RCU's dyntick-idle code > relies on this restriction. If I remember correctly, the code ends up > executing in the context of the interrupted process, but it has been some > years, so please apply appropriate skepticism. ... > > I have never seen NMIs be unpaired or improperly nested. However, > given that rcu_irq_enter() invokes rcu_nmi_enter() and rcu_irq_exit() > invokes rcu_nmi_exit(), it is definitely the case that rcu_nmi_enter() > and rcu_nmi_exit() need to deal with unpaired and improperly nested > invocations. This is very strange. There are certainly cases in x86 where an interrupt-ish code path can become less interrupt-ish without returning (killing a task that overflows a kernel stack is an example), but the RCU calls should still nest correctly. Do you know the history of this requirement?