Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3959698ybv; Mon, 10 Feb 2020 09:33:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxYim/7Rtyswp7/9BRjCKhiXQyatf/ifrjxB96jzJkYb8ujb9mFwAy/GW6ozTXuW7qwe+rU X-Received: by 2002:a05:6830:612:: with SMTP id w18mr1929539oti.160.1581356019907; Mon, 10 Feb 2020 09:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581356019; cv=none; d=google.com; s=arc-20160816; b=cPZczFjw8JcDbh7DwAkenLtuB9iMHtzU6vyCvSnZfOuC6iPX7wxZLqjlgjjg0/NCJj g+77QoweL+PatC2Ka/JDua4IIPTYrzBakHy9Nb1jC32Eqrtxiz15u193kZ39rvkjkTXl JHlN0ELUj6bHF6vekmtkqnIgUT84uUj/0acuzRYy0SH9QSwVyw15TF73I6ly4J3IJCya 7gi7vzrgtzTmKIANYrqoNf8c273knBceZ4ZlUgFbgg68cD3H4s0VJmdrHHSq8sZdKamz pL2/OXPyq9y/LlXrWNGJg7iHM85DMcqO2kn66agBxuiFRcJhNUwtZ2V6JE0y6uoMt5Dx 1H4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=tLGk2wW+eFY4z3NFz2zYJ+bD12q+92b4IvzmbQrFWaw=; b=E6JEqECEZq+3Ah8eVMT2pVAUhc2MaEhaunzpNt9X4CwostK4Jyrsu0FGRbWy7G9BG6 CVuOUTF8Qv8mmwdp+oXF7O9r+Ag26LVN1GWe/ffTNoLnNbWzMgFVhkgze8/xO8KfTCRi ORsIX61/81yqcg4g+OqPKPBOg26h/Rbp+LAjb0zihM+LGGo7Tct55Jc6WcqL854j0yzL n6MNGCtxS2HMCcoA0v3rbjGRS9B3cl69ipGjvV1jm79AjT6Ld8W785SH4SjN2LNdbMl1 x0IK5UE82AM6G8nOqTFO8qszh7KlgzHfMOcOxGToDdhrIrOBM8Jlo+dWIYkpejte4jfX HUhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=eBJUw0ia; 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=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si461337otq.94.2020.02.10.09.33.27; Mon, 10 Feb 2020 09:33:39 -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=@efficios.com header.s=default header.b=eBJUw0ia; 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=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbgBJRdH (ORCPT + 99 others); Mon, 10 Feb 2020 12:33:07 -0500 Received: from mail.efficios.com ([167.114.26.124]:45212 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbgBJRdG (ORCPT ); Mon, 10 Feb 2020 12:33:06 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id D207F245781; Mon, 10 Feb 2020 12:33:04 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id kuPWvdfNno79; Mon, 10 Feb 2020 12:33:04 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 72FB3245530; Mon, 10 Feb 2020 12:33:04 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 72FB3245530 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1581355984; bh=tLGk2wW+eFY4z3NFz2zYJ+bD12q+92b4IvzmbQrFWaw=; h=Date:From:To:Message-ID:MIME-Version; b=eBJUw0iamiA8iDM2ykssDz7YT0Ry8yd8R8JU2jI+IOZmI91nPshqENc46oKsYjyVO Rn+SCenGdFwPQr96UESrIP0af79Sq9ZtNYK0bJ9QxNCo9e4IYhW2+HW59av6B8BgKj O7lstugh65LVHW2LE4PH3fW1S2vxEiVHYWq8Zi9tuvkb2cPviCLSEIow039jcWYwL3 TOEfWrQdzOim2N/S5gYbYNSJw9jTI2vv6EaZiJDEy13eq321jZhOC2O65aH7NZksqT WSn+1iIAPXiEHLBZOPSxNgLV0YQBCRG2i8RVpVhYkH8mHvfwqS11m7bA+K3/DKdlAR JuR1Vp5FI5KbA== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7RMEyuEJBMfW; Mon, 10 Feb 2020 12:33:04 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 5B8CD245712; Mon, 10 Feb 2020 12:33:04 -0500 (EST) Date: Mon, 10 Feb 2020 12:33:04 -0500 (EST) From: Mathieu Desnoyers To: rostedt Cc: Peter Zijlstra , "Joel Fernandes, Google" , linux-kernel , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Ingo Molnar , Richard Fontana , Thomas Gleixner , paulmck , Josh Triplett , Lai Jiangshan , Arnaldo Carvalho de Melo Message-ID: <1966694237.616758.1581355984287.JavaMail.zimbra@efficios.com> In-Reply-To: <20200210120552.1a06a7aa@gandalf.local.home> References: <20200207205656.61938-1-joel@joelfernandes.org> <1997032737.615438.1581179485507.JavaMail.zimbra@efficios.com> <20200210094616.GC14879@hirez.programming.kicks-ass.net> <20200210120552.1a06a7aa@gandalf.local.home> Subject: Re: [RFC 0/3] Revert SRCU from tracepoint infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3895 (ZimbraWebClient - FF72 (Linux)/8.8.15_GA_3895) Thread-Topic: Revert SRCU from tracepoint infrastructure Thread-Index: cU4abBwtS1928irOMYESy3r+/umCMg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Feb 10, 2020, at 12:05 PM, rostedt rostedt@goodmis.org wrote: > On Mon, 10 Feb 2020 10:46:16 +0100 > Peter Zijlstra wrote: > >> Furthermore, using srcu would be detrimental, because of how it has >> smp_mb() in the read side primitives. > > I didn't realize that there was a full memory barrier in the srcu read > side. Seems to me that itself is rational for reverting it. And also a > big NAK for any suggestion to have any of the function tracing to use > it as well (which comes up here and there). The rcu_irq_enter/exit_irqson() does atomic_add_return(), which is even worse than a memory barrier. Let me summarize my understanding of a few use-cases we have with tracepoints and other instrumentation mechanisms and the guarantees they provide (or not): * Tracepoints - Uses sched-rcu (typically) - Uses SRCU for _cpuidle callsites - Planned use of SRCU to allow syscall entry/exit instrumentation to take page faults. (currently all tracers paper over that issue by filling with zeroes rather than handle the fault) - Grace period waits for both sched-rcu and SRCU. * kprobes/kretprobes - interrupts off around probe invocation * Hardware performance counters - Probe invoked from NMI context - Software performance counters - preempt off around probe invocation Moving _rcuidle instrumentation to SRCU aimed at removing a significant overhead incurred by having all _rcuidle tracepoints perform the atomic_add_return on the shared variable (which is frequent enough to impact performance). There are a couple of approaches that perf could take in order to tackle this without hurting performance for all other tracers: - If perf wishes to keep using explicit rcu_read_lock/unlock in its probes: Use is_rcu_watching() within the perf probe, and only invoke rcu_irq_enter/exit_irqson() when needed. As an alternative, perf could implement a "trampoline" which would only be used when registering a perf probe to a _rcuidle tracepoint. That trampoline would perform rcu_irq_entrer/exit_irqson() around the call to the real perf probe. - If perf can remove the redundant RCU read-side lock/unlock and replace this by waiting for the relevant RCU/SRCU grace periods instead: Basically, looking at all the instrumentation sources perf uses, all of them already provide some kind of RCU guarantee, which makes the explicit rcu read-side locks within the perf probes redundant. Removing the redundant rcu read-side lock/unlock from the perf probes should bring a slight performance improvement as well. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com