Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp412042ybv; Wed, 5 Feb 2020 07:43:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwmr9k/SAm+5ykqI1WUtUJJ69M/wiqRH5+BSsopInvlXzFWhVaBaVvmO+PrU44EmBiTCVvh X-Received: by 2002:aca:5746:: with SMTP id l67mr3387519oib.60.1580917398814; Wed, 05 Feb 2020 07:43:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580917398; cv=none; d=google.com; s=arc-20160816; b=b2uOWzD9irhb1YysHbKiy1rY75fWX/JYo0I+BBsbUKyHAIo0YHsucyqYHs+s668DGm qyEyL0oTFLanomntdSQnIsxUCna8LM8mvFVNt5B9iZOzEIfiR4OxF5b40tw6M6jT+B4a 6/ffyLtVH5zUNGL2BHgNbRr6YnS7AdO4kdJ6xTN90tCA0J5as52/rumagS7bl2U/VMi5 D3GrAZ/TA2vaajrpUg6V8zbduKciB1rn5hONnhqUQTYemNFs6zKslmaJQJEVQCaxyCUE sgUhy8R5V1QnA9eKOnv/tbToV8ZW3e3jLugoecAirXwy3XZja1PJt8u8s1J1BB8i2I09 q2lw== 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=03H9tOU4ZU6Aob62of9ZRzxsUiRGCwWaNgMF+MztT3g=; b=Eto2PFxADWRXDIeC/3xk87676e+XBcZWtS4JpJNCv90BHhI4ylg77u3242m0NHYCzr MJIux1yLn70DipKFHUWK7+/jstyPrubM3aby8YBbIsSLkprNKxxV0dyhZDtlmUSN5AJO r6I1aiowb/elm7MpwdQM5iXoln/acFuerBVy/Qd220inIRvwYMW0Ovfv4Q9QN4SzQHu/ oxHxgrFbpE9KLNgirraapvxFeLTSZUdlWd5deNSakSzZPHvDALs1kqUySkHV8pGYV1Jy w5boMPI2PMyUdsit/MIjDQ1u1EUKos7l0EV6+P2Bb3x6Jxt3M7YPUO6W8g6yo8MFZD4f 9FCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=nrehUZjz; 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 d17si159278oij.136.2020.02.05.07.43.06; Wed, 05 Feb 2020 07:43:18 -0800 (PST) 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=nrehUZjz; 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 S1727441AbgBEPmQ (ORCPT + 99 others); Wed, 5 Feb 2020 10:42:16 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38660 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbgBEPmQ (ORCPT ); Wed, 5 Feb 2020 10:42:16 -0500 Received: by mail-pf1-f196.google.com with SMTP id x185so1399333pfc.5 for ; Wed, 05 Feb 2020 07:42:14 -0800 (PST) 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=03H9tOU4ZU6Aob62of9ZRzxsUiRGCwWaNgMF+MztT3g=; b=nrehUZjzvoVHxS9MBml+qXueEBmbVQVRNi9QBTFlNb4ySXdy6sdRjrcpBdyFw4appf EWDFAjrMEGyDLWcSlj+nW93jEfRP7BY22yZ7N4pkGQzq76QczVFRgkYk/iunW/YZ/MDv sSH8U0+VX+dp0KjIQosvQElRZXeiN2OumArvk= 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=03H9tOU4ZU6Aob62of9ZRzxsUiRGCwWaNgMF+MztT3g=; b=pTUvncCIQKd+d8/Av4hGqrRJ/ZTnWXpxyNRn3Y0rCT54P2KD86I56nz6bwGbfA0DpG 4SIabniF15UOalJrGVumHVgA6rPdzRidVNO1+7Por6881nKu2q5H41sfwL60fMjMHbCF eTBO+Gx9+2A6OBAzMrvhS+VB3n63cY4FqJM3mPeq6S7g1G8FUEhKS/m3IoSFVacWYKGj Gt1Y+8M1yx9TBo17lcAJH9Gw4jY4CSJv+h+bA39ltBW/k5VQwmKBKkg38+DDv4w3aWAr ZbSSeARo1meIqz6THKQA8EIDlKrsqnQxlLLroU+j8pNG/GgxW420y27LpQvx2bvuYMBC wblQ== X-Gm-Message-State: APjAAAUAJwMxU2YBQFaLMWw6MAA6d2qkoSuZiHyJ5P8RYeopXMi7uIJm QIZ+KeG2yPK92WWi9vzVHR7xsw== X-Received: by 2002:a63:a1e:: with SMTP id 30mr28697873pgk.238.1580917334448; Wed, 05 Feb 2020 07:42:14 -0800 (PST) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id l69sm221887pgd.1.2020.02.05.07.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 07:42:13 -0800 (PST) Date: Wed, 5 Feb 2020 10:42:12 -0500 From: Joel Fernandes To: Steven Rostedt Cc: "Paul E. McKenney" , linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Amol Grover Subject: Re: [for-next][PATCH 4/4] ftrace: Add comment to why rcu_dereference_sched() is open coded Message-ID: <20200205154212.GC142103@google.com> References: <20200205104929.313040579@goodmis.org> <20200205105113.283672584@goodmis.org> <20200205063349.4c3df2c0@oasis.local.home> <20200205141915.GA194021@google.com> <20200205092847.0b650972@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205092847.0b650972@oasis.local.home> 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 Wed, Feb 05, 2020 at 09:28:47AM -0500, Steven Rostedt wrote: > On Wed, 5 Feb 2020 09:19:15 -0500 > Joel Fernandes wrote: > > > Could you paste the stack here when RCU is not watching? In trace event code > > IIRC we call rcu_enter_irqs_on() to have RCU temporarily watch, since that > > code can be called from idle loop. Should we doing the same here as well? > > Unfortunately I lost the stack trace. And the last time we tried to use > rcu_enter_irqs_on() for ftrace, we couldn't find a way to do this > properly. Ftrace is much more invasive then going into idle. The > problem is that ftrace traces RCU itself, and calling > "rcu_enter_irqs_on()" in pretty much any place in the RCU code caused > lots of bugs ;-) > > This is why we have the schedule_on_each_cpu(ftrace_sync) hack. The "schedule a task on each CPU" trick works on !PREEMPT though right? Because it is possible in PREEMPT=y to get preempted in the middle of a read-side critical section, switch to the worker thread executing the ftrace_sync() and then switch back. But RCU still has to watch that CPU since the read-side critical section was not completed. Or is there a subtlety here with ftrace that I missed? thanks, - Joel > > -- Steve