Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1104803imm; Mon, 21 May 2018 21:35:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq76iKMMPKILFk6OOMNA6GIPDGTPlRfHqntKCU9ZV7JFuscowqtbh1C8AYVbE1qkcfo2E/a X-Received: by 2002:a63:6742:: with SMTP id b63-v6mr18006212pgc.54.1526963713840; Mon, 21 May 2018 21:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526963713; cv=none; d=google.com; s=arc-20160816; b=h1THS6RlRV/x3N3tnLZID1oGYRjej4O8j8zej5xf9X7oTkFL/6Jhei/mJxGfDYcF8z uxa9UoyNiiGqGloz3pz0Z+xcBLMGknSa2hOUZsHG+DmkkGemLIVCpdTQRZ+KRhfzcVXu aLCzTYvQymuXxGIwQa44c9Bweu+sjyX3pHRfFBKdDpDhbju6AAw5xR6wcYeaALCbdZZ5 H73CPPYkLywU4lXZ0mzZHXw+II+nrfQKumTEbFlSMz6Uf/mhGWcsQW7phGhlW+1UDgNi ixobaKNGcGZeEEiGhOFRtTfXSX2YunRLF6s2cxSsih0gx9l7cNA7ena6m0cD26Vhsl4t v8aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=Gbj0+zwDW+dWzCTIi5QliuCwDmSY5J2EXcOYnZxdiIA=; b=NFmgxD6xuq+sZEqhmq47sZDivDYIPIAuvLa6YA+u5lrIz2tNqX+kUb8M8qrB+9DwhE TABZWYXtPoGd4/iGD73j1/aZ7+SZ+45pHVX0LaRtRF/JWp50YqNJhMlD6l0fL2PK3i2F X18vKTVqCGHWyiWA1SH+QozrjvD86ZoB7Ylzs2/oL1X74KMgxA1VX0Otc4bKH25uHCnX UTkO1UCRuMWFQnF/G6lKt8+360kKXs7ZdLt8KMcZAHO/+xM20eZZWQUIwH1ZEfSsh1Te FwmuCJs62xUSVBucOvPg1MYLyKVEBO4QczNP7DNpdN7l2p1gdt6HApr02aH2NcSAZqfs gwWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UMvB0bCw; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7-v6si12518572pgc.320.2018.05.21.21.34.59; Mon, 21 May 2018 21:35:13 -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=@google.com header.s=20161025 header.b=UMvB0bCw; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbeEVEes (ORCPT + 99 others); Tue, 22 May 2018 00:34:48 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:40061 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbeEVEel (ORCPT ); Tue, 22 May 2018 00:34:41 -0400 Received: by mail-io0-f194.google.com with SMTP id g14-v6so16915679ioc.7 for ; Mon, 21 May 2018 21:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gbj0+zwDW+dWzCTIi5QliuCwDmSY5J2EXcOYnZxdiIA=; b=UMvB0bCwvIcilLTFuGWdeSqSdQxIIkW+QRZWfREpKZY1zOvgyoYs9qoh90e7eL6sjd DfBCSzvM8UsvHEc3c4aV/rn00zITHiBkuq4Y0mWjV3/M60ngxtiB9h9kRsTe3grYjPgo X6YB2Okn2lSzSlyd5QQU9eqwQgdz4soKvWvti7B4xSY94JrxF3EzAF9IQowws1fmNX18 FqtAoRRPzCADsDHY4uhKrxM+cQHNI9q+5MYOsHUDrYVc1SwTR0BsQICYofMVKdwkMbSb mryKbC8LhKlB3CWwjNFDWkrD6O5syjuPf0ZVmLd2bPBNjeYjy+BSAQO1x1NrP+fFML2B iCZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gbj0+zwDW+dWzCTIi5QliuCwDmSY5J2EXcOYnZxdiIA=; b=ewdNFKNifzHg5m444QEiaOg9O3kZIIFezvbGIAq66Bj1Kgsem3pCVbhoajhAq8ZaEv vvO/cyNpbWiid9ncnOoIonHA1J/nN51ZRFdg2bNvB/NVGRAWnoAFut6x3x9lLIghHxUW 8qNuQKr4Lc7MjcBGUkmDDKjIvjAQJAAEf6CCRkF7GE9RFV5jsAcNyIXfF8k80qrQ3DdJ ld0DIGwZa1r7zfnIQ4Vrnk2Yu7klYDtRCcI0PfuZOPXevnDEN4ulNNOUkfnXyRaEx3tW MqbLtN1PekzdVj2BwaBJFXYS6sNAfEoQRrc46IghiCg2waCU7/mngcM+6wINnd9msPJB J4Zw== X-Gm-Message-State: ALKqPwe9v1wS4oa6Ud8reCurDBJlrGIsgs69mPAZoZCFl0K5zM3B2e8r mylN3IaDol4mVE6xDkBtrZzPT8kNqlEZaJGJiNpq9w== X-Received: by 2002:a6b:aa54:: with SMTP id t81-v6mr23038173ioe.235.1526963679848; Mon, 21 May 2018 21:34:39 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20180521215951.2d6abfcb@gandalf.local.home> From: Joel Fernandes Date: Mon, 21 May 2018 21:34:28 -0700 Message-ID: Subject: Re: Tasks RCU vs Preempt RCU To: Steven Rostedt Cc: "Joel Fernandes (Google)" , Paul McKenney , Byungchul Park , Mathieu Desnoyers , Josh Triplett , Lai Jiangshan , LKML , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 21, 2018 at 6:59 PM 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. 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 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 cond_resched_tasks_qs. Of these, I feel only the cond_resched case isn't trackable with and IPI mechanism. thanks, - Joel