Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3741285ybv; Mon, 10 Feb 2020 05:38:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxQCQTfNuZ+nmKGzf6K7BPCa6y57HKQBfr6Prg5nTa5aQ9HGGQ4szdcKD27Web5mg34jEOK X-Received: by 2002:a9d:1c9c:: with SMTP id l28mr1078106ota.210.1581341929591; Mon, 10 Feb 2020 05:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581341929; cv=none; d=google.com; s=arc-20160816; b=Kd2AAMvgt+PGpkE9ip6rBXF/n0NLljMZXU4Zwl98O2JvMlrVwOSCBwT1aX+GTWfDvI 22tOPB4FprtY7iOBkaC0ijg9wx40PrZRzc4OPmvTqBpcB5NwIjsZcLfty9cXWbY5Xo4a 85mRWoOBiAdgLMaeNxH6NtU2Nv7sZqp4lIOQB6nGU0YFoWNXANw35PYAQYJ2vqLSxCr8 C1xPlNVXidUBC+n1ivkiSZhgOcbqyxM+qMUJwq7fb9Ot1lYMXu2uIVHezLS3PDatHj/b +g1EImTpQGVewFLZqGxNKwqp9CvaRmChszy6cI5cE9K3GyqhG4ZpgXvT1eeFIRWNjnLg YGug== 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=jC9iF79l72huc+x3HSbYaxVF1e+LhBGzX23KyOIRDzQ=; b=ue+RryfW/h0nN9GbqdfIPq0fOONC6GNDHMcKvAhEj9xsw/e0LJnjyBmwIutoZnWbhS xtpZu73Sm3qBs/GV08/3sGNBQYGH7mRbbiNPcE+NqF6OLVkIsi5NAlt2CvxwKHAI3U5f zZYJLC6QkS1fFBwkaOqX0fLADBbIL8V+szIxYwheQoM5yvEi/op2L5WBnmct/nm7tJH5 VwAqvExABLhL1VnjNog9yUxe8Hxr3GcEHV0NkXbhZraGxh4AIv1DV7EvxfZye+S70CTD EBcw59r6U+W9brM2qE0Ijfmta9gzujPqX4+D2PJG6XF5Ak/RmKe1Zym18glx9OuZMkhx s9uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qL0E8isK; 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 r10si176234otn.241.2020.02.10.05.38.38; Mon, 10 Feb 2020 05:38:49 -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=@kernel.org header.s=default header.b=qL0E8isK; 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 S1731363AbgBJNhB (ORCPT + 99 others); Mon, 10 Feb 2020 08:37:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:35542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbgBJNg6 (ORCPT ); Mon, 10 Feb 2020 08:36:58 -0500 Received: from paulmck-ThinkPad-P72.home (unknown [193.85.242.128]) (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 5FB6120714; Mon, 10 Feb 2020 13:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581341817; bh=nB7K6kpxye76S3Jb8ETTHL7QodfEBqCDjkWsssZduzE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=qL0E8isKyNkFKrWHVRu6fEZ8YKQGgpCkWyrklytg5HLFiuRVbWyMcACAdGDyWyvKL tXWa6K4S1TnaIaRebnAETuYUEj8+xmvoxHFOJ5wFKfj8iGowNk3Di/J1v98QyddiKJ k5TPJaaxpzQm/HzKDSK8Ary0+sya0jZdvGiHG7/E= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 02E833522700; Mon, 10 Feb 2020 05:36:53 -0800 (PST) Date: Mon, 10 Feb 2020 05:36:52 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Mathieu Desnoyers , "Joel Fernandes, Google" , linux-kernel , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Ingo Molnar , Richard Fontana , rostedt , Thomas Gleixner , Josh Triplett , Lai Jiangshan , Arnaldo Carvalho de Melo Subject: Re: [RFC 0/3] Revert SRCU from tracepoint infrastructure Message-ID: <20200210133652.GV2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200207205656.61938-1-joel@joelfernandes.org> <1997032737.615438.1581179485507.JavaMail.zimbra@efficios.com> <20200210094616.GC14879@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210094616.GC14879@hirez.programming.kicks-ass.net> 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 Mon, Feb 10, 2020 at 10:46:16AM +0100, Peter Zijlstra wrote: > On Sat, Feb 08, 2020 at 11:31:25AM -0500, Mathieu Desnoyers wrote: > > ----- On Feb 7, 2020, at 3:56 PM, Joel Fernandes, Google joel@joelfernandes.org wrote: > > > > > Hi, > > > These patches remove SRCU usage from tracepoints. The reason for proposing the > > > reverts is because the whole point of SRCU was to avoid having to call > > > rcu_irq_enter_irqson(). However this was added back in 865e63b04e9b2 ("tracing: > > > Add back in rcu_irq_enter/exit_irqson() for rcuidle tracepoints") because perf > > > was breaking.. > > > > I think the original patch re-enabling the rcu_irq_enter/exit_irqson() is a > > tracepoint band-aid over what should actually been fixed within perf instead. > > > > Perf should not do rcu_read_lock/unlock()/synchronize_rcu(), but rather use > > tracepoint_synchronize_unregister() to match the read-side provided by > > tracepoints. > > > > If perf can then just rely on the underlying synchronization provided by each > > instrumentation providers (tracepoint, kprobe, ...) and not explicitly add its own > > unneeded synchronization on top (e.g. rcu_read_lock/unlock), then it should simplify > > all this. > > It can't. At this point it doesn't know where the event came from. Also, > the whole perf stuff is per definition non-preemptible, as it needs to > run from NMI context. > > Furthermore, using srcu would be detrimental, because of how it has > smp_mb() in the read side primitives. Note that rcu_irq_enter() and rcu_irq_exit() also contain value-returning atomics, which imply full memory barriers. > The best we can do is move that rcu_irq_enter/exit_*() crud into the > perf tracepoint glue I suppose. One approach would be to define a synchronize_preempt_disable() that waits only for pre-existing disabled-preemption regions (including of course diabled-irq and NMI-handler regions. Something like Steve Rostedt's workqueue-baed schedule_on_each_cpu(ftrace_sync) implementation might work. There are of course some plusses and minuses: + Works on preempt-disable regions in idle-loop code without the need to invoke rcu_idle_exit() and rcu_idle_enter().. + Straightforward implementation. - Does not work on preempt-disable regions on offline CPUs. (I have no idea if this really matters.) - Schedules on idle CPUs, so usage needs to be restricted to avoid messing up energy-efficient systems. (It should be just fine to use this for tracing.) Thoughts? Thanx, Paul