Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2494302ybt; Tue, 16 Jun 2020 07:32:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4JtNrom4r+ntk/prPHuHvQfm/QRBDL7BH9t07oEdAtKAEZGne0sc3puW70wL4GtvjfuWE X-Received: by 2002:a17:906:1d5b:: with SMTP id o27mr3030135ejh.344.1592317976153; Tue, 16 Jun 2020 07:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592317976; cv=none; d=google.com; s=arc-20160816; b=PPG2Z8UCu+Gua8d1+O3bGzLcMv1tvMrP3h9pg4sJZNLIIyRWCvYf/SnUlOouBBCDTY MKkOGQiLZ0E7ih67PyUVx9f+1VorB4g75Eqv2YskT6n1j6mToKf0p2fE1HmaI85B7XQJ bMVEn0Vhle1Lsu+fYi2q+FOXXLdlrnGQuI5BiSFCOlwuzyKS3ma8K0Q3d/xdgaRjhH4i xk6FoEeijzYxr5o1QpqQFjVUZyMNeF6HQLFtGOVDQMPDWlCf6fldvQF91TvB5RAt7RUw d+vmywsLhglGAdOLwfcr3YE59S7rIuzTfEGX73gB66viZSEbbwUsc/6o/kDvNO6Hv5dj fIbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=t0uezNPIA4DPn1fMOU/HGmpbf/fUK67RnoGEU6y3XpE=; b=h70yGUbMh4u7CfRJgSdGtqR2/q3kL/qjqpdGcK0cd8dVABDXUGzEP4cJ700jZxuv4g j8K3x+8byCfLCW7aO6X5nwYwz3U78VKvga0ozCMLUrgArxk7mm5N9O6M9LYXgy/pW/gm Ftkh5PkG+77dkLoUSaapZu47fqzGPnh9nbEDX89/VmzPer0p9gjUSsmrFzt34RZ8vZzM PpQyPkQPmzBeMKD6mDezYFpDwyN+gQrlrc35oDsCAnvJ/Y05vaStEjKksXOtV/wV1thT k3hOvKUPLtCy3vNhqYdsNOLvR3FEg6gUV/DbjTsipov4mNwNQNeKPdQQPw+RY7FfPYKm fHWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=eD+sNKEy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg28si10649100edb.495.2020.06.16.07.32.32; Tue, 16 Jun 2020 07:32:56 -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=@joelfernandes.org header.s=google header.b=eD+sNKEy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728919AbgFPOaW (ORCPT + 99 others); Tue, 16 Jun 2020 10:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgFPOaV (ORCPT ); Tue, 16 Jun 2020 10:30:21 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 372C9C06174E for ; Tue, 16 Jun 2020 07:30:21 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id d12so6732023qvn.0 for ; Tue, 16 Jun 2020 07:30:21 -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; bh=t0uezNPIA4DPn1fMOU/HGmpbf/fUK67RnoGEU6y3XpE=; b=eD+sNKEycQE63Edi/DqlPL+CemWI16ocqKlFZcPoyewIYkKTRL/RgZxMsWCJ1js/OJ FN+NCpL2bjYGKRbD+GhdeUoKtnIJZeCJr2ImkDgTmUuP3yUyqqKfLkMaUv4WMkBgZkQ6 ca3m7G6KhDolNWboNm58b6BXvluWbOB/g9qVk= 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; bh=t0uezNPIA4DPn1fMOU/HGmpbf/fUK67RnoGEU6y3XpE=; b=ua+u0SYxh/68rS+CMdItFHUhlbopu43PO9n3mhaQgNsVjrRZPY//IFWrJEFjcNKxRH Q4qKwf4FzJlTtzwIV9zwrAbFuT/NbpYCcUaY8rQdlwiSY3/ciRHKe1ClsEAAwU39HguA 1nYRGJSHmLtcwpWZucsOC+B16/Rvq5MWHiZxLcGxJTbfCuzHd+A36oW9BagJJwMsxBZq j0ZPPkkcw6o0vLRuqJwFZYHiy7tlFy0O0dlwvlIWjFlBseHe8QFr6yic8Y/Y4EGZ+lOB wLHt7BNgW6kZI6bmyNtifxK1tPGOXum13CH3dWKxPcqvEDLLi/y9krbmqYOWIaazTiPU WXcQ== X-Gm-Message-State: AOAM530kBi3DcXXX9lkDC2gfKuY73cQMm72S6RzfRxh4vv13EFP2obKd hmx+2gvpeDS4pYqALmPvuoU8og== X-Received: by 2002:a05:6214:10e5:: with SMTP id q5mr2550328qvt.47.1592317820204; Tue, 16 Jun 2020 07:30:20 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id 126sm14401177qkj.89.2020.06.16.07.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 07:30:19 -0700 (PDT) Date: Tue, 16 Jun 2020 10:30:18 -0400 From: Joel Fernandes To: Thomas Gleixner Cc: "Paul E. McKenney" , LKML , rcu@vger.kernel.org, Andrew Lutomirski , X86 ML , Frederic Weisbecker , Steven Rostedt , Mathieu Desnoyers , Will Deacon , Peter Zijlstra Subject: Re: [PATCH x86/entry: Force rcu_irq_enter() when in idle task Message-ID: <20200616143018.GD12037@google.com> References: <20200611235305.GA32342@paulmck-ThinkPad-P72> <871rmkzcc8.fsf@nanos.tec.linutronix.de> <87wo4cxubv.fsf@nanos.tec.linutronix.de> <20200615201647.GC12037@google.com> <871rmfcskb.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871rmfcskb.fsf@nanos.tec.linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 10:40:04AM +0200, Thomas Gleixner wrote: > Joel, > > Joel Fernandes writes: > > On Fri, Jun 12, 2020 at 03:55:00PM +0200, Thomas Gleixner wrote: > >> This is also correct vs. user mode entries in NOHZ full scenarios because > >> user mode entries bring RCU out of EQS and force the RCU irq nesting state > > > > I had to re-read this sentence a couple of times. The 'user mode entries' > > sounds like 'entry into user mode'. It would be good to reword it to 'IRQ > > entry in user mode'. > > :) > > > My knowledge predates the rcu-watching reworks so apologies on the below > > question but I still didn't fully follow why when the idle task behaves > > differently from being in user mode. Even with user mode we should have: > > > > (in EQS) > > <---------- exits EQS so now rcu is watching > > > > <-- the buggy !watching logic prevents rcu_irq_enter > > -> report QS since tick thinks it is first level. > > > > Is there a subtlety here I'm missing? I checked the RCU code and I did not > > see anywhere that rcu_user_enter() makes it behave differently. Both > > rcu_user_enter() and rcu_idle_enter() call rcu_eqs_enter(). > > The interrupt hit user mode entry does: > > idtentry_enter_cond_rcu() > if (user_mode(regs)) > enter_from_user_mode() > user_exit_irqoff() > __context_tracking_exit(CONTEXT_USER) > rcu_user_exit() > rcu_eqs_exit(1) > ... > WRITE_ONCE(rdp->dynticks_nmi_nesting, > DYNTICK_IRQ_NONIDLE); > > i.e. for interrupts which enter from user mode we are not invoking > rcu_irq_enter() at all. > > The return from interrupt path has nothing to do with that because > that's an entry in kernel mode. Hi Thomas, Ah, IRQ entry in user mode triggers the context-tracking path. Makes sense now, thanks. This will help me when I have to propose to get rid of dynticks_nmi_nesting again :) Reviewed-by: Joel Fernandes (Google) thanks, - Joel