Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4391186ybv; Mon, 10 Feb 2020 18:32:40 -0800 (PST) X-Google-Smtp-Source: APXvYqw8PBARCBENSa7yIcRipDq4UGr6wdBUpKRj3vgVkNxrsQUH+DVopmLbwJJYj7v7wm5y21BV X-Received: by 2002:a05:6830:1d5b:: with SMTP id p27mr3354079oth.263.1581388360234; Mon, 10 Feb 2020 18:32:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581388360; cv=none; d=google.com; s=arc-20160816; b=0orFP5nAuK/VYT0fROki2pHoVX63SzX5jlhfms8WMZRgo7Ytjar0e7CQAL5eJRAeN/ SwTZBUtx/s/dCXnvaxqY4joCHY/FxI4kl8Tbn5HuFP6HPkYU9TjTJwCH7YGtzRtDRzKV efTzCfmpmu4n8Gb9172obdm/R1xN7gKJh43OnK0lwlxJ+STl6IiPt9RrqcTI49q/JPC5 PTtnIvJmBKj0uKiFHVppUNIRA9X2wIrfu13WJX59cRWfoD5HSGnlVeqTfCkbDC7QU3uN kg0IQstUEFhyR6T2XBbRwSJXPC2jeKhGt2Bi7ereAbiaHk32kv8YTlVIgPRXKAxUILlC 9LgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=PtMkoOYnGi2uyPOBmbmLx0JBVN4tN7/tWzpWQo1DRzs=; b=FunQYDfVBj/lYJJkaWteUs8/f/PlyYm9B/sdrmWvBgJpWngTJinEDnQEO3dnH+QaM4 d2UDIVzhpfE+wc6s1ww0Jd8yylPAzULD255u9/FxOLkIRwkNNYvOdO+POvGki7OxKbMX QJBb9JWm9Klahlk/A8NkQTHD1WXP+VVC1uE+CfkIMl0weBhGpaFXsb+c8ODO3l+7kYIZ 9sKKhnwc85dvM+QpgU9WjFoUJLi2CGSWWdqwi1gVQsmYNVrpO75z7kDAZIzzNN4Brjx3 4cRBUAE6AzQn5LfIE6/5vr2D6DUz4PMtqatFFMcccJHsVneuvfOkEXwc1Wq5YtZFnYaE xRMQ== 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 s143si1062675oih.251.2020.02.10.18.32.28; Mon, 10 Feb 2020 18:32:40 -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; 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 S1727772AbgBKCWZ (ORCPT + 99 others); Mon, 10 Feb 2020 21:22:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727493AbgBKCWZ (ORCPT ); Mon, 10 Feb 2020 21:22:25 -0500 Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC18920714; Tue, 11 Feb 2020 02:22:23 +0000 (UTC) Date: Mon, 10 Feb 2020 21:22:22 -0500 From: Steven Rostedt To: Mathieu Desnoyers Cc: linux-kernel , Peter Zijlstra , Ingo Molnar , "Joel Fernandes, Google" , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Thomas Gleixner , paulmck , Josh Triplett , Lai Jiangshan Subject: Re: [PATCH] tracing/perf: Move rcu_irq_enter/exit_irqson() to perf trace point hook Message-ID: <20200210212222.59a8c519@rorschach.local.home> In-Reply-To: <576504045.617212.1581381032132.JavaMail.zimbra@efficios.com> References: <20200210170643.3544795d@gandalf.local.home> <576504045.617212.1581381032132.JavaMail.zimbra@efficios.com> X-Mailer: Claws Mail 3.17.4git76 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Feb 2020 19:30:32 -0500 (EST) Mathieu Desnoyers wrote: > ----- On Feb 10, 2020, at 5:06 PM, rostedt rostedt@goodmis.org wrote: > > > From: "Steven Rostedt (VMware)" > > Hi Steven, Hi Mathieu! > > > because perf only uses rcu to synchronize trace points. > > That last part seems inaccurate. The tracepoint synchronization is two-fold: > one part is internal to tracepoint.c (see rcu_free_old_probes()), and the other > is only needed if the probes are within modules which can be unloaded (see > tracepoint_synchronize_unregister()). AFAIK, perf never implements probe callbacks > within modules, so the latter is not needed by perf. > > The culprit of the problem here is that perf issues "rcu_read_lock()" and > "rcu_read_unlock()" within the probe callbacks it registers to the tracepoints, > including the rcuidle ones. Those require that RCU is "watching", which is > triggering the regression when we remove the calls to rcu_irq_enter/exit_irqson() > from the rcuidle tracepoint instrumentation sites. 100% agree. I guess I need to clarify what I meant with "rcu to synchronize trace points". I meant its trace point *callbacks*, not the trace point code itself. > > Which brings a question about handling of NMIs: in the proposed patch, if > a NMI nests over rcuidle context, AFAIU it will be in a state > !rcu_is_watching() && in_nmi(), which is handled by this patch with a simple > "return", meaning important NMIs doing hardware event sampling can be > completely lost. > > Considering that we cannot use rcu_irq_enter/exit_irqson() from NMI context, > is it at all valid to use rcu_read_lock/unlock() as perf does from NMI handlers, > considering that those can be nested on top of rcuidle context ? > Note, in the __DO_TRACE macro, we've had this for a long time: /* srcu can't be used from NMI */ \ WARN_ON_ONCE(rcuidle && in_nmi()); \ With nothing triggering. -- Steve