Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1118358imm; Mon, 21 May 2018 21:54:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxnccY/0SMqx9eNMreSjtPYtiG0d6t2Ie1V+xKNvUoDZDd4Zs9QM7YXLE/htrXRewMUQfl X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr19320014plc.301.1526964882128; Mon, 21 May 2018 21:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526964882; cv=none; d=google.com; s=arc-20160816; b=0grHlPNNQb1rBXMHWmyQl/RXOye1U9c8MYB6u/EbuLUibeIFfxUrBY1YsL4AHUkT/3 9AyxiYTUPvNxC7NqihE+OQOc3wWCEqnOTOPuQVbIrGkrBK5BJEZorNTLYPg+e0PUclp4 /uufsfFu+fHkaB2dF9THjJorykKvqj2wK3s8oPZU0QHDD/ErqQUDQ4kkXO+NcB0Aes3n hMZ0feTVVlzPpJrdqBtvXbjCfIJi9DyPtuBGB8uBLHU9PiURvdeGSGo+VDZEHv1b/OjE RfMJ2W7HwWDQ5sZS3nir2WtroucVubXpG0yuSFz1WOYk8O85iM7gS+nSUgUJZUisRwoo laiA== 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:arc-authentication-results; bh=2Cc13OEYt0wU6/0cjF6NYjTF97Ymqnq/DEbFm9y/jqQ=; b=M5+f9zf8z1MNQ5l+nxZvzbkwWCt3e28XsZJayFd3I+2WK7B6nBCvyGw39MmlgYlLhi uBWrekd8YOra5zD4f9GZEKLCaQszl4CldYfLOVZqnUvstAHDS+w1Sy7waLizHaX8O+WE M1dCnp84acfEsaIXfC3aqmPc1KAyXeqTN7Ls4CZ7wzSrVj2PEhIi0UazNxzAfRS1c/wZ DOp7BPWZ+D7BJJ7rxqS6IOFRbRb4JeWSuDzLNGKkE0n6JuWgu3JFlTCuVewggC0WA/Hp ISA/NBayzJ0c+WHSQusdUGM49tKpA8h2FO2TUZ15VzWYNBp86e0zgIjo14K44qaPxX/k vqdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=gOca6axg; 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 o24-v6si11784178pgv.80.2018.05.21.21.54.27; Mon, 21 May 2018 21:54:42 -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=@joelfernandes.org header.s=google header.b=gOca6axg; 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 S1751294AbeEVEyT (ORCPT + 99 others); Tue, 22 May 2018 00:54:19 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:41623 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbeEVEyQ (ORCPT ); Tue, 22 May 2018 00:54:16 -0400 Received: by mail-pf0-f195.google.com with SMTP id v63-v6so8135754pfk.8 for ; Mon, 21 May 2018 21:54:16 -0700 (PDT) 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=2Cc13OEYt0wU6/0cjF6NYjTF97Ymqnq/DEbFm9y/jqQ=; b=gOca6axgtoy5mB24YtSctGusNf3M8vdxmsRaNwf9VnJEJJBAiNF4nnRKKTIvoZjLp1 9wI6HXs9N2IQyGf93gCcGUED4DzJFH7jyNQNNXR1GgsloaaV+wo2wI4P4CauPLfhrJUI V6HswEWSVmRYi2UCdnwAGXpHJXM6i4HMm+TCY= 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=2Cc13OEYt0wU6/0cjF6NYjTF97Ymqnq/DEbFm9y/jqQ=; b=DcDKPjII7uccs9LjwpNApJ4Tbw0niJRHOfYThD1P77gXRmRa/CktS+/IkRQEURrQz5 fPyxzUWaQgWfo0xo+8c/mJ78FS3OV/HlW8HhLEAsVfHhd0hr7oE8W8ry8ibFEOp/JRYJ iKRKK5OvP2qrKdFuO0WwNpJBB2DftJiw3xZdZUZjcpv7bM9fQxkTKAkL/ejlaO2otcI0 zrkL5XKvC358NH3JqSign3y0HK/2C4xPPRcyT3yApc6EmijZq+Sxn8d1Sp7flOzh+Jdm wf8AHRtopwLgUAmy6sozv+hToshbBZd4JxItfzF+JbHl+IRCJw8N49BVOZzlFHfq7Tbi TCFw== X-Gm-Message-State: ALKqPwc8Ie06aP+D5tDIErQn5D/MHEpz0ss/juqQofYterfFRaDue7Xv +N2t8mn1+HK+nLuD9coOHfIgtg== X-Received: by 2002:a62:4a88:: with SMTP id c8-v6mr22728156pfj.23.1526964855958; Mon, 21 May 2018 21:54:15 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id a4-v6sm32131344pfj.19.2018.05.21.21.54.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 May 2018 21:54:15 -0700 (PDT) Date: Mon, 21 May 2018 21:54:14 -0700 From: Joel Fernandes To: Steven Rostedt Cc: "Paul E. McKenney" , byungchul.park@lge.com, mathieu.desnoyers@efficios.com, Josh Triplett , Lai Jiangshan , linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: Tasks RCU vs Preempt RCU Message-ID: <20180522045414.GG40541@joelaf.mtv.corp.google.com> References: <20180518183623.GA163151@joelaf.mtv.corp.google.com> <20180519022918.GV3803@linux.vnet.ibm.com> <20180519225905.GB134184@joelaf.mtv.corp.google.com> <20180520004938.GZ3803@linux.vnet.ibm.com> <20180520112843.57079857@grimm.local.home> <20180520191846.GA248075@joelaf.mtv.corp.google.com> <20180521215951.2d6abfcb@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521215951.2d6abfcb@gandalf.local.home> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (Resending because my previous mail client terribly wrapped things..) On Mon, May 21, 2018 at 09:59:51PM -0400, Steven Rostedt wrote: [...] > > > > Just thinking out loud and probably some food for thought.. > > > > The rcu_read_lock/unlock primitive are extrememly fast, so I don't personally > > think there's a time hit. > > > > Could we get around the trampoline code == data issue by say using a > > multi-stage trampoline like so? : > > > > call func_tramp --> (static > > trampoline) (dynamic trampoline) > > rcu_read_lock() -------> set up stack > > call function_tracer() > > pop stack > > rcu_read_unlock() <------ ret > > > > I know there's probably more to it than this, but conceptually atleast, it > > Yes, there is more to it. Think about why we create a dynamic > trampoline. It is to make a custom call per callback for a group of > functions being traced by that callback. > > Now, if we make that static trampoline, we just lost the reason for the > dynamic one. How would that work if you have 5 different users of the > callbacks (and lets not forget about optimized kprobes)? How do you > jump from the static trampoline to the dynamic one with a single call? > > > feels like all the RCU infrastructure is already there to handle preemption > > within a trampoline and it would be cool if the trampoline were as shown > > above for the dynamically allocated trampolines. Atleast I feel it will be > > faster than the pre-trampoline code that did the hash lookups / matching to > > call the right function callbacks, and could help eliminiate need for the > > RCU-tasks subsystem and its kthread then. > > I don't see how the static trampoline would be able to call. Do we > create a static trampoline for every function that is traced and never > delete it? That's a lot of memory. Yeah, ok. I agree that was a dumb idea. :) I see it defeats the point. > Also, we trace rcu_read_lock/unlock(), and I use that for a lot of > debugging. And we also need to deal with tracing code that RCU does not > watch, because function tracing does a lot of that too. I finally gave > up trying to have the stack tracer trace those locations, because it > was a serious game of whack a mole that would never end. I don't want > to give up full function tracing for the same reason. Yes, I understand. Its good to not have it depend on too many things which may limit its utility. > > If you still feel its nots worth it, then that's okay too and clearly the > > RCU-tasks has benefits such as a simpler trampoline implementation.. > > If you are worried about making RCU simpler, we can go to my original > thought which was to make a home grown RCU like system that we can use, > as this has different requirements than normal RCU has. Like we don't > need a "lock" at all. We just need guaranteed quiescent points that we > make sure all tasks would go through before freeing the trampolines. > But it was decided to create a new flavor of RCU instead of doing that. Yes, lets brain storm this if you like. One way I was thinking if we can manually check every CPU and see what state its in (usermode, kernel, idle etc) using an IPI mechanism. Once all CPUs have been seen to be in usermode, or idle atleast once - then we are done. You have probably already thought about this so feel free to say why its not a good idea, but to me there are 3 places that a tasks quiescent state is recorded: during the timer tick, during task sleep and during rcu_note_voluntary_context_switch in cond_resched_rcu_qs. Of these, I feel only the cond_resched_rcu_qs case isn't trackable with IPI mechanism which may make the detection a bit slower, but tasks-RCU in mainline is slow right now anyway (~ 1 second delay if any task was held). thanks, - Joel