Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp193710ybh; Mon, 9 Mar 2020 19:27:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtAVAUFg2TUzfdyLO8t/O/AKeE4LTUeJl+REwVVPa4XPOeCWLhADdJl8GpaNPfr1MywustN X-Received: by 2002:aca:ea56:: with SMTP id i83mr33949oih.156.1583807263651; Mon, 09 Mar 2020 19:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583807263; cv=none; d=google.com; s=arc-20160816; b=h09+giFpZ4KjdRH6/DtPWvdjVhPC+kHOIEfSBMUTJA1q5JurAJmEdAM+f3Fnntp4UN ywHvFVRVDSHzAOkBByEbRJWupvu/TqwxMP/1cSXCzgDnYFhob8WOuwDt91Fk4XVemchD mLwRFSQqU9hfhKG/yoojg3ADu50+w0MQfoABap5zVUgnM5VTzBP6wCjS3mEp2MPQZ2qz H3mQOVx7cwRaFL8ox8oPkT0C+RhNwR8U+oWdSxI8sUnfjtRJPWDZLJ9bJcmqXmkjMM9f oKiqgRW9OjrPgYCs/OC+GmfZXlxCtk93SxX202pRyr5coqgK0ZNC/RikcqDGpTPfTHYX OOZA== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Qq5n4IfgPWCrQBlhwuezQerQJvpfGJX2cN+2GTkoPjI=; b=HCqQU9llf934cnwVP6HlQgcGqUwox6D3sr3mIy/K0BiIJgQZpiCQDHF7UpdT0RZqcJ VUhBV2AFzBcbkznLM4G6syyI3VXMYGF7ZyN2veCMEEsYkebTXTB1pMy3SjWjN2LAvWk7 WGn7W9c4ITSHl051uUdfspv218S17Vld4CUz9u1r/M1FPwRyuHjZFV4nCIjlHQ0IaAiU qM0pqfCi8voXg1W42JPB15S1mNGBTryXtUZtqJx+a+5YI0SK4LEFAX8l4vvM/OGNwGl7 OpPtAbO35TGBtlpAtTmSTItD8X/sHpFcAdUA/GSVE8aLNRaXVJC3+PjjDjggUq4grP8L 9vJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=egIcQ56Y; 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 w29si2083585oth.24.2020.03.09.19.27.30; Mon, 09 Mar 2020 19:27:43 -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=egIcQ56Y; 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 S1726695AbgCJC0u (ORCPT + 99 others); Mon, 9 Mar 2020 22:26:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:37470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726450AbgCJC0u (ORCPT ); Mon, 9 Mar 2020 22:26:50 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (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 70C1D20637; Tue, 10 Mar 2020 02:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583807209; bh=nQXDEoo6Qa8IkKSSYjqM1U7q4GgW+WWnETvYqiwoqgs=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=egIcQ56YpmAPHTS7ypaqsTA/2uGGF8z0keKlDwRMqns3cH6/KHuNtxSsIT65+9uIb HhlixC6yd+qo1Bn6D/kGmf6whPjv/SRCZlOp6RZis8NZk0Utm1vUlvXbsGBmLzNqg0 CpRBitk3tKU0XXIB2UnlGhNyBq2UxFarHZ8WRiXc= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 465CA3522730; Mon, 9 Mar 2020 19:26:49 -0700 (PDT) Date: Mon, 9 Mar 2020 19:26:49 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: Thomas Gleixner , LKML , Peter Zijlstra , Steven Rostedt , Masami Hiramatsu , Alexei Starovoitov , Mathieu Desnoyers , Joel Fernandes Subject: Re: Instrumentation and RCU Message-ID: <20200310022649.GW2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <87mu8p797b.fsf@nanos.tec.linutronix.de> <20200309204710.GU2935@paulmck-ThinkPad-P72> <20200309235210.GB20868@lenoir> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200309235210.GB20868@lenoir> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2020 at 12:52:11AM +0100, Frederic Weisbecker wrote: > On Mon, Mar 09, 2020 at 01:47:10PM -0700, Paul E. McKenney wrote: > > On Mon, Mar 09, 2020 at 06:02:32PM +0100, Thomas Gleixner wrote: > > > #3) RCU idle > > > > > > Being able to trace code inside RCU idle sections is very similar to > > > the question raised in #1. > > > > > > Assume all of the instrumentation would be doing conditional RCU > > > schemes, i.e.: > > > > > > if (rcuidle) > > > .... > > > else > > > rcu_read_lock_sched() > > > > > > before invoking the actual instrumentation functions and of course > > > undoing that right after it, that really begs the question whether > > > it's worth it. > > > > > > Especially constructs like: > > > > > > trace_hardirqs_off() > > > idx = srcu_read_lock() > > > rcu_irq_enter_irqson(); > > > ... > > > rcu_irq_exit_irqson(); > > > srcu_read_unlock(idx); > > > > > > if (user_mode) > > > user_exit_irqsoff(); > > > else > > > rcu_irq_enter(); > > > > > > are really more than questionable. For 99.9999% of instrumentation > > > users it's absolutely irrelevant whether this traces the interrupt > > > disabled time of user_exit_irqsoff() or rcu_irq_enter() or not. > > > > > > But what's relevant is the tracer overhead which is e.g. inflicted > > > with todays trace_hardirqs_off/on() implementation because that > > > unconditionally uses the rcuidle variant with the scru/rcu_irq dance > > > around every tracepoint. > > > > > > Even if the tracepoint sits in the ASM code it just covers about ~20 > > > low level ASM instructions more. The tracer invocation, which is > > > even done twice when coming from user space on x86 (the second call > > > is optimized in the tracer C-code), costs definitely way more > > > cycles. When you take the scru/rcu_irq dance into account it's a > > > complete disaster performance wise. > > > > Suppose that we had a variant of RCU that had about the same read-side > > overhead as Preempt-RCU, but which could be used from idle as well as > > from CPUs in the process of coming online or going offline? I have not > > thought through the irq/NMI/exception entry/exit cases, but I don't see > > why that would be problem. > > > > This would have explicit critical-section entry/exit code, so it would > > not be any help for trampolines. > > > > Would such a variant of RCU help? > > > > Yeah, I know. Just what the kernel doesn't need, yet another variant > > of RCU... > > I was thinking about having a tracing-specific implementation of RCU. > Last week Steve told me that the tracing ring buffer has its own ad-hoc > RCU implementation which schedule a thread on each CPU to complete a grace > period (did I understand it right?). Of course such a flavour of RCU wouldn't > be nice to nohz_full but surely we can arrange some tweaks for those who > require strong isolation. I'm sure you're having a much better idea though. Well, that too. Please see CONFIG_TASKS_RCU_RUDE in current "dev" on -rcu. But yes, another is on its way... Hey, it compiled, so it much be perfect, right? :-/ Thanx, Paul